diff --git a/dev/devicelab/bin/tasks/flutter_gallery__transition_perf_with_semantics.dart b/dev/devicelab/bin/tasks/flutter_gallery__transition_perf_with_semantics.dart new file mode 100644 index 0000000000..27c61713cd --- /dev/null +++ b/dev/devicelab/bin/tasks/flutter_gallery__transition_perf_with_semantics.dart @@ -0,0 +1,29 @@ +// Copyright 2017 The Chromium 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 'package:flutter_devicelab/tasks/gallery.dart'; +import 'package:flutter_devicelab/framework/adb.dart'; +import 'package:flutter_devicelab/framework/framework.dart'; + +Future main() async { + deviceOperatingSystem = DeviceOperatingSystem.android; + await task(() async { + final TaskResult withoutSemantics = await createGalleryTransitionTest()(); + final TaskResult withSemantics = await createGalleryTransitionTest(semanticsEnabled: true)(); + + final List benchmarkScoreKeys = []; + final Map data = {}; + for (String key in withSemantics.benchmarkScoreKeys) { + final String deltaKey = 'delta_$key'; + data[deltaKey] = withSemantics.data[key] - withoutSemantics.data[key]; + data['semantics_$key'] = withSemantics.data[key]; + data[key] = withoutSemantics.data[key]; + benchmarkScoreKeys.add(deltaKey); + } + + return new TaskResult.success(data, benchmarkScoreKeys: benchmarkScoreKeys); + }); +} diff --git a/dev/devicelab/lib/tasks/gallery.dart b/dev/devicelab/lib/tasks/gallery.dart index 6a36e00e6a..b0730033bd 100644 --- a/dev/devicelab/lib/tasks/gallery.dart +++ b/dev/devicelab/lib/tasks/gallery.dart @@ -12,12 +12,16 @@ import '../framework/framework.dart'; import '../framework/ios.dart'; import '../framework/utils.dart'; -TaskFunction createGalleryTransitionTest() { - return new GalleryTransitionTest(); +TaskFunction createGalleryTransitionTest({ bool semanticsEnabled: false }) { + return new GalleryTransitionTest(semanticsEnabled: semanticsEnabled); } class GalleryTransitionTest { + GalleryTransitionTest({ this.semanticsEnabled: false }); + + final bool semanticsEnabled; + Future call() async { final Device device = await devices.workingDevice; await device.unlock(); @@ -33,11 +37,15 @@ class GalleryTransitionTest { await flutter('build', options: ['ios', '--profile']); } + final String testDriver = semanticsEnabled + ? 'transitions_perf_with_semantics.dart' + : 'transitions_perf.dart'; + await flutter('drive', options: [ '--profile', '--trace-startup', '-t', - 'test_driver/transitions_perf.dart', + 'test_driver/$testDriver', '-d', deviceId, ]); diff --git a/dev/devicelab/manifest.yaml b/dev/devicelab/manifest.yaml index a67b88997d..a8fab3f439 100644 --- a/dev/devicelab/manifest.yaml +++ b/dev/devicelab/manifest.yaml @@ -274,6 +274,14 @@ tasks: stage: devicelab required_agent_capabilities: ["linux/android"] + flutter_gallery__transition_perf_with_semantics: + description: > + Measures the delta in performance of screen transitions without and + with semantics enabled. + stage: devicelab + required_agent_capabilities: ["linux/android"] + flaky: true + flutter_gallery__memory_nav: description: > Measures memory usage after repeated navigation in Gallery. diff --git a/examples/flutter_gallery/test_driver/transitions_perf_test.dart b/examples/flutter_gallery/test_driver/transitions_perf_test.dart index 827ee70055..614a2b31fc 100644 --- a/examples/flutter_gallery/test_driver/transitions_perf_test.dart +++ b/examples/flutter_gallery/test_driver/transitions_perf_test.dart @@ -174,11 +174,15 @@ Future runDemos(Iterable demos, FlutterDriver driver) async { } } -void main() { +void main(List args) { group('flutter gallery transitions', () { FlutterDriver driver; setUpAll(() async { driver = await FlutterDriver.connect(); + if (args.contains('--with_semantics')) { + print('Enabeling semantics...'); + await driver.setSemantics(true); + } }); tearDownAll(() async { diff --git a/examples/flutter_gallery/test_driver/transitions_perf_with_semantics.dart b/examples/flutter_gallery/test_driver/transitions_perf_with_semantics.dart new file mode 100644 index 0000000000..02879b4871 --- /dev/null +++ b/examples/flutter_gallery/test_driver/transitions_perf_with_semantics.dart @@ -0,0 +1,9 @@ +// Copyright 2017 The Chromium 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 'transitions_perf.dart' as transitions_perf; + +void main() { + transitions_perf.main(); +} diff --git a/examples/flutter_gallery/test_driver/transitions_perf_with_semantics_test.dart b/examples/flutter_gallery/test_driver/transitions_perf_with_semantics_test.dart new file mode 100644 index 0000000000..afa8235edd --- /dev/null +++ b/examples/flutter_gallery/test_driver/transitions_perf_with_semantics_test.dart @@ -0,0 +1,9 @@ +// Copyright 2017 The Chromium 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 'transitions_perf_test.dart' as transitions_perf_test; + +void main() { + transitions_perf_test.main(['--with_semantics']); +}