Unverified Commit 3749ff02 authored by Abhishek Ghaskata's avatar Abhishek Ghaskata Committed by GitHub

Migrate gallery test to null safety (#84065)

parent 13c02ffd
...@@ -2,14 +2,12 @@ ...@@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.9
import 'package:flutter_driver/flutter_driver.dart'; import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() { void main() {
group('scrolling performance test', () { group('scrolling performance test', () {
FlutterDriver driver; late FlutterDriver driver;
setUpAll(() async { setUpAll(() async {
driver = await FlutterDriver.connect(); driver = await FlutterDriver.connect();
...@@ -18,7 +16,6 @@ void main() { ...@@ -18,7 +16,6 @@ void main() {
}); });
tearDownAll(() async { tearDownAll(() async {
if (driver != null)
driver.close(); driver.close();
}); });
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.9
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_driver/driver_extension.dart'; import 'package:flutter_driver/driver_extension.dart';
import 'package:flutter_gallery/gallery/app.dart' show GalleryApp; import 'package:flutter_gallery/gallery/app.dart' show GalleryApp;
......
...@@ -2,21 +2,18 @@ ...@@ -2,21 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.9
import 'package:flutter_driver/flutter_driver.dart'; import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() { void main() {
group('scrolling performance test', () { group('scrolling performance test', () {
FlutterDriver driver; late FlutterDriver driver;
setUpAll(() async { setUpAll(() async {
driver = await FlutterDriver.connect(); driver = await FlutterDriver.connect();
}); });
tearDownAll(() async { tearDownAll(() async {
if (driver != null)
driver.close(); driver.close();
}); });
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.9
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_gallery/demo_lists.dart'; import 'package:flutter_gallery/demo_lists.dart';
......
...@@ -2,15 +2,13 @@ ...@@ -2,15 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.9
import 'package:integration_test/integration_test_driver.dart' as driver; import 'package:integration_test/integration_test_driver.dart' as driver;
Future<void> main() => driver.integrationDriver( Future<void> main() => driver.integrationDriver(
timeout: const Duration(minutes: 5), timeout: const Duration(minutes: 5),
responseDataCallback: (Map<String, dynamic> data) async { responseDataCallback: (Map<String, dynamic>? data) async {
await driver.writeResponseData( await driver.writeResponseData(
data['performance'] as Map<String, dynamic>, data!['performance'] as Map<String, dynamic>,
testOutputFilename: 'e2e_perf_summary', testOutputFilename: 'e2e_perf_summary',
); );
} }
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.9
import 'transitions_perf_e2e.dart' as transitions_perf; import 'transitions_perf_e2e.dart' as transitions_perf;
void main() { void main() {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.9
import 'transitions_perf_test.dart' as transitions_perf_test; import 'transitions_perf_test.dart' as transitions_perf_test;
void main([List<String> args = const <String>[]]) => transitions_perf_test.main( void main([List<String> args = const <String>[]]) => transitions_perf_test.main(
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.9
import 'dart:convert' show JsonEncoder, json; import 'dart:convert' show JsonEncoder, json;
import 'package:file/file.dart'; import 'package:file/file.dart';
...@@ -27,8 +25,8 @@ List<String> _allDemos = <String>[]; ...@@ -27,8 +25,8 @@ List<String> _allDemos = <String>[];
/// it into a histogram, and saves to a JSON file. /// it into a histogram, and saves to a JSON file.
Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String outputPath) async { Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String outputPath) async {
final Map<String, List<int>> durations = <String, List<int>>{}; final Map<String, List<int>> durations = <String, List<int>>{};
Map<String, dynamic> startEvent; Map<String, dynamic>? startEvent;
int frameStart; int? frameStart;
// Save the duration of the first frame after each 'Start Transition' event. // Save the duration of the first frame after each 'Start Transition' event.
for (final Map<String, dynamic> event in events) { for (final Map<String, dynamic> event in events) {
...@@ -46,7 +44,7 @@ Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou ...@@ -46,7 +44,7 @@ Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
assert(phase == 'E'); assert(phase == 'E');
final String routeName = startEvent['args']['to'] as String; final String routeName = startEvent['args']['to'] as String;
durations[routeName] ??= <int>[]; durations[routeName] ??= <int>[];
durations[routeName].add(timestamp - frameStart); durations[routeName]!.add(timestamp - frameStart!);
startEvent = null; startEvent = null;
frameStart = null; frameStart = null;
} }
...@@ -105,7 +103,7 @@ Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou ...@@ -105,7 +103,7 @@ Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
/// home screen twice. /// home screen twice.
Future<void> runDemos(List<String> demos, FlutterDriver driver) async { Future<void> runDemos(List<String> demos, FlutterDriver driver) async {
final SerializableFinder demoList = find.byValueKey('GalleryDemoList'); final SerializableFinder demoList = find.byValueKey('GalleryDemoList');
String currentDemoCategory; String? currentDemoCategory;
for (final String demo in demos) { for (final String demo in demos) {
if (kSkippedDemos.contains(demo)) if (kSkippedDemos.contains(demo))
...@@ -158,7 +156,7 @@ void main([List<String> args = const <String>[]]) { ...@@ -158,7 +156,7 @@ void main([List<String> args = const <String>[]]) {
final bool withSemantics = args.contains('--with_semantics'); final bool withSemantics = args.contains('--with_semantics');
final bool hybrid = args.contains('--hybrid'); final bool hybrid = args.contains('--hybrid');
group('flutter gallery transitions', () { group('flutter gallery transitions', () {
FlutterDriver driver; late FlutterDriver driver;
setUpAll(() async { setUpAll(() async {
driver = await FlutterDriver.connect(); driver = await FlutterDriver.connect();
...@@ -176,7 +174,6 @@ void main([List<String> args = const <String>[]]) { ...@@ -176,7 +174,6 @@ void main([List<String> args = const <String>[]]) {
}); });
tearDownAll(() async { tearDownAll(() async {
if (driver != null)
await driver.close(); await driver.close();
}); });
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.9
import 'transitions_perf_test.dart' as transitions_perf_test; import 'transitions_perf_test.dart' as transitions_perf_test;
void main() { void main() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment