fast_scroll_heavy_gridview__memory.dart 1.5 KB
Newer Older
1 2 3 4
// Copyright 2014 The Flutter Authors. All rights reserved.
// 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/devices.dart';
6 7 8 9 10 11 12 13 14 15 16 17 18 19
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';

const String kPackageName = 'com.example.macrobenchmarks';

class FastScrollHeavyGridViewMemoryTest extends MemoryTest {
  FastScrollHeavyGridViewMemoryTest()
      : super(
          '${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
          'test_memory/heavy_gridview.dart', kPackageName,
        );

  @override
20
  AndroidDevice? get device => super.device as AndroidDevice?;
21 22 23 24 25 26 27 28

  @override
  int get iterationCount => 5;

  @override
  Future<void> useMemory() async {
    await launchApp();
    await recordStart();
29
    await device!.shellExec('input', <String>['swipe', '50 1500 50 50 50']);
30
    await Future<void>.delayed(const Duration(milliseconds: 1500));
31
    await device!.shellExec('input', <String>['swipe', '50 1500 50 50 50']);
32
    await Future<void>.delayed(const Duration(milliseconds: 1500));
33
    await device!.shellExec('input', <String>['swipe', '50 1500 50 50 50']);
34 35 36 37 38 39 40 41 42
    await Future<void>.delayed(const Duration(milliseconds: 1500));
    await recordEnd();
  }
}

Future<void> main() async {
  deviceOperatingSystem = DeviceOperatingSystem.android;
  await task(FastScrollHeavyGridViewMemoryTest().run);
}