Migrate gallery test to null safety (#84065)

This commit is contained in:
Abhishek Ghaskata
2021-06-07 23:59:04 +05:30
committed by GitHub
parent 13c02ffd00
commit 3749ff02e1
9 changed files with 9 additions and 27 deletions

View File

@@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('scrolling performance test', () {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
@@ -18,7 +16,6 @@ void main() {
});
tearDownAll(() async {
if (driver != null)
driver.close();
});

View File

@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'package:flutter/material.dart';
import 'package:flutter_driver/driver_extension.dart';
import 'package:flutter_gallery/gallery/app.dart' show GalleryApp;

View File

@@ -2,21 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('scrolling performance test', () {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
if (driver != null)
driver.close();
});

View File

@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gallery/demo_lists.dart';

View File

@@ -2,15 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'package:integration_test/integration_test_driver.dart' as driver;
Future<void> main() => driver.integrationDriver(
timeout: const Duration(minutes: 5),
responseDataCallback: (Map<String, dynamic> data) async {
responseDataCallback: (Map<String, dynamic>? data) async {
await driver.writeResponseData(
data['performance'] as Map<String, dynamic>,
data!['performance'] as Map<String, dynamic>,
testOutputFilename: 'e2e_perf_summary',
);
}

View File

@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'transitions_perf_e2e.dart' as transitions_perf;
void main() {

View File

@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'transitions_perf_test.dart' as transitions_perf_test;
void main([List<String> args = const <String>[]]) => transitions_perf_test.main(

View File

@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'dart:convert' show JsonEncoder, json;
import 'package:file/file.dart';
@@ -27,8 +25,8 @@ List<String> _allDemos = <String>[];
/// it into a histogram, and saves to a JSON file.
Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String outputPath) async {
final Map<String, List<int>> durations = <String, List<int>>{};
Map<String, dynamic> startEvent;
int frameStart;
Map<String, dynamic>? startEvent;
int? frameStart;
// Save the duration of the first frame after each 'Start Transition' event.
for (final Map<String, dynamic> event in events) {
@@ -46,7 +44,7 @@ Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
assert(phase == 'E');
final String routeName = startEvent['args']['to'] as String;
durations[routeName] ??= <int>[];
durations[routeName].add(timestamp - frameStart);
durations[routeName]!.add(timestamp - frameStart!);
startEvent = null;
frameStart = null;
}
@@ -105,7 +103,7 @@ Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
/// home screen twice.
Future<void> runDemos(List<String> demos, FlutterDriver driver) async {
final SerializableFinder demoList = find.byValueKey('GalleryDemoList');
String currentDemoCategory;
String? currentDemoCategory;
for (final String demo in demos) {
if (kSkippedDemos.contains(demo))
@@ -158,7 +156,7 @@ void main([List<String> args = const <String>[]]) {
final bool withSemantics = args.contains('--with_semantics');
final bool hybrid = args.contains('--hybrid');
group('flutter gallery transitions', () {
FlutterDriver driver;
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
@@ -176,7 +174,6 @@ void main([List<String> args = const <String>[]]) {
});
tearDownAll(() async {
if (driver != null)
await driver.close();
});

View File

@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'transitions_perf_test.dart' as transitions_perf_test;
void main() {