forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gallery demo start-time performance test (flutter#3655)
* Gallery demo start-time performance test
- Loading branch information
Hans Muller
committed
May 4, 2016
1 parent
76b04cd
commit a9b965c
Showing
10 changed files
with
231 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
examples/material_gallery/test_driver/transitions_perf.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2016 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 'package:flutter_driver/driver_extension.dart'; | ||
import 'package:material_gallery/main.dart' as app; | ||
|
||
void main() { | ||
enableFlutterDriverExtension(); | ||
app.main(); | ||
} |
93 changes: 93 additions & 0 deletions
93
examples/material_gallery/test_driver/transitions_perf_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// Copyright 2016 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_driver/flutter_driver.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
// Warning: the following strings must be kept in sync with GalleryHome. | ||
const List<String> demoCategories = const <String>['Demos', 'Components', 'Style']; | ||
|
||
const List<String> demoNames = const <String>[ | ||
'Weather', | ||
'Fitness', | ||
'Fancy lines', | ||
'Flexible space toolbar', | ||
'Floating action button', | ||
'Buttons', | ||
'Cards', | ||
'Chips', | ||
'Date picker', | ||
'Data tables', | ||
'Dialog', | ||
'Drop-down button', | ||
'Expand/collapse list control', | ||
'Grid', | ||
'Icons', | ||
'Leave-behind list items', | ||
'List', | ||
'Menus', | ||
'Modal bottom sheet', | ||
'Over-scroll', | ||
'Page selector', | ||
'Persistent bottom sheet', | ||
'Progress indicators', | ||
'Scrollable tabs', | ||
'Selection controls', | ||
'Sliders', | ||
'Snackbar', | ||
'Tabs', | ||
'Text fields', | ||
'Time picker', | ||
'Tooltips', | ||
'Colors', | ||
'Typography' | ||
]; | ||
|
||
void main() { | ||
group('flutter gallery transitions', () { | ||
FlutterDriver driver; | ||
setUpAll(() async { | ||
driver = await FlutterDriver.connect(); | ||
}); | ||
|
||
tearDownAll(() async { | ||
if (driver != null) | ||
driver.close(); | ||
}); | ||
|
||
test('all demos', () async { | ||
Timeline timeline = await driver.traceAction(() async { | ||
// Expand the demo category submenus. | ||
for (String category in demoCategories.reversed) { | ||
await driver.tap(find.text(category)); | ||
await new Future<Null>.delayed(new Duration(milliseconds: 500)); | ||
} | ||
// Scroll each demo menu item into view, launch the demo and | ||
// return to the demo menu 2x. | ||
for(String demoName in demoNames) { | ||
SerializableFinder menuItem = find.text(demoName); | ||
await driver.scrollIntoView(menuItem); | ||
await new Future<Null>.delayed(new Duration(milliseconds: 500)); | ||
|
||
for(int i = 0; i < 2; i += 1) { | ||
await driver.tap(menuItem); // Launch the demo | ||
await new Future<Null>.delayed(new Duration(milliseconds: 500)); | ||
await driver.tap(find.byTooltip('Back')); | ||
await new Future<Null>.delayed(new Duration(milliseconds: 1000)); | ||
} | ||
} | ||
}, | ||
categories: const <TracingCategory>[ | ||
TracingCategory.dart, | ||
TracingCategory.gc, | ||
TracingCategory.compiler | ||
]); | ||
new TimelineSummary.summarize(timeline) | ||
..writeSummaryToFile('transitions_perf', pretty: true) | ||
..writeTimelineToFile('transitions_perf', pretty: true); | ||
}, timeout: new Timeout(new Duration(minutes: 15))); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters