hello_world__memory.dart 1.13 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
import 'package:flutter_devicelab/framework/framework.dart';
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';

class HelloWorldMemoryTest extends MemoryTest {
  HelloWorldMemoryTest() : super(
    '${flutterDirectory.path}/examples/hello_world',
    'lib/main.dart',
    'io.flutter.examples.hello_world',
  );

  /// Launch an app with no instrumentation and measure its memory usage after
  /// 1.5s and 3.0s.
  @override
  Future<void> useMemory() async {
    print('launching $project$test on device...');
    await flutter('run', options: <String>[
      '--verbose',
      '--release',
      '--no-resident',
25
      '-d', device!.deviceId,
26 27
      test,
    ]);
28
    await Future<void>.delayed(const Duration(milliseconds: 1500));
29
    await recordStart();
30
    await Future<void>.delayed(const Duration(milliseconds: 3000));
31 32 33
    await recordEnd();
  }
}
34

35
Future<void> main() async {
36
  await task(HelloWorldMemoryTest().run);
37
}