Declare locals final where not reassigned (gallery) (#8571)
This commit is contained in:
@@ -18,9 +18,9 @@ void main() {
|
||||
});
|
||||
|
||||
test('navigation', () async {
|
||||
Completer<Null> completer = new Completer<Null>();
|
||||
final Completer<Null> completer = new Completer<Null>();
|
||||
bool scroll = true;
|
||||
SerializableFinder menuItem = find.text('Text fields');
|
||||
final SerializableFinder menuItem = find.text('Text fields');
|
||||
driver.waitFor(menuItem).then<Null>((Null value) async {
|
||||
scroll = false;
|
||||
await new Future<Null>.delayed(kWaitBetweenActions);
|
||||
|
||||
@@ -21,9 +21,9 @@ void main() {
|
||||
});
|
||||
|
||||
test('measure', () async {
|
||||
Timeline timeline = await driver.traceAction(() async {
|
||||
final Timeline timeline = await driver.traceAction(() async {
|
||||
// Find the scrollable stock list
|
||||
SerializableFinder stockList = find.byValueKey('Gallery List');
|
||||
final SerializableFinder stockList = find.byValueKey('Gallery List');
|
||||
expect(stockList, isNotNull);
|
||||
|
||||
await driver.tap(find.text('Demos'));
|
||||
|
||||
@@ -91,7 +91,7 @@ Future<Null> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
|
||||
// Verify that the durations data is valid.
|
||||
if (durations.keys.isEmpty)
|
||||
throw 'no "Start Transition" timeline events found';
|
||||
Map<String, int> unexpectedValueCounts = <String, int>{};
|
||||
final Map<String, int> unexpectedValueCounts = <String, int>{};
|
||||
durations.forEach((String routeName, List<int> values) {
|
||||
if (values.length != 2) {
|
||||
unexpectedValueCounts[routeName] = values.length;
|
||||
@@ -99,21 +99,21 @@ Future<Null> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
|
||||
});
|
||||
|
||||
if (unexpectedValueCounts.isNotEmpty) {
|
||||
StringBuffer error = new StringBuffer('Some routes recorded wrong number of values (expected 2 values/route):\n\n');
|
||||
final StringBuffer error = new StringBuffer('Some routes recorded wrong number of values (expected 2 values/route):\n\n');
|
||||
unexpectedValueCounts.forEach((String routeName, int count) {
|
||||
error.writeln(' - $routeName recorded $count values.');
|
||||
});
|
||||
error.writeln('\nFull event sequence:');
|
||||
Iterator<Map<String, dynamic>> eventIter = events.iterator;
|
||||
final Iterator<Map<String, dynamic>> eventIter = events.iterator;
|
||||
String lastEventName = '';
|
||||
String lastRouteName = '';
|
||||
while(eventIter.moveNext()) {
|
||||
String eventName = eventIter.current['name'];
|
||||
final String eventName = eventIter.current['name'];
|
||||
|
||||
if (!<String>['Start Transition', 'Frame'].contains(eventName))
|
||||
continue;
|
||||
|
||||
String routeName = eventName == 'Start Transition'
|
||||
final String routeName = eventName == 'Start Transition'
|
||||
? eventIter.current['args']['to']
|
||||
: '';
|
||||
|
||||
@@ -147,12 +147,12 @@ void main() {
|
||||
});
|
||||
|
||||
test('all demos', () async {
|
||||
Timeline timeline = await driver.traceAction(() async {
|
||||
final Timeline timeline = await driver.traceAction(() async {
|
||||
// Scroll each demo menu item into view, launch the demo and
|
||||
// return to the demo menu 2x.
|
||||
for(String demoTitle in demoTitles) {
|
||||
print('Testing "$demoTitle" demo');
|
||||
SerializableFinder menuItem = find.text(demoTitle);
|
||||
final SerializableFinder menuItem = find.text(demoTitle);
|
||||
await driver.scrollIntoView(menuItem, alignment: 0.5);
|
||||
await new Future<Null>.delayed(kWaitBetweenActions);
|
||||
|
||||
@@ -180,9 +180,9 @@ void main() {
|
||||
// Save the duration (in microseconds) of the first timeline Frame event
|
||||
// that follows a 'Start Transition' event. The Gallery app adds a
|
||||
// 'Start Transition' event when a demo is launched (see GalleryItem).
|
||||
TimelineSummary summary = new TimelineSummary.summarize(timeline);
|
||||
final TimelineSummary summary = new TimelineSummary.summarize(timeline);
|
||||
await summary.writeSummaryToFile('transitions', pretty: true);
|
||||
String histogramPath = path.join(testOutputsDirectory, 'transition_durations.timeline.json');
|
||||
final String histogramPath = path.join(testOutputsDirectory, 'transition_durations.timeline.json');
|
||||
await saveDurationsHistogram(timeline.json['traceEvents'], histogramPath);
|
||||
}, timeout: const Timeout(const Duration(minutes: 5)));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user