Migrate dev/benchmarks/macrobenchmarks to null safety. (#85501)
This commit is contained in:
@@ -15,7 +15,7 @@ import 'package:macrobenchmarks/src/animated_image.dart';
|
||||
/// set number of image frames to render.
|
||||
Future<void> main() async {
|
||||
final Completer<void> waiter = Completer<void>();
|
||||
enableFlutterDriverExtension(handler: (String request) async {
|
||||
enableFlutterDriverExtension(handler: (String? request) async {
|
||||
if (request != 'waitForAnimation') {
|
||||
throw UnsupportedError('Unrecognized request $request');
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
import 'package:integration_test/integration_test_driver.dart' as driver;
|
||||
|
||||
Future<void> main() => driver.integrationDriver(
|
||||
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',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ import 'dart:io';
|
||||
import 'package:integration_test/integration_test_driver.dart' as driver;
|
||||
|
||||
Future<void> main() => driver.integrationDriver(
|
||||
responseDataCallback: (Map<String, dynamic> data) async {
|
||||
responseDataCallback: (Map<String, dynamic>? data) async {
|
||||
final Map<String, dynamic> benchmarkLiveResult =
|
||||
data['benchmarkLive'] as Map<String,dynamic>;
|
||||
data?['benchmarkLive'] as Map<String,dynamic>;
|
||||
final Map<String, dynamic> fullyLiveResult =
|
||||
data['fullyLive'] as Map<String,dynamic>;
|
||||
data?['fullyLive'] as Map<String,dynamic>;
|
||||
|
||||
if(benchmarkLiveResult['frame_count'] as int < 10
|
||||
|| fullyLiveResult['frame_count'] as int < 10) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:macrobenchmarks/common.dart';
|
||||
import 'package:macrobenchmarks/main.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
enableFlutterDriverExtension(handler: (String message) async {
|
||||
enableFlutterDriverExtension(handler: (String? message) async {
|
||||
if (message == 'getTargetPlatform') {
|
||||
return defaultTargetPlatform.toString();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ Future<void> main() async {
|
||||
|
||||
final String targetPlatform = await driver.requestData('getTargetPlatform');
|
||||
|
||||
Timeline timeline;
|
||||
Timeline? timeline;
|
||||
switch (targetPlatform) {
|
||||
case 'TargetPlatform.iOS':
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ const JsonEncoder _prettyEncoder = JsonEncoder.withIndent(' ');
|
||||
|
||||
void main() {
|
||||
test('stack_size', () async {
|
||||
int stackSizeInBytes;
|
||||
late int stackSizeInBytes;
|
||||
await runDriverTestForRoute(kStackSizeRouteName, (FlutterDriver driver) async {
|
||||
final String stackSize = await driver.getText(find.byValueKey(kStackSizeKey));
|
||||
expect(stackSize.isNotEmpty, isTrue);
|
||||
|
||||
@@ -34,13 +34,13 @@ Future<void> runDriverTestForRoute(String routeName, DriverTestCallBack body) as
|
||||
void macroPerfTest(
|
||||
String testName,
|
||||
String routeName, {
|
||||
Duration pageDelay,
|
||||
Duration? pageDelay,
|
||||
Duration duration = const Duration(seconds: 3),
|
||||
Future<void> Function(FlutterDriver driver) driverOps,
|
||||
Future<void> Function(FlutterDriver driver) setupOps,
|
||||
Future<void> Function(FlutterDriver driver)? driverOps,
|
||||
Future<void> Function(FlutterDriver driver)? setupOps,
|
||||
}) {
|
||||
test(testName, () async {
|
||||
Timeline timeline;
|
||||
late Timeline timeline;
|
||||
await runDriverTestForRoute(routeName, (FlutterDriver driver) async {
|
||||
if (pageDelay != null) {
|
||||
// Wait for the page to load
|
||||
@@ -48,7 +48,7 @@ void macroPerfTest(
|
||||
}
|
||||
|
||||
if (setupOps != null) {
|
||||
await setupOps(driver);
|
||||
await setupOps(driver);
|
||||
}
|
||||
|
||||
timeline = await driver.traceAction(() async {
|
||||
|
||||
Reference in New Issue
Block a user