forked from firka/flutter
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:
committed by
GitHub
parent
8e0993eda8
commit
5491c8c146
@@ -18,10 +18,7 @@ void main() {
|
||||
|
||||
setUp(() {
|
||||
caughtArgs = <String>[];
|
||||
processManager = FakeProcessManager((
|
||||
String exec,
|
||||
List<String> args,
|
||||
) async {
|
||||
processManager = FakeProcessManager((String exec, List<String> args) async {
|
||||
assert(caughtArgs.isEmpty, 'Should only catch one call to run');
|
||||
caughtArgs = args;
|
||||
return FakeProcessManager.ok();
|
||||
@@ -74,14 +71,14 @@ void main() {
|
||||
});
|
||||
|
||||
expect(
|
||||
Adb.create(
|
||||
processManager: processManager,
|
||||
Adb.create(processManager: processManager),
|
||||
throwsA(
|
||||
isA<StateError>().having(
|
||||
(StateError e) => e.message,
|
||||
'message',
|
||||
'No device connected: error',
|
||||
),
|
||||
),
|
||||
throwsA(isA<StateError>().having(
|
||||
(StateError e) => e.message,
|
||||
'message',
|
||||
'No device connected: error',
|
||||
)),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -100,9 +97,7 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
final Adb adb = await Adb.create(
|
||||
processManager: processManager,
|
||||
);
|
||||
final Adb adb = await Adb.create(processManager: processManager);
|
||||
|
||||
final Uint8List result = await adb.screencap();
|
||||
expect(result, <int>[0, 1, 2, 3]);
|
||||
@@ -123,9 +118,7 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
final Adb adb = await Adb.create(
|
||||
processManager: processManager,
|
||||
);
|
||||
final Adb adb = await Adb.create(processManager: processManager);
|
||||
|
||||
await adb.tap(1, 2);
|
||||
});
|
||||
|
||||
@@ -13,9 +13,7 @@ import 'src/fake_driver.dart';
|
||||
|
||||
void main() async {
|
||||
test('screenshot calls ADB screencap', () async {
|
||||
final FakeAdb adb = FakeAdb(
|
||||
screencap: () async => Uint8List.fromList(<int>[1, 2, 3, 4]),
|
||||
);
|
||||
final FakeAdb adb = FakeAdb(screencap: () async => Uint8List.fromList(<int>[1, 2, 3, 4]));
|
||||
final io.Directory tmpDir = io.Directory.systemTemp.createTempSync();
|
||||
final AndroidNativeDriver driver = AndroidNativeDriver.forTesting(
|
||||
adb: adb,
|
||||
|
||||
@@ -19,14 +19,14 @@ final class FakeAdb implements Adb {
|
||||
Future<void> Function()? sendToHome,
|
||||
Future<void> Function(String appName, [String? activityName])? resumeApp,
|
||||
Future<void> Function(String appName)? trimMemory,
|
||||
}) : _isDeviceConnected = isDeviceConnected,
|
||||
_screencap = screencap,
|
||||
_tap = tap,
|
||||
_disableImmersiveModeConfirmations = disableImmersiveModeConfirmations,
|
||||
_disableAnimations = disableAnimations,
|
||||
_sendToHome = sendToHome,
|
||||
_resumeApp = resumeApp,
|
||||
_trimMemory = trimMemory;
|
||||
}) : _isDeviceConnected = isDeviceConnected,
|
||||
_screencap = screencap,
|
||||
_tap = tap,
|
||||
_disableImmersiveModeConfirmations = disableImmersiveModeConfirmations,
|
||||
_disableAnimations = disableAnimations,
|
||||
_sendToHome = sendToHome,
|
||||
_resumeApp = resumeApp,
|
||||
_trimMemory = trimMemory;
|
||||
|
||||
@override
|
||||
Future<(bool, String?)> isDeviceConnected() async {
|
||||
@@ -75,10 +75,7 @@ final class FakeAdb implements Adb {
|
||||
return _resumeApp?.call(appName, activityName) ?? Future<void>.value();
|
||||
}
|
||||
|
||||
final Future<void> Function(
|
||||
String appName, [
|
||||
String? activityName,
|
||||
])? _resumeApp;
|
||||
final Future<void> Function(String appName, [String? activityName])? _resumeApp;
|
||||
|
||||
@override
|
||||
Future<void> trimMemory({required String appName}) {
|
||||
|
||||
@@ -13,10 +13,7 @@ import 'package:process/process.dart';
|
||||
final class FakeProcessManager extends ProcessManager {
|
||||
/// Creates a new [FakeProcessManager] with the given delegate callback.
|
||||
FakeProcessManager(this._runDelegate);
|
||||
final Future<ProcessResult> Function(
|
||||
String executable,
|
||||
List<String> arguments,
|
||||
) _runDelegate;
|
||||
final Future<ProcessResult> Function(String executable, List<String> arguments) _runDelegate;
|
||||
|
||||
@override
|
||||
Never noSuchMethod(_) => throw UnimplementedError();
|
||||
|
||||
Reference in New Issue
Block a user