Reland "Add Crane test to the new Gallery app (#62162)" (#62544)

This commit is contained in:
Yuqian Li 2020-07-31 09:56:04 -07:00 committed by GitHub
parent e5de16a247
commit e6bc56f25a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,33 @@
// 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.
import 'dart:async';
import 'dart:io';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/new_gallery.dart';
import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:path/path.dart' as path;
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
final Directory galleryParentDir =
Directory.systemTemp.createTempSync('new_gallery_test');
final Directory galleryDir =
Directory(path.join(galleryParentDir.path, 'gallery'));
try {
await task(
NewGalleryPerfTest(
galleryDir,
timelineFileName: 'transitions-crane',
dartDefine: 'onlyCrane=true',
).run,
);
} finally {
rmTree(galleryParentDir);
}
}

View File

@ -12,7 +12,16 @@ import '../framework/framework.dart';
import '../framework/utils.dart';
class NewGalleryPerfTest extends PerfTest {
NewGalleryPerfTest(this.galleryDir) : super(galleryDir.path, 'test_driver/transitions_perf.dart', 'transitions');
NewGalleryPerfTest(
this.galleryDir, {
String timelineFileName = 'transitions',
String dartDefine = '',
}) : super(
galleryDir.path,
'test_driver/transitions_perf.dart',
timelineFileName,
dartDefine: dartDefine,
);
@override
Future<TaskResult> run() async {

View File

@ -357,6 +357,7 @@ class PerfTest {
this.testDriver,
this.needsFullTimeline = true,
this.benchmarkScoreKeys,
this.dartDefine = '',
});
/// The directory where the app under test is defined.
@ -395,6 +396,9 @@ class PerfTest {
/// ```
final List<String> benchmarkScoreKeys;
/// Additional flags for `--dart-define` to control the test
final String dartDefine;
Future<TaskResult> run() {
return internalRun();
}
@ -427,6 +431,8 @@ class PerfTest {
if (writeSkslFileName != null)
...<String>['--write-sksl-on-exit', writeSkslFileName],
if (cacheSkSL) '--cache-sksl',
if (dartDefine.isNotEmpty)
...<String>['--dart-define', dartDefine],
'-d',
deviceId,
]);

View File

@ -812,6 +812,13 @@ tasks:
stage: devicelab
required_agent_capabilities: ["mac/ios"]
new_gallery__crane_perf:
description: >
Measures the performance of the Crane page in the new Flutter Gallery on Android.
stage: devicelab
required_agent_capabilities: ["linux/android"]
flaky: true
fast_scroll_large_images__memory:
description: >
Measures memory usage for scrolling through a list of large images.