Auto-format Framework (#160545)

This auto-formats all *.dart files in the repository outside of the
`engine` subdirectory and enforces that these files stay formatted with
a presubmit check.

**Reviewers:** Please carefully review all the commits except for the
one titled "formatted". The "formatted" commit was auto-generated by
running `dev/tools/format.sh -a -f`. The other commits were hand-crafted
to prepare the repo for the formatting change. I recommend reviewing the
commits one-by-one via the "Commits" tab and avoiding Github's "Files
changed" tab as it will likely slow down your browser because of the
size of this PR.

---------

Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
This commit is contained in:
Michael Goderbauer
2024-12-19 12:06:21 -08:00
committed by GitHub
parent 8e0993eda8
commit 5491c8c146
4411 changed files with 455108 additions and 415991 deletions

View File

@@ -15,20 +15,24 @@ 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 {
if (request != 'waitForAnimation') {
throw UnsupportedError('Unrecognized request $request');
}
await waiter.future;
return 'done';
});
runApp(MaterialApp(
home: AnimatedImagePage(
onFrame: (int frameNumber) {
if (frameNumber == 250) {
waiter.complete();
}
},
enableFlutterDriverExtension(
handler: (String? request) async {
if (request != 'waitForAnimation') {
throw UnsupportedError('Unrecognized request $request');
}
await waiter.future;
return 'done';
},
);
runApp(
MaterialApp(
home: AnimatedImagePage(
onFrame: (int frameNumber) {
if (frameNumber == 250) {
waiter.complete();
}
},
),
),
));
);
}

View File

@@ -12,7 +12,6 @@ Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
await driver.forceGC();
final Timeline timeline = await driver.traceAction(() async {
await driver.requestData('waitForAnimation');
});

View File

@@ -10,5 +10,5 @@ Future<void> main() => driver.integrationDriver(
data?['performance'] as Map<String, dynamic>,
testOutputFilename: 'e2e_perf_summary',
);
}
},
);

View File

@@ -8,24 +8,21 @@ import 'package:integration_test/integration_test_driver.dart' as driver;
Future<void> main() => driver.integrationDriver(
responseDataCallback: (Map<String, dynamic>? data) async {
final Map<String, dynamic> benchmarkLiveResult =
data?['benchmarkLive'] as Map<String,dynamic>;
final Map<String, dynamic> fullyLiveResult =
data?['fullyLive'] as Map<String,dynamic>;
final Map<String, dynamic> benchmarkLiveResult = data?['benchmarkLive'] as Map<String, dynamic>;
final Map<String, dynamic> fullyLiveResult = data?['fullyLive'] as Map<String, dynamic>;
if (benchmarkLiveResult['frame_count'] as int < 10
|| fullyLiveResult['frame_count'] as int < 10) {
print('Failure Details:\nNot Enough frames collected: '
'benchmarkLive ${benchmarkLiveResult['frameCount']}, '
'${fullyLiveResult['frameCount']}.');
if (benchmarkLiveResult['frame_count'] as int < 10 ||
fullyLiveResult['frame_count'] as int < 10) {
print(
'Failure Details:\nNot Enough frames collected: '
'benchmarkLive ${benchmarkLiveResult['frameCount']}, '
'${fullyLiveResult['frameCount']}.',
);
exit(1);
}
await driver.writeResponseData(
<String, dynamic>{
'benchmarkLive': benchmarkLiveResult,
'fullyLive': fullyLiveResult,
},
testOutputFilename: 'frame_policy_event_delay',
);
}
await driver.writeResponseData(<String, dynamic>{
'benchmarkLive': benchmarkLiveResult,
'fullyLive': fullyLiveResult,
}, testOutputFilename: 'frame_policy_event_delay');
},
);

View File

@@ -11,11 +11,13 @@ import 'package:macrobenchmarks/common.dart';
import 'package:macrobenchmarks/main.dart';
Future<void> main() async {
enableFlutterDriverExtension(handler: (String? message) async {
if (message == 'getTargetPlatform') {
return defaultTargetPlatform.toString();
}
throw UnsupportedError('Message $message unsupported');
});
enableFlutterDriverExtension(
handler: (String? message) async {
if (message == 'getTargetPlatform') {
return defaultTargetPlatform.toString();
}
throw UnsupportedError('Message $message unsupported');
},
);
runApp(const MacrobenchmarksApp(initialRoute: kLargeImageChangerRouteName));
}

View File

@@ -14,8 +14,7 @@ void main() {
pageDelay: const Duration(seconds: 1),
duration: const Duration(seconds: 10),
setupOps: (FlutterDriver driver) async {
final SerializableFinder animateButton =
find.byValueKey('animate_button');
final SerializableFinder animateButton = find.byValueKey('animate_button');
await driver.tap(animateButton);
await Future<void>.delayed(const Duration(seconds: 1));
},

View File

@@ -15,8 +15,7 @@ void main() {
driverOps: (FlutterDriver driver) async {
final SerializableFinder listView = find.byValueKey('list_view');
Future<void> scrollOnce(double offset) async {
await driver.scroll(
listView, 0.0, offset, const Duration(milliseconds: 450));
await driver.scroll(listView, 0.0, offset, const Duration(milliseconds: 450));
await Future<void>.delayed(const Duration(milliseconds: 500));
}

View File

@@ -19,6 +19,7 @@ void main() {
await driver.scroll(tabBarView, offset, 0.0, const Duration(milliseconds: 300));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
// When we eventually add more test panes we will want to tweak these
// to go through all the panes
for (int i = 0; i < 6; i += 1) {

View File

@@ -19,6 +19,7 @@ void main() {
await driver.scroll(tabBarView, offset, 0.0, const Duration(milliseconds: 300));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
for (int i = 0; i < 3; i += 1) {
await scrollOnce(-300.0);
await scrollOnce(-300.0);