Unverified Commit 46ea9912 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Revert "Extra defensive programming for pub modification time assert (#42491)" (#43235)

This reverts commit 3597bae6.
parent 3597bae6
...@@ -158,8 +158,6 @@ class _DefaultPub implements Pub { ...@@ -158,8 +158,6 @@ class _DefaultPub implements Pub {
return; return;
} }
final DateTime originalPubspecYamlModificationTime = pubSpecYaml.lastModifiedSync();
if (!checkLastModified || _shouldRunPubGet(pubSpecYaml: pubSpecYaml, dotPackages: dotPackages)) { if (!checkLastModified || _shouldRunPubGet(pubSpecYaml: pubSpecYaml, dotPackages: dotPackages)) {
final String command = upgrade ? 'upgrade' : 'get'; final String command = upgrade ? 'upgrade' : 'get';
final Status status = logger.startProgress( final Status status = logger.startProgress(
...@@ -191,34 +189,11 @@ class _DefaultPub implements Pub { ...@@ -191,34 +189,11 @@ class _DefaultPub implements Pub {
if (!dotPackages.existsSync()) { if (!dotPackages.existsSync()) {
throwToolExit('$directory: pub did not create .packages file.'); throwToolExit('$directory: pub did not create .packages file.');
} }
if (pubSpecYaml.lastModifiedSync() != originalPubspecYamlModificationTime) {
throwToolExit('$directory: unexpected concurrent modification of pubspec.yaml while running pub.'); if (dotPackages.lastModifiedSync().isBefore(pubSpecYaml.lastModifiedSync())) {
} throwToolExit('$directory: pub did not update .packages file '
// We don't check if dotPackages was actually modified, because as far as we can tell sometimes '(pubspec.yaml timestamp: ${pubSpecYaml.lastModifiedSync()}; '
// pub will decide it does not need to actually modify it. '.packages timestamp: ${dotPackages.lastModifiedSync()}).');
// Since we rely on the file having a more recent timestamp, though, we do manually force the
// file to be more recently modified.
final DateTime now = DateTime.now();
if (now.isBefore(originalPubspecYamlModificationTime)) {
printError(
'Warning: File "${fs.path.absolute(pubSpecYaml.path)}" was created in the future. '
'Optimizations that rely on comparing time stamps will be unreliable. Check your '
'system clock for accuracy.\n'
'The timestamp was: $originalPubspecYamlModificationTime\n'
'The time now is: $now'
);
} else {
dotPackages.setLastModifiedSync(now);
final DateTime newDotPackagesTimestamp = dotPackages.lastModifiedSync();
if (newDotPackagesTimestamp.isBefore(originalPubspecYamlModificationTime)) {
printError(
'Warning: Failed to set timestamp of "${fs.path.absolute(dotPackages.path)}". '
'Tried to set timestamp to $now, but new timestamp is $newDotPackagesTimestamp.'
);
if (newDotPackagesTimestamp.isAfter(now)) {
printError('Maybe the file was concurrently modified?');
}
}
} }
} }
......
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
inRepo(<String>[]); inRepo(<String>[]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
} }
...@@ -100,7 +100,7 @@ void main() { ...@@ -100,7 +100,7 @@ void main() {
await loggerSubscription.cancel(); await loggerSubscription.cancel();
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Logger: () => logger, Logger: () => logger,
}); });
...@@ -118,7 +118,7 @@ void main() { ...@@ -118,7 +118,7 @@ void main() {
throwsA(isA<ToolExit>())); throwsA(isA<ToolExit>()));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Logger: () => logger, Logger: () => logger,
}); });
...@@ -198,7 +198,7 @@ void main() { ...@@ -198,7 +198,7 @@ void main() {
expect(flutterDevice.fileSystemRoots, const <String>[filesystemRoot]); expect(flutterDevice.fileSystemRoots, const <String>[filesystemRoot]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('exits when ipv6 is specified and debug-port is not', () async { testUsingContext('exits when ipv6 is specified and debug-port is not', () async {
...@@ -222,7 +222,7 @@ void main() { ...@@ -222,7 +222,7 @@ void main() {
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
},); },);
testUsingContext('exits when observatory-port is specified and debug-port is not', () async { testUsingContext('exits when observatory-port is specified and debug-port is not', () async {
...@@ -246,7 +246,7 @@ void main() { ...@@ -246,7 +246,7 @@ void main() {
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
},); },);
}); });
...@@ -308,7 +308,7 @@ void main() { ...@@ -308,7 +308,7 @@ void main() {
)).called(1); )).called(1);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
group('forwarding to given port', () { group('forwarding to given port', () {
...@@ -351,7 +351,7 @@ void main() { ...@@ -351,7 +351,7 @@ void main() {
await loggerSubscription.cancel(); await loggerSubscription.cancel();
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Logger: () => logger, Logger: () => logger,
}); });
...@@ -375,7 +375,7 @@ void main() { ...@@ -375,7 +375,7 @@ void main() {
await loggerSubscription.cancel(); await loggerSubscription.cancel();
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Logger: () => logger, Logger: () => logger,
}); });
...@@ -406,7 +406,7 @@ void main() { ...@@ -406,7 +406,7 @@ void main() {
await loggerSubscription.cancel(); await loggerSubscription.cancel();
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Logger: () => logger, Logger: () => logger,
}); });
...@@ -438,7 +438,7 @@ void main() { ...@@ -438,7 +438,7 @@ void main() {
await loggerSubscription.cancel(); await loggerSubscription.cancel();
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Logger: () => logger, Logger: () => logger,
}); });
}); });
...@@ -452,7 +452,7 @@ void main() { ...@@ -452,7 +452,7 @@ void main() {
expect(testLogger.statusText, contains('No supported devices connected')); expect(testLogger.statusText, contains('No supported devices connected'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('exits when multiple devices connected', () async { testUsingContext('exits when multiple devices connected', () async {
...@@ -477,7 +477,7 @@ void main() { ...@@ -477,7 +477,7 @@ void main() {
expect(testLogger.statusText, contains('yy2')); expect(testLogger.statusText, contains('yy2'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
} }
......
...@@ -57,7 +57,7 @@ void main() { ...@@ -57,7 +57,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => linuxPlatform, Platform: () => linuxPlatform,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaArtifacts: () => fuchsiaArtifacts, FuchsiaArtifacts: () => fuchsiaArtifacts,
}); });
...@@ -75,7 +75,7 @@ void main() { ...@@ -75,7 +75,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => linuxPlatform, Platform: () => linuxPlatform,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaArtifacts: () => fuchsiaArtifacts, FuchsiaArtifacts: () => fuchsiaArtifacts,
}); });
...@@ -98,7 +98,7 @@ void main() { ...@@ -98,7 +98,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => windowsPlatform, Platform: () => windowsPlatform,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaArtifacts: () => fuchsiaArtifacts, FuchsiaArtifacts: () => fuchsiaArtifacts,
}); });
...@@ -121,7 +121,7 @@ void main() { ...@@ -121,7 +121,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => linuxPlatform, Platform: () => linuxPlatform,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaArtifacts: () => fuchsiaArtifactsNoCompiler, FuchsiaArtifacts: () => fuchsiaArtifactsNoCompiler,
}); });
}); });
...@@ -147,7 +147,7 @@ void main() { ...@@ -147,7 +147,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => linuxPlatform, Platform: () => linuxPlatform,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaSdk: () => fuchsiaSdk, FuchsiaSdk: () => fuchsiaSdk,
}); });
} }
......
...@@ -83,7 +83,7 @@ void main() { ...@@ -83,7 +83,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => linuxPlatform, Platform: () => linuxPlatform,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true), FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
}); });
...@@ -98,7 +98,7 @@ void main() { ...@@ -98,7 +98,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => notLinuxPlatform, Platform: () => notLinuxPlatform,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true), FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
}); });
...@@ -187,7 +187,7 @@ BINARY_NAME=fizz_bar ...@@ -187,7 +187,7 @@ BINARY_NAME=fizz_bar
expect(makefileExecutableName(flutterProject.linux), 'fizz_bar'); expect(makefileExecutableName(flutterProject.linux), 'fizz_bar');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true), FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
}); });
......
...@@ -120,7 +120,7 @@ void main() { ...@@ -120,7 +120,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => notMacosPlatform, Platform: () => notMacosPlatform,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
}); });
......
...@@ -67,7 +67,7 @@ void main() { ...@@ -67,7 +67,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => windowsPlatform, Platform: () => windowsPlatform,
FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows), FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
VisualStudio: () => mockVisualStudio, VisualStudio: () => mockVisualStudio,
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true), FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
}); });
...@@ -82,7 +82,7 @@ void main() { ...@@ -82,7 +82,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => windowsPlatform, Platform: () => windowsPlatform,
FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows), FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
VisualStudio: () => mockVisualStudio, VisualStudio: () => mockVisualStudio,
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true), FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
}); });
...@@ -102,7 +102,7 @@ void main() { ...@@ -102,7 +102,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => notWindowsPlatform, Platform: () => notWindowsPlatform,
FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows), FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
VisualStudio: () => mockVisualStudio, VisualStudio: () => mockVisualStudio,
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true), FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
}); });
......
...@@ -53,7 +53,7 @@ void main() { ...@@ -53,7 +53,7 @@ void main() {
verify(xcodeProjectInterpreter.cleanWorkspace(any, 'Runner')).called(2); verify(xcodeProjectInterpreter.cleanWorkspace(any, 'Runner')).called(2);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Xcode: () => mockXcode, Xcode: () => mockXcode,
XcodeProjectInterpreter: () => mockXcodeProjectInterpreter, XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
}); });
......
...@@ -84,7 +84,7 @@ void main() { ...@@ -84,7 +84,7 @@ void main() {
} }
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('returns 1 when app fails to run', () async { testUsingContext('returns 1 when app fails to run', () async {
...@@ -112,7 +112,7 @@ void main() { ...@@ -112,7 +112,7 @@ void main() {
} }
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('returns 1 when app file is outside package', () async { testUsingContext('returns 1 when app file is outside package', () async {
...@@ -135,7 +135,7 @@ void main() { ...@@ -135,7 +135,7 @@ void main() {
} }
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('returns 1 when app file is in the root dir', () async { testUsingContext('returns 1 when app file is in the root dir', () async {
...@@ -159,7 +159,7 @@ void main() { ...@@ -159,7 +159,7 @@ void main() {
} }
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('returns 0 when test ends successfully', () async { testUsingContext('returns 0 when test ends successfully', () async {
...@@ -192,7 +192,7 @@ void main() { ...@@ -192,7 +192,7 @@ void main() {
expect(testLogger.errorText, isEmpty); expect(testLogger.errorText, isEmpty);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('returns exitCode set by test runner', () async { testUsingContext('returns exitCode set by test runner', () async {
...@@ -229,7 +229,7 @@ void main() { ...@@ -229,7 +229,7 @@ void main() {
} }
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
group('findTargetDevice', () { group('findTargetDevice', () {
...@@ -244,7 +244,7 @@ void main() { ...@@ -244,7 +244,7 @@ void main() {
expect(device.name, 'specified-device'); expect(device.name, 'specified-device');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
...@@ -255,7 +255,7 @@ void main() { ...@@ -255,7 +255,7 @@ void main() {
expect(await findTargetDevice(), isNull); expect(await findTargetDevice(), isNull);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: platform, Platform: platform,
}); });
...@@ -268,7 +268,7 @@ void main() { ...@@ -268,7 +268,7 @@ void main() {
expect(device.name, 'mock-android-device'); expect(device.name, 'mock-android-device');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: platform, Platform: platform,
}); });
...@@ -300,7 +300,7 @@ void main() { ...@@ -300,7 +300,7 @@ void main() {
expect(device.name, 'mock-android-device'); expect(device.name, 'mock-android-device');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: platform, Platform: platform,
}); });
} }
...@@ -328,7 +328,7 @@ void main() { ...@@ -328,7 +328,7 @@ void main() {
expect(device.name, 'mock-simulator'); expect(device.name, 'mock-simulator');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: macOsPlatform, Platform: macOsPlatform,
}); });
}); });
...@@ -400,7 +400,7 @@ void main() { ...@@ -400,7 +400,7 @@ void main() {
)); ));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('does not use pre-built app if --build arg provided', () async { testUsingContext('does not use pre-built app if --build arg provided', () async {
...@@ -428,7 +428,7 @@ void main() { ...@@ -428,7 +428,7 @@ void main() {
)); ));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('uses prebuilt app if --no-build arg provided', () async { testUsingContext('uses prebuilt app if --no-build arg provided', () async {
...@@ -456,7 +456,7 @@ void main() { ...@@ -456,7 +456,7 @@ void main() {
)); ));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
}); });
......
...@@ -52,7 +52,7 @@ void main() { ...@@ -52,7 +52,7 @@ void main() {
expect(fs.file(outputFile).readAsStringSync(), contains('__flutter_completion')); expect(fs.file(outputFile).readAsStringSync(), contains('__flutter_completion'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Stdio: () => mockStdio, Stdio: () => mockStdio,
}); });
...@@ -73,7 +73,7 @@ void main() { ...@@ -73,7 +73,7 @@ void main() {
expect(fs.file(outputFile).readAsStringSync(), isEmpty); expect(fs.file(outputFile).readAsStringSync(), isEmpty);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Stdio: () => mockStdio, Stdio: () => mockStdio,
}); });
...@@ -88,7 +88,7 @@ void main() { ...@@ -88,7 +88,7 @@ void main() {
expect(fs.file(outputFile).readAsStringSync(), contains('__flutter_completion')); expect(fs.file(outputFile).readAsStringSync(), contains('__flutter_completion'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Stdio: () => mockStdio, Stdio: () => mockStdio,
}); });
}); });
......
...@@ -111,7 +111,7 @@ void main() { ...@@ -111,7 +111,7 @@ void main() {
]), throwsA(isInstanceOf<ToolExit>())); ]), throwsA(isInstanceOf<ToolExit>()));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false), FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false),
}); });
...@@ -129,7 +129,7 @@ void main() { ...@@ -129,7 +129,7 @@ void main() {
]), throwsA(isInstanceOf<ToolExit>())); ]), throwsA(isInstanceOf<ToolExit>()));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false),
}); });
...@@ -147,7 +147,7 @@ void main() { ...@@ -147,7 +147,7 @@ void main() {
]), throwsA(isInstanceOf<ToolExit>())); ]), throwsA(isInstanceOf<ToolExit>()));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false),
}); });
...@@ -165,7 +165,7 @@ void main() { ...@@ -165,7 +165,7 @@ void main() {
]); ]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true), FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
}); });
...@@ -183,7 +183,7 @@ void main() { ...@@ -183,7 +183,7 @@ void main() {
]); ]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true), FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
}); });
...@@ -201,7 +201,7 @@ void main() { ...@@ -201,7 +201,7 @@ void main() {
]); ]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
}); });
...@@ -230,9 +230,9 @@ void main() { ...@@ -230,9 +230,9 @@ void main() {
'--track-widget-creation' '--track-widget-creation'
]); ]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
BuildSystem: () => MockBuildSystem(),
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), BuildSystem: () => MockBuildSystem(),
ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
} }
......
...@@ -108,7 +108,7 @@ void main() { ...@@ -108,7 +108,7 @@ void main() {
'FLUTTER_ANALYTICS_LOG_FILE': 'test', 'FLUTTER_ANALYTICS_LOG_FILE': 'test',
}), }),
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('Usage records multiple features in experiment setting', () async { testUsingContext('Usage records multiple features in experiment setting', () async {
...@@ -130,7 +130,7 @@ void main() { ...@@ -130,7 +130,7 @@ void main() {
'FLUTTER_ANALYTICS_LOG_FILE': 'test', 'FLUTTER_ANALYTICS_LOG_FILE': 'test',
}), }),
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
...@@ -223,7 +223,7 @@ void main() { ...@@ -223,7 +223,7 @@ void main() {
expect(log.contains(formatDateTime(dateTime)), isTrue); expect(log.contains(formatDateTime(dateTime)), isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
SystemClock: () => mockClock, SystemClock: () => mockClock,
Platform: () => FakePlatform( Platform: () => FakePlatform(
environment: <String, String>{ environment: <String, String>{
...@@ -249,7 +249,7 @@ void main() { ...@@ -249,7 +249,7 @@ void main() {
expect(log.contains(formatDateTime(dateTime)), isTrue); expect(log.contains(formatDateTime(dateTime)), isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
SystemClock: () => mockClock, SystemClock: () => mockClock,
Platform: () => FakePlatform( Platform: () => FakePlatform(
environment: <String, String>{ environment: <String, String>{
......
...@@ -398,7 +398,7 @@ flutter: ...@@ -398,7 +398,7 @@ flutter:
expect(AndroidDevice('test').isSupportedForProject(flutterProject), true); expect(AndroidDevice('test').isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('isSupportedForProject is true with editable host app', () async { testUsingContext('isSupportedForProject is true with editable host app', () async {
...@@ -410,7 +410,7 @@ flutter: ...@@ -410,7 +410,7 @@ flutter:
expect(AndroidDevice('test').isSupportedForProject(flutterProject), true); expect(AndroidDevice('test').isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('isSupportedForProject is false with no host app and no module', () async { testUsingContext('isSupportedForProject is false with no host app and no module', () async {
...@@ -421,7 +421,7 @@ flutter: ...@@ -421,7 +421,7 @@ flutter:
expect(AndroidDevice('test').isSupportedForProject(flutterProject), false); expect(AndroidDevice('test').isSupportedForProject(flutterProject), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
group('emulatorId', () { group('emulatorId', () {
......
...@@ -45,7 +45,7 @@ void main() { ...@@ -45,7 +45,7 @@ void main() {
expect(sdk.latestVersion.sdkLevel, 23); expect(sdk.latestVersion.sdkLevel, 23);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('parse sdk N', () { testUsingContext('parse sdk N', () {
...@@ -57,7 +57,7 @@ void main() { ...@@ -57,7 +57,7 @@ void main() {
expect(sdk.latestVersion.sdkLevel, 24); expect(sdk.latestVersion.sdkLevel, 24);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('returns sdkmanager path', () { testUsingContext('returns sdkmanager path', () {
...@@ -68,7 +68,7 @@ void main() { ...@@ -68,7 +68,7 @@ void main() {
expect(sdk.sdkManagerPath, fs.path.join(sdk.directory, 'tools', 'bin', 'sdkmanager')); expect(sdk.sdkManagerPath, fs.path.join(sdk.directory, 'tools', 'bin', 'sdkmanager'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('returns sdkmanager version', () { testUsingContext('returns sdkmanager version', () {
...@@ -161,7 +161,7 @@ void main() { ...@@ -161,7 +161,7 @@ void main() {
expect(sdk.ndk.compilerArgs, <String>['--sysroot', realNdkSysroot]); expect(sdk.ndk.compilerArgs, <String>['--sysroot', realNdkSysroot]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => FakePlatform(operatingSystem: os), Platform: () => FakePlatform(operatingSystem: os),
}); });
...@@ -196,7 +196,7 @@ void main() { ...@@ -196,7 +196,7 @@ void main() {
expect(sdk.ndk.compilerArgs, <String>['--sysroot', realNdkSysroot, '-fuse-ld=$realNdkLinker']); expect(sdk.ndk.compilerArgs, <String>['--sysroot', realNdkSysroot, '-fuse-ld=$realNdkLinker']);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => FakePlatform(operatingSystem: os), Platform: () => FakePlatform(operatingSystem: os),
}); });
}); });
...@@ -214,7 +214,7 @@ void main() { ...@@ -214,7 +214,7 @@ void main() {
expect(explanation, contains('Can not locate ndk-bundle')); expect(explanation, contains('Can not locate ndk-bundle'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => FakePlatform(operatingSystem: os), Platform: () => FakePlatform(operatingSystem: os),
}); });
} }
......
...@@ -66,7 +66,7 @@ void main() { ...@@ -66,7 +66,7 @@ void main() {
equals('/home/me/.AndroidStudioWithCheese5.0/config/plugins')); equals('/home/me/.AndroidStudioWithCheese5.0/config/plugins'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
// Custom home paths are not supported on macOS nor Windows yet, // Custom home paths are not supported on macOS nor Windows yet,
// so we force the platform to fake Linux here. // so we force the platform to fake Linux here.
Platform: () => linuxPlatform(), Platform: () => linuxPlatform(),
...@@ -86,7 +86,7 @@ void main() { ...@@ -86,7 +86,7 @@ void main() {
equals(fs.path.join(homeMac, 'Library', 'Application Support', 'AndroidStudio3.3'))); equals(fs.path.join(homeMac, 'Library', 'Application Support', 'AndroidStudio3.3')));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
// Custom home paths are not supported on macOS nor Windows yet, // Custom home paths are not supported on macOS nor Windows yet,
// so we force the platform to fake Linux here. // so we force the platform to fake Linux here.
Platform: () => macPlatform(), Platform: () => macPlatform(),
...@@ -116,7 +116,7 @@ void main() { ...@@ -116,7 +116,7 @@ void main() {
equals(fs.path.join(homeMac, 'Library', 'Application Support', 'AndroidStudio3.3'))); equals(fs.path.join(homeMac, 'Library', 'Application Support', 'AndroidStudio3.3')));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
// Custom home paths are not supported on macOS nor Windows yet, // Custom home paths are not supported on macOS nor Windows yet,
// so we force the platform to fake Linux here. // so we force the platform to fake Linux here.
Platform: () => macPlatform(), Platform: () => macPlatform(),
......
...@@ -211,7 +211,7 @@ void main() { ...@@ -211,7 +211,7 @@ void main() {
group('PrebuiltIOSApp', () { group('PrebuiltIOSApp', () {
final Map<Type, Generator> overrides = <Type, Generator>{ final Map<Type, Generator> overrides = <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
PlistParser: () => MockPlistUtils(), PlistParser: () => MockPlistUtils(),
Platform: _kNoColorTerminalPlatform, Platform: _kNoColorTerminalPlatform,
OperatingSystemUtils: () => MockOperatingSystemUtils(), OperatingSystemUtils: () => MockOperatingSystemUtils(),
...@@ -363,7 +363,7 @@ void main() { ...@@ -363,7 +363,7 @@ void main() {
group('FuchsiaApp', () { group('FuchsiaApp', () {
final Map<Type, Generator> overrides = <Type, Generator>{ final Map<Type, Generator> overrides = <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: _kNoColorTerminalPlatform, Platform: _kNoColorTerminalPlatform,
OperatingSystemUtils: () => MockOperatingSystemUtils(), OperatingSystemUtils: () => MockOperatingSystemUtils(),
}; };
......
...@@ -45,7 +45,7 @@ void main() { ...@@ -45,7 +45,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: () => Cache(rootOverride: tempDir), Cache: () => Cache(rootOverride: tempDir),
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => FakePlatform(operatingSystem: 'linux'), Platform: () => FakePlatform(operatingSystem: 'linux'),
}); });
...@@ -65,7 +65,7 @@ void main() { ...@@ -65,7 +65,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: () => Cache(rootOverride: tempDir), Cache: () => Cache(rootOverride: tempDir),
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => FakePlatform(operatingSystem: 'linux'), Platform: () => FakePlatform(operatingSystem: 'linux'),
}); });
}); });
...@@ -95,7 +95,7 @@ void main() { ...@@ -95,7 +95,7 @@ void main() {
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => FakePlatform(operatingSystem: 'linux'), Platform: () => FakePlatform(operatingSystem: 'linux'),
}); });
...@@ -114,7 +114,7 @@ void main() { ...@@ -114,7 +114,7 @@ void main() {
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => FakePlatform(operatingSystem: 'linux'), Platform: () => FakePlatform(operatingSystem: 'linux'),
}); });
...@@ -122,7 +122,7 @@ void main() { ...@@ -122,7 +122,7 @@ void main() {
expect(artifacts.getArtifactPath(Artifact.engineDartBinary), contains('.exe')); expect(artifacts.getArtifactPath(Artifact.engineDartBinary), contains('.exe'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => FakePlatform(operatingSystem: 'windows'), Platform: () => FakePlatform(operatingSystem: 'windows'),
}); });
...@@ -130,7 +130,7 @@ void main() { ...@@ -130,7 +130,7 @@ void main() {
expect(artifacts.getArtifactPath(Artifact.engineDartBinary), isNot(contains('.exe'))); expect(artifacts.getArtifactPath(Artifact.engineDartBinary), isNot(contains('.exe')));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => FakePlatform(operatingSystem: 'linux'), Platform: () => FakePlatform(operatingSystem: 'linux'),
}); });
}); });
......
...@@ -126,7 +126,7 @@ $fontsSection ...@@ -126,7 +126,7 @@ $fontsSection
expect(bundle.entries.containsKey('FontManifest.json'), isTrue); expect(bundle.entries.containsKey('FontManifest.json'), isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('App font uses font file from package', () async { testUsingContext('App font uses font file from package', () async {
...@@ -155,7 +155,7 @@ $fontsSection ...@@ -155,7 +155,7 @@ $fontsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('App font uses local font file and package font file', () async { testUsingContext('App font uses local font file and package font file', () async {
...@@ -188,7 +188,7 @@ $fontsSection ...@@ -188,7 +188,7 @@ $fontsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('App uses package font with own font file', () async { testUsingContext('App uses package font with own font file', () async {
...@@ -222,7 +222,7 @@ $fontsSection ...@@ -222,7 +222,7 @@ $fontsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('App uses package font with font file from another package', () async { testUsingContext('App uses package font with font file from another package', () async {
...@@ -257,7 +257,7 @@ $fontsSection ...@@ -257,7 +257,7 @@ $fontsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('App uses package font with properties and own font file', () async { testUsingContext('App uses package font with properties and own font file', () async {
...@@ -293,7 +293,7 @@ $fontsSection ...@@ -293,7 +293,7 @@ $fontsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('App uses local font and package font with own font file.', () async { testUsingContext('App uses local font and package font with own font file.', () async {
...@@ -333,7 +333,7 @@ $fontsSection ...@@ -333,7 +333,7 @@ $fontsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
} }
...@@ -135,7 +135,7 @@ $assetsSection ...@@ -135,7 +135,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('No assets are bundled when the package has an asset that is not listed', () async { testUsingContext('No assets are bundled when the package has an asset that is not listed', () async {
...@@ -163,7 +163,7 @@ $assetsSection ...@@ -163,7 +163,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('One asset is bundled when the package has and lists one asset its pubspec', () async { testUsingContext('One asset is bundled when the package has and lists one asset its pubspec', () async {
...@@ -191,7 +191,7 @@ $assetsSection ...@@ -191,7 +191,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext("One asset is bundled when the package has one asset, listed in the app's pubspec", () async { testUsingContext("One asset is bundled when the package has one asset, listed in the app's pubspec", () async {
...@@ -219,7 +219,7 @@ $assetsSection ...@@ -219,7 +219,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('One asset and its variant are bundled when the package has an asset and a variant, and lists the asset in its pubspec', () async { testUsingContext('One asset and its variant are bundled when the package has an asset and a variant, and lists the asset in its pubspec', () async {
...@@ -247,7 +247,7 @@ $assetsSection ...@@ -247,7 +247,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('One asset and its variant are bundled when the package has an asset and a variant, and the app lists the asset in its pubspec', () async { testUsingContext('One asset and its variant are bundled when the package has an asset and a variant, and the app lists the asset in its pubspec', () async {
...@@ -278,7 +278,7 @@ $assetsSection ...@@ -278,7 +278,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('Two assets are bundled when the package has and lists two assets in its pubspec', () async { testUsingContext('Two assets are bundled when the package has and lists two assets in its pubspec', () async {
...@@ -307,7 +307,7 @@ $assetsSection ...@@ -307,7 +307,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext("Two assets are bundled when the package has two assets, listed in the app's pubspec", () async { testUsingContext("Two assets are bundled when the package has two assets, listed in the app's pubspec", () async {
...@@ -343,7 +343,7 @@ $assetsSection ...@@ -343,7 +343,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('Two assets are bundled when two packages each have and list an asset their pubspec', () async { testUsingContext('Two assets are bundled when two packages each have and list an asset their pubspec', () async {
...@@ -383,7 +383,7 @@ $assetsSection ...@@ -383,7 +383,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext("Two assets are bundled when two packages each have an asset, listed in the app's pubspec", () async { testUsingContext("Two assets are bundled when two packages each have an asset, listed in the app's pubspec", () async {
...@@ -426,7 +426,7 @@ $assetsSection ...@@ -426,7 +426,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('One asset is bundled when the app depends on a package, listing in its pubspec an asset from another package', () async { testUsingContext('One asset is bundled when the app depends on a package, listing in its pubspec an asset from another package', () async {
...@@ -461,7 +461,7 @@ $assetsSection ...@@ -461,7 +461,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
...@@ -491,7 +491,7 @@ $assetsSection ...@@ -491,7 +491,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
group('AssetBundle assets from scanned paths', () { group('AssetBundle assets from scanned paths', () {
...@@ -523,7 +523,7 @@ $assetsSection ...@@ -523,7 +523,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('Two assets are bundled when listing one and scanning second directory', () async { testUsingContext('Two assets are bundled when listing one and scanning second directory', () async {
...@@ -554,7 +554,7 @@ $assetsSection ...@@ -554,7 +554,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('One asset is bundled with variant, scanning wrong directory', () async { testUsingContext('One asset is bundled with variant, scanning wrong directory', () async {
...@@ -580,7 +580,7 @@ $assetsSection ...@@ -580,7 +580,7 @@ $assetsSection
assert(bundle.entries['AssetManifest.json'] == null,'Invalid pubspec.yaml should not generate AssetManifest.json' ); assert(bundle.entries['AssetManifest.json'] == null,'Invalid pubspec.yaml should not generate AssetManifest.json' );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
...@@ -612,7 +612,7 @@ $assetsSection ...@@ -612,7 +612,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('No asset is bundled with variant, no assets or directories are listed', () async { testUsingContext('No asset is bundled with variant, no assets or directories are listed', () async {
...@@ -641,7 +641,7 @@ $assetsSection ...@@ -641,7 +641,7 @@ $assetsSection
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('Expect error generating manifest, wrong non-existing directory is listed', () async { testUsingContext('Expect error generating manifest, wrong non-existing directory is listed', () async {
...@@ -675,7 +675,7 @@ $assetsSection ...@@ -675,7 +675,7 @@ $assetsSection
} }
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
......
...@@ -38,7 +38,7 @@ void main() { ...@@ -38,7 +38,7 @@ void main() {
expect(ab.entries.length, greaterThan(0)); expect(ab.entries.length, greaterThan(0));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('empty pubspec', () async { testUsingContext('empty pubspec', () async {
...@@ -56,7 +56,7 @@ void main() { ...@@ -56,7 +56,7 @@ void main() {
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('wildcard directories are updated when filesystem changes', () async { testUsingContext('wildcard directories are updated when filesystem changes', () async {
...@@ -96,7 +96,7 @@ flutter: ...@@ -96,7 +96,7 @@ flutter:
expect(bundle.entries.length, 5); expect(bundle.entries.length, 5);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('handle removal of wildcard directories', () async { testUsingContext('handle removal of wildcard directories', () async {
...@@ -146,7 +146,7 @@ name: example''') ...@@ -146,7 +146,7 @@ name: example''')
expect(bundle.entries.length, 4); expect(bundle.entries.length, 4);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
// https://github.com/flutter/flutter/issues/42723 // https://github.com/flutter/flutter/issues/42723
...@@ -175,7 +175,7 @@ flutter: ...@@ -175,7 +175,7 @@ flutter:
expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false); expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
......
...@@ -92,7 +92,7 @@ flutter: ...@@ -92,7 +92,7 @@ flutter:
} }
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
} }
...@@ -254,7 +254,7 @@ void main() { ...@@ -254,7 +254,7 @@ void main() {
AndroidSdk: () => mockAndroidSdk, AndroidSdk: () => mockAndroidSdk,
Artifacts: () => mockArtifacts, Artifacts: () => mockArtifacts,
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
GenSnapshot: () => genSnapshot, GenSnapshot: () => genSnapshot,
Xcode: () => mockXcode, Xcode: () => mockXcode,
Logger: () => bufferLogger, Logger: () => bufferLogger,
......
...@@ -22,7 +22,7 @@ void main() { ...@@ -22,7 +22,7 @@ void main() {
expect(fs.isDirectorySync('foo/bar'), true); expect(fs.isDirectorySync('foo/bar'), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('throws tool exit on failure to create', () async { testUsingContext('throws tool exit on failure to create', () async {
...@@ -30,7 +30,7 @@ void main() { ...@@ -30,7 +30,7 @@ void main() {
expect(() => ensureDirectoryExists('foo/bar.flx'), throwsToolExit()); expect(() => ensureDirectoryExists('foo/bar.flx'), throwsToolExit());
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
...@@ -86,7 +86,7 @@ void main() { ...@@ -86,7 +86,7 @@ void main() {
expect(destination.childDirectory('nested').childFile('a.txt').existsSync(), isFalse); expect(destination.childDirectory('nested').childFile('a.txt').existsSync(), isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
......
...@@ -30,7 +30,7 @@ void main() { ...@@ -30,7 +30,7 @@ void main() {
final Map<Type, Generator> contextOverrides = <Type, Generator>{ final Map<Type, Generator> contextOverrides = <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}; };
testUsingContext('throws when depfile is malformed', () { testUsingContext('throws when depfile is malformed', () {
...@@ -293,7 +293,7 @@ void main() { ...@@ -293,7 +293,7 @@ void main() {
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('populates checksums for valid files', () { testUsingContext('populates checksums for valid files', () {
...@@ -307,7 +307,7 @@ void main() { ...@@ -307,7 +307,7 @@ void main() {
expect(jsonObject['files']['b.dart'], '6f144e08b58cd0925328610fad7ac07c'); expect(jsonObject['files']['b.dart'], '6f144e08b58cd0925328610fad7ac07c');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('includes framework version', () { testUsingContext('includes framework version', () {
...@@ -489,7 +489,7 @@ void main() { ...@@ -489,7 +489,7 @@ void main() {
final Map<Type, Generator> contextOverrides = <Type, Generator>{ final Map<Type, Generator> contextOverrides = <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}; };
testUsingContext('returns one file if only one is listed', () { testUsingContext('returns one file if only one is listed', () {
......
...@@ -52,7 +52,7 @@ void main() { ...@@ -52,7 +52,7 @@ void main() {
fs.directory('windows').createSync(); fs.directory('windows').createSync();
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows), FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => platform, Platform: () => platform,
}); });
}); });
......
...@@ -64,7 +64,7 @@ void main() { ...@@ -64,7 +64,7 @@ void main() {
Cache.releaseLockEarly(); Cache.releaseLockEarly();
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => mockFileSystem, FileSystem: () => mockFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('throws tool exit when lockfile open fails', () async { testUsingContext('throws tool exit when lockfile open fails', () async {
...@@ -73,7 +73,7 @@ void main() { ...@@ -73,7 +73,7 @@ void main() {
expect(() async => await Cache.lock(), throwsA(isA<ToolExit>())); expect(() async => await Cache.lock(), throwsA(isA<ToolExit>()));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => mockFileSystem, FileSystem: () => mockFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('should not throw when FLUTTER_ALREADY_LOCKED is set', () async { testUsingContext('should not throw when FLUTTER_ALREADY_LOCKED is set', () async {
...@@ -102,7 +102,7 @@ void main() { ...@@ -102,7 +102,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: ()=> mockCache, Cache: ()=> mockCache,
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('Gradle wrapper should be up to date, only if all cached artifact are available', () { testUsingContext('Gradle wrapper should be up to date, only if all cached artifact are available', () {
...@@ -118,7 +118,7 @@ void main() { ...@@ -118,7 +118,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: ()=> mockCache, Cache: ()=> mockCache,
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
test('should not be up to date, if some cached artifact is not', () { test('should not be up to date, if some cached artifact is not', () {
...@@ -210,7 +210,7 @@ void main() { ...@@ -210,7 +210,7 @@ void main() {
expect(flattenNameSubdirs(Uri.parse('https://www.flutter.dev')), 'www.flutter.dev'); expect(flattenNameSubdirs(Uri.parse('https://www.flutter.dev')), 'www.flutter.dev');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
test('Unstable artifacts', () { test('Unstable artifacts', () {
...@@ -261,7 +261,7 @@ void main() { ...@@ -261,7 +261,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: ()=> mockCache, Cache: ()=> mockCache,
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
HttpClientFactory: () => () => fakeHttpClient, HttpClientFactory: () => () => fakeHttpClient,
OperatingSystemUtils: () => mockOperatingSystemUtils, OperatingSystemUtils: () => mockOperatingSystemUtils,
Platform: () => fakePlatform, Platform: () => fakePlatform,
......
...@@ -41,7 +41,7 @@ void main() { ...@@ -41,7 +41,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => LocalEngineArtifacts('/engine', 'ios_profile', 'host_profile'), Artifacts: () => LocalEngineArtifacts('/engine', 'ios_profile', 'host_profile'),
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('build aot prints error if Clang version invalid', () async { testUsingContext('build aot prints error if Clang version invalid', () async {
......
...@@ -7,13 +7,11 @@ import 'dart:collection'; ...@@ -7,13 +7,11 @@ import 'dart:collection';
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/context.dart'; import 'package:flutter_tools/src/base/context.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/base/utils.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/dart/pub.dart'; import 'package:flutter_tools/src/dart/pub.dart';
import 'package:flutter_tools/src/reporting/reporting.dart'; import 'package:flutter_tools/src/reporting/reporting.dart';
...@@ -24,7 +22,6 @@ import 'package:quiver/testing/async.dart'; ...@@ -24,7 +22,6 @@ import 'package:quiver/testing/async.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/mocks.dart' as mocks; import '../../src/mocks.dart' as mocks;
import '../../src/testbed.dart';
void main() { void main() {
setUpAll(() { setUpAll(() {
...@@ -242,117 +239,6 @@ void main() { ...@@ -242,117 +239,6 @@ void main() {
Usage: () => MockUsage(), Usage: () => MockUsage(),
Pub: () => const Pub(), Pub: () => const Pub(),
}); });
test('Pub error handling', () {
final MemoryFileSystem fileSystem = MemoryFileSystem();
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
command: const <String>[
'/bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'get',
'--no-precompile',
],
onRun: () {
fs.file('.packages')
..setLastModifiedSync(DateTime(2002));
}
),
const FakeCommand(
command: <String>[
'/bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'get',
'--no-precompile',
],
),
FakeCommand(
command: const <String>[
'/bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'get',
'--no-precompile',
],
onRun: () {
fs.file('pubspec.yaml')
..setLastModifiedSync(DateTime(2002));
}
),
]);
Testbed().run(() async {
// the good scenario: .packages is old, pub updates the file.
fs.file('.packages')
..createSync()
..setLastModifiedSync(DateTime(2000));
fs.file('pubspec.yaml')
..createSync()
..setLastModifiedSync(DateTime(2001));
await pub.get(context: PubContext.flutterTests, checkLastModified: true); // pub sets date of .packages to 2002
expect(testLogger.statusText, 'Running "flutter pub get" in /...\n');
expect(testLogger.errorText, isEmpty);
expect(fs.file('pubspec.yaml').lastModifiedSync(), DateTime(2001)); // because nothing should touch it
expect(fs.file('.packages').lastModifiedSync(), isNot(DateTime(2000))); // because pub changes it to 2002
expect(fs.file('.packages').lastModifiedSync(), isNot(DateTime(2002))); // because we set the timestamp again after pub
testLogger.clear();
// bad scenario 1: pub doesn't update file; doesn't matter, because we do instead
fs.file('.packages')
..setLastModifiedSync(DateTime(2000));
fs.file('pubspec.yaml')
..setLastModifiedSync(DateTime(2001));
await pub.get(context: PubContext.flutterTests, checkLastModified: true); // pub does nothing
expect(testLogger.statusText, 'Running "flutter pub get" in /...\n');
expect(testLogger.errorText, isEmpty);
expect(fs.file('pubspec.yaml').lastModifiedSync(), DateTime(2001)); // because nothing should touch it
expect(fs.file('.packages').lastModifiedSync(), isNot(DateTime(2000))); // because we set the timestamp
expect(fs.file('.packages').lastModifiedSync(), isNot(DateTime(2002))); // just in case FakeProcessManager is buggy
testLogger.clear();
// bad scenario 2: pub changes pubspec.yaml instead
fs.file('.packages')
..setLastModifiedSync(DateTime(2000));
fs.file('pubspec.yaml')
..setLastModifiedSync(DateTime(2001));
try {
await pub.get(context: PubContext.flutterTests, checkLastModified: true);
expect(true, isFalse, reason: 'pub.get did not throw');
} catch (error) {
expect(error.runtimeType, Exception);
expect(error.message, '/: unexpected concurrent modification of pubspec.yaml while running pub.');
}
expect(testLogger.statusText, 'Running "flutter pub get" in /...\n');
expect(testLogger.errorText, isEmpty);
expect(fs.file('pubspec.yaml').lastModifiedSync(), DateTime(2002)); // because fake pub above touched it
expect(fs.file('.packages').lastModifiedSync(), DateTime(2000)); // because nothing touched it
// bad scenario 3: pubspec.yaml was created in the future
fs.file('.packages')
..setLastModifiedSync(DateTime(2000));
fs.file('pubspec.yaml')
..setLastModifiedSync(DateTime(9999));
assert(DateTime(9999).isAfter(DateTime.now()));
await pub.get(context: PubContext.flutterTests, checkLastModified: true); // pub does nothing
expect(testLogger.statusText, 'Running "flutter pub get" in /...\n');
expect(testLogger.errorText, startsWith(
'Warning: File "/pubspec.yaml" was created in the future. Optimizations that rely on '
'comparing time stamps will be unreliable. Check your system clock for accuracy.\n'
'The timestamp was: 2000-01-01 00:00:00.000\n'
));
testLogger.clear();
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => const Pub(),
Platform: () => FakePlatform(
operatingSystem: 'linux', // so that the command executed is consistent
environment: <String, String>{},
),
BotDetector: () => const BotDetectorAlwaysNo(), // so that the test never adds --trace to the pub command
});
});
}
class BotDetectorAlwaysNo implements BotDetector {
const BotDetectorAlwaysNo();
@override
bool get isRunningOnBot => false;
} }
typedef StartCallback = void Function(List<dynamic> command); typedef StartCallback = void Function(List<dynamic> command);
......
...@@ -89,7 +89,7 @@ void main() { ...@@ -89,7 +89,7 @@ void main() {
expect(content.isModified, isFalse); expect(content.isModified, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}, skip: Platform.isWindows); // TODO(jonahwilliams): fix or disable this functionality. }, skip: Platform.isWindows); // TODO(jonahwilliams): fix or disable this functionality.
}); });
...@@ -159,7 +159,7 @@ void main() { ...@@ -159,7 +159,7 @@ void main() {
verify(httpRequest.close()).called(kFailedAttempts + 1); verify(httpRequest.close()).called(kFailedAttempts + 1);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
...@@ -208,7 +208,7 @@ void main() { ...@@ -208,7 +208,7 @@ void main() {
expect(report.success, true); expect(report.success, true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('delete dev file system', () async { testUsingContext('delete dev file system', () async {
...@@ -218,7 +218,7 @@ void main() { ...@@ -218,7 +218,7 @@ void main() {
expect(devFS.assetPathsToEvict, isEmpty); expect(devFS.assetPathsToEvict, isEmpty);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('cleanup preexisting file system', () async { testUsingContext('cleanup preexisting file system', () async {
...@@ -246,7 +246,7 @@ void main() { ...@@ -246,7 +246,7 @@ void main() {
expect(devFS.assetPathsToEvict, isEmpty); expect(devFS.assetPathsToEvict, isEmpty);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('reports unsuccessful compile when errors are returned', () async { testUsingContext('reports unsuccessful compile when errors are returned', () async {
...@@ -276,7 +276,7 @@ void main() { ...@@ -276,7 +276,7 @@ void main() {
expect(devFS.lastCompiled, previousCompile); expect(devFS.lastCompiled, previousCompile);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('correctly updates last compiled time when compilation does not fail', () async { testUsingContext('correctly updates last compiled time when compilation does not fail', () async {
...@@ -310,7 +310,7 @@ void main() { ...@@ -310,7 +310,7 @@ void main() {
expect(devFS.lastCompiled, isNot(previousCompile)); expect(devFS.lastCompiled, isNot(previousCompile));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
} }
......
...@@ -652,7 +652,7 @@ flutter: ...@@ -652,7 +652,7 @@ flutter:
}, },
overrides: <Type, Generator>{ overrides: <Type, Generator>{
FileSystem: () => filesystem, FileSystem: () => filesystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}, },
); );
} }
......
...@@ -75,7 +75,7 @@ void main() { ...@@ -75,7 +75,7 @@ void main() {
expect(device.isSupportedForProject(FlutterProject.current()), true); expect(device.isSupportedForProject(FlutterProject.current()), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('supported for project', () async { testUsingContext('supported for project', () async {
...@@ -85,7 +85,7 @@ void main() { ...@@ -85,7 +85,7 @@ void main() {
expect(device.isSupportedForProject(FlutterProject.current()), true); expect(device.isSupportedForProject(FlutterProject.current()), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('not supported for project', () async { testUsingContext('not supported for project', () async {
...@@ -94,7 +94,7 @@ void main() { ...@@ -94,7 +94,7 @@ void main() {
expect(device.isSupportedForProject(FlutterProject.current()), false); expect(device.isSupportedForProject(FlutterProject.current()), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
...@@ -448,7 +448,7 @@ void main() { ...@@ -448,7 +448,7 @@ void main() {
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasObservatory, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaDeviceTools: () => fuchsiaDeviceTools, FuchsiaDeviceTools: () => fuchsiaDeviceTools,
FuchsiaSdk: () => fuchsiaSdk, FuchsiaSdk: () => fuchsiaSdk,
OperatingSystemUtils: () => osUtils, OperatingSystemUtils: () => osUtils,
...@@ -473,7 +473,7 @@ void main() { ...@@ -473,7 +473,7 @@ void main() {
expect(await device.stopApp(app), isTrue); expect(await device.stopApp(app), isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaDeviceTools: () => fuchsiaDeviceTools, FuchsiaDeviceTools: () => fuchsiaDeviceTools,
FuchsiaSdk: () => fuchsiaSdk, FuchsiaSdk: () => fuchsiaSdk,
OperatingSystemUtils: () => osUtils, OperatingSystemUtils: () => osUtils,
...@@ -486,7 +486,7 @@ void main() { ...@@ -486,7 +486,7 @@ void main() {
expect(launchResult.hasObservatory, isTrue); expect(launchResult.hasObservatory, isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaDeviceTools: () => fuchsiaDeviceTools, FuchsiaDeviceTools: () => fuchsiaDeviceTools,
FuchsiaSdk: () => fuchsiaSdk, FuchsiaSdk: () => fuchsiaSdk,
OperatingSystemUtils: () => osUtils, OperatingSystemUtils: () => osUtils,
...@@ -499,7 +499,7 @@ void main() { ...@@ -499,7 +499,7 @@ void main() {
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasObservatory, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaDeviceTools: () => fuchsiaDeviceTools, FuchsiaDeviceTools: () => fuchsiaDeviceTools,
FuchsiaSdk: () => fuchsiaSdk, FuchsiaSdk: () => fuchsiaSdk,
OperatingSystemUtils: () => osUtils, OperatingSystemUtils: () => osUtils,
...@@ -512,7 +512,7 @@ void main() { ...@@ -512,7 +512,7 @@ void main() {
expect(launchResult.hasObservatory, isTrue); expect(launchResult.hasObservatory, isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaDeviceTools: () => fuchsiaDeviceTools, FuchsiaDeviceTools: () => fuchsiaDeviceTools,
FuchsiaSdk: () => fuchsiaSdk, FuchsiaSdk: () => fuchsiaSdk,
OperatingSystemUtils: () => osUtils, OperatingSystemUtils: () => osUtils,
...@@ -525,7 +525,7 @@ void main() { ...@@ -525,7 +525,7 @@ void main() {
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasObservatory, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaDeviceTools: () => fuchsiaDeviceTools, FuchsiaDeviceTools: () => fuchsiaDeviceTools,
FuchsiaSdk: () => MockFuchsiaSdk(devFinder: FailingDevFinder()), FuchsiaSdk: () => MockFuchsiaSdk(devFinder: FailingDevFinder()),
OperatingSystemUtils: () => osUtils, OperatingSystemUtils: () => osUtils,
...@@ -538,7 +538,7 @@ void main() { ...@@ -538,7 +538,7 @@ void main() {
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasObservatory, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaDeviceTools: () => fuchsiaDeviceTools, FuchsiaDeviceTools: () => fuchsiaDeviceTools,
FuchsiaSdk: () => MockFuchsiaSdk(pm: FailingPM()), FuchsiaSdk: () => MockFuchsiaSdk(pm: FailingPM()),
OperatingSystemUtils: () => osUtils, OperatingSystemUtils: () => osUtils,
...@@ -551,7 +551,7 @@ void main() { ...@@ -551,7 +551,7 @@ void main() {
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasObservatory, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaDeviceTools: () => FakeFuchsiaDeviceTools(amber: FailingAmberCtl()), FuchsiaDeviceTools: () => FakeFuchsiaDeviceTools(amber: FailingAmberCtl()),
FuchsiaSdk: () => fuchsiaSdk, FuchsiaSdk: () => fuchsiaSdk,
OperatingSystemUtils: () => osUtils, OperatingSystemUtils: () => osUtils,
...@@ -564,7 +564,7 @@ void main() { ...@@ -564,7 +564,7 @@ void main() {
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasObservatory, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FuchsiaDeviceTools: () => FakeFuchsiaDeviceTools(tiles: FailingTilesCtl()), FuchsiaDeviceTools: () => FakeFuchsiaDeviceTools(tiles: FailingTilesCtl()),
FuchsiaSdk: () => fuchsiaSdk, FuchsiaSdk: () => fuchsiaSdk,
OperatingSystemUtils: () => osUtils, OperatingSystemUtils: () => osUtils,
......
...@@ -69,7 +69,7 @@ void main() { ...@@ -69,7 +69,7 @@ void main() {
expect(message.message, contains('recommended minimum version')); expect(message.message, contains('recommended minimum version'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('not found', () async { testUsingContext('not found', () async {
...@@ -90,7 +90,7 @@ void main() { ...@@ -90,7 +90,7 @@ void main() {
expect(message.message, contains('Flutter plugin not installed')); expect(message.message, contains('Flutter plugin not installed'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
}); });
......
...@@ -807,7 +807,7 @@ flutter: ...@@ -807,7 +807,7 @@ flutter:
expect(IOSDevice('test').isSupportedForProject(flutterProject), true); expect(IOSDevice('test').isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => macPlatform, Platform: () => macPlatform,
}); });
testUsingContext('IOSDevice.isSupportedForProject is true with editable host app', () async { testUsingContext('IOSDevice.isSupportedForProject is true with editable host app', () async {
...@@ -819,7 +819,7 @@ flutter: ...@@ -819,7 +819,7 @@ flutter:
expect(IOSDevice('test').isSupportedForProject(flutterProject), true); expect(IOSDevice('test').isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => macPlatform, Platform: () => macPlatform,
}); });
...@@ -831,7 +831,7 @@ flutter: ...@@ -831,7 +831,7 @@ flutter:
expect(IOSDevice('test').isSupportedForProject(flutterProject), false); expect(IOSDevice('test').isSupportedForProject(flutterProject), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => macPlatform, Platform: () => macPlatform,
}); });
} }
......
...@@ -486,7 +486,7 @@ flutter: ...@@ -486,7 +486,7 @@ flutter:
expect(IOSSimulator('test').isSupportedForProject(flutterProject), true); expect(IOSSimulator('test').isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('IOSDevice.isSupportedForProject is true with editable host app', () async { testUsingContext('IOSDevice.isSupportedForProject is true with editable host app', () async {
...@@ -498,7 +498,7 @@ flutter: ...@@ -498,7 +498,7 @@ flutter:
expect(IOSSimulator('test').isSupportedForProject(flutterProject), true); expect(IOSSimulator('test').isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('IOSDevice.isSupportedForProject is false with no host app and no module', () async { testUsingContext('IOSDevice.isSupportedForProject is false with no host app and no module', () async {
...@@ -509,6 +509,6 @@ flutter: ...@@ -509,6 +509,6 @@ flutter:
expect(IOSSimulator('test').isSupportedForProject(flutterProject), false); expect(IOSSimulator('test').isSupportedForProject(flutterProject), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
} }
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
expect(LinuxDevice().isSupportedForProject(flutterProject), true); expect(LinuxDevice().isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('LinuxDevice.isSupportedForProject is false with no host app', () async { testUsingContext('LinuxDevice.isSupportedForProject is false with no host app', () async {
...@@ -59,7 +59,7 @@ void main() { ...@@ -59,7 +59,7 @@ void main() {
expect(LinuxDevice().isSupportedForProject(flutterProject), false); expect(LinuxDevice().isSupportedForProject(flutterProject), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('LinuxDevice.executablePathForDevice uses the correct package executable', () async { testUsingContext('LinuxDevice.executablePathForDevice uses the correct package executable', () async {
...@@ -76,7 +76,7 @@ void main() { ...@@ -76,7 +76,7 @@ void main() {
expect(LinuxDevice().executablePathForDevice(mockApp, BuildMode.release), releasePath); expect(LinuxDevice().executablePathForDevice(mockApp, BuildMode.release), releasePath);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
} }
......
...@@ -179,7 +179,7 @@ void main() { ...@@ -179,7 +179,7 @@ void main() {
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Objective-C iOS podfile template'); expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Objective-C iOS podfile template');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('creates swift Podfile if swift', () async { testUsingContext('creates swift Podfile if swift', () async {
...@@ -195,7 +195,7 @@ void main() { ...@@ -195,7 +195,7 @@ void main() {
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Swift iOS podfile template'); expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Swift iOS podfile template');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
XcodeProjectInterpreter: () => mockXcodeProjectInterpreter, XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
}); });
...@@ -206,7 +206,7 @@ void main() { ...@@ -206,7 +206,7 @@ void main() {
expect(projectUnderTest.macos.podfile.readAsStringSync(), 'macOS podfile template'); expect(projectUnderTest.macos.podfile.readAsStringSync(), 'macOS podfile template');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('does not recreate Podfile when already present', () async { testUsingContext('does not recreate Podfile when already present', () async {
...@@ -218,7 +218,7 @@ void main() { ...@@ -218,7 +218,7 @@ void main() {
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Existing Podfile'); expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Existing Podfile');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('does not create Podfile when we cannot interpret Xcode projects', () async { testUsingContext('does not create Podfile when we cannot interpret Xcode projects', () async {
...@@ -230,7 +230,7 @@ void main() { ...@@ -230,7 +230,7 @@ void main() {
expect(projectUnderTest.ios.podfile.existsSync(), false); expect(projectUnderTest.ios.podfile.existsSync(), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
XcodeProjectInterpreter: () => mockXcodeProjectInterpreter, XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
}); });
...@@ -256,7 +256,7 @@ void main() { ...@@ -256,7 +256,7 @@ void main() {
expect(releaseContents, contains('Existing release config')); expect(releaseContents, contains('Existing release config'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
...@@ -285,7 +285,7 @@ void main() { ...@@ -285,7 +285,7 @@ void main() {
expect(releaseContents, contains('Existing release config')); expect(releaseContents, contains('Existing release config'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
......
...@@ -56,7 +56,7 @@ void main() { ...@@ -56,7 +56,7 @@ void main() {
expect(MacOSDevice().isSupportedForProject(flutterProject), true); expect(MacOSDevice().isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('isSupportedForProject is false with no host app', () async { testUsingContext('isSupportedForProject is false with no host app', () async {
...@@ -67,7 +67,7 @@ void main() { ...@@ -67,7 +67,7 @@ void main() {
expect(MacOSDevice().isSupportedForProject(flutterProject), false); expect(MacOSDevice().isSupportedForProject(flutterProject), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('executablePathForDevice uses the correct package executable', () async { testUsingContext('executablePathForDevice uses the correct package executable', () async {
...@@ -84,7 +84,7 @@ void main() { ...@@ -84,7 +84,7 @@ void main() {
expect(MacOSDevice().executablePathForDevice(mockApp, BuildMode.release), releasePath); expect(MacOSDevice().executablePathForDevice(mockApp, BuildMode.release), releasePath);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
} }
......
...@@ -40,7 +40,7 @@ void main() { ...@@ -40,7 +40,7 @@ void main() {
'package:example/main.dart'); 'package:example/main.dart');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => mockFileSystem, FileSystem: () => mockFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('single-root maps file from other package to null', () async { testUsingContext('single-root maps file from other package to null', () async {
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
expect(packageUriMapper.map('/xml/lib/xml.dart'), null); expect(packageUriMapper.map('/xml/lib/xml.dart'), null);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => mockFileSystem, FileSystem: () => mockFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('single-root maps non-main file from same package', () async { testUsingContext('single-root maps non-main file from same package', () async {
...@@ -57,7 +57,7 @@ void main() { ...@@ -57,7 +57,7 @@ void main() {
'package:example/src/foo.dart'); 'package:example/src/foo.dart');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => mockFileSystem, FileSystem: () => mockFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('multi-root maps main file from same package on multiroot scheme', () async { testUsingContext('multi-root maps main file from same package on multiroot scheme', () async {
...@@ -76,7 +76,7 @@ void main() { ...@@ -76,7 +76,7 @@ void main() {
'package:example/main.dart'); 'package:example/main.dart');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => mockFileSystem, FileSystem: () => mockFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
} }
......
...@@ -75,7 +75,7 @@ flutter: ...@@ -75,7 +75,7 @@ flutter:
expect(flutterProject.flutterPluginsFile.existsSync(), false); expect(flutterProject.flutterPluginsFile.existsSync(), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('Refreshing the plugin list deletes the plugin file when there were plugins but no longer are', () { testUsingContext('Refreshing the plugin list deletes the plugin file when there were plugins but no longer are', () {
...@@ -86,7 +86,7 @@ flutter: ...@@ -86,7 +86,7 @@ flutter:
expect(flutterProject.flutterPluginsFile.existsSync(), false); expect(flutterProject.flutterPluginsFile.existsSync(), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('Refreshing the plugin list creates a plugin directory when there are plugins', () { testUsingContext('Refreshing the plugin list creates a plugin directory when there are plugins', () {
...@@ -97,7 +97,7 @@ flutter: ...@@ -97,7 +97,7 @@ flutter:
expect(flutterProject.flutterPluginsFile.existsSync(), true); expect(flutterProject.flutterPluginsFile.existsSync(), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('Changes to the plugin list invalidates the Cocoapod lockfiles', () { testUsingContext('Changes to the plugin list invalidates the Cocoapod lockfiles', () {
...@@ -111,7 +111,7 @@ flutter: ...@@ -111,7 +111,7 @@ flutter:
expect(macosProject.podManifestLock.existsSync(), false); expect(macosProject.podManifestLock.existsSync(), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
...@@ -167,7 +167,7 @@ flutter: ...@@ -167,7 +167,7 @@ flutter:
expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant')); expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => featureFlags, FeatureFlags: () => featureFlags,
}); });
...@@ -192,7 +192,7 @@ flutter: ...@@ -192,7 +192,7 @@ flutter:
expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant')); expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => featureFlags, FeatureFlags: () => featureFlags,
}); });
...@@ -288,7 +288,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()} ...@@ -288,7 +288,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => featureFlags, FeatureFlags: () => featureFlags,
XcodeProjectInterpreter: () => xcodeProjectInterpreter, XcodeProjectInterpreter: () => xcodeProjectInterpreter,
}); });
...@@ -314,7 +314,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()} ...@@ -314,7 +314,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}
expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant')); expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => featureFlags, FeatureFlags: () => featureFlags,
}); });
...@@ -339,7 +339,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()} ...@@ -339,7 +339,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}
expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant')); expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => featureFlags, FeatureFlags: () => featureFlags,
}); });
...@@ -364,7 +364,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()} ...@@ -364,7 +364,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}
expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant')); expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => featureFlags, FeatureFlags: () => featureFlags,
}); });
...@@ -389,7 +389,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()} ...@@ -389,7 +389,7 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}
expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant')); expect(registrant.readAsStringSync(), contains('class GeneratedPluginRegistrant'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => featureFlags, FeatureFlags: () => featureFlags,
}); });
}); });
......
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('Non-existent files are ignored', () async { testUsingContext('Non-existent files are ignored', () async {
...@@ -50,7 +50,7 @@ void main() { ...@@ -50,7 +50,7 @@ void main() {
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
} }
...@@ -196,7 +196,7 @@ void main() { ...@@ -196,7 +196,7 @@ void main() {
expectExists(project.macos.managedDirectory.childFile('GeneratedPluginRegistrant.swift')); expectExists(project.macos.managedDirectory.childFile('GeneratedPluginRegistrant.swift'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
FlutterProjectFactory: () => FlutterProjectFactory(), FlutterProjectFactory: () => FlutterProjectFactory(),
}); });
...@@ -207,7 +207,7 @@ void main() { ...@@ -207,7 +207,7 @@ void main() {
expectExists(project.macos.generatedXcodePropertiesFile); expectExists(project.macos.generatedXcodePropertiesFile);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
FlutterProjectFactory: () => FlutterProjectFactory(), FlutterProjectFactory: () => FlutterProjectFactory(),
}); });
...@@ -219,7 +219,7 @@ void main() { ...@@ -219,7 +219,7 @@ void main() {
expectExists(project.linux.managedDirectory.childFile('generated_plugin_registrant.cc')); expectExists(project.linux.managedDirectory.childFile('generated_plugin_registrant.cc'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true), FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
FlutterProjectFactory: () => FlutterProjectFactory(), FlutterProjectFactory: () => FlutterProjectFactory(),
}); });
...@@ -231,7 +231,7 @@ void main() { ...@@ -231,7 +231,7 @@ void main() {
expectExists(project.windows.managedDirectory.childFile('generated_plugin_registrant.cc')); expectExists(project.windows.managedDirectory.childFile('generated_plugin_registrant.cc'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true), FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
FlutterProjectFactory: () => FlutterProjectFactory(), FlutterProjectFactory: () => FlutterProjectFactory(),
}); });
...@@ -328,7 +328,7 @@ apply plugin: 'kotlin-android' ...@@ -328,7 +328,7 @@ apply plugin: 'kotlin-android'
expect(project.android.isKotlin, isTrue); expect(project.android.isKotlin, isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
XcodeProjectInterpreter: () => mockXcodeProjectInterpreter, XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
FlutterProjectFactory: () => flutterProjectFactory, FlutterProjectFactory: () => flutterProjectFactory,
}); });
...@@ -349,7 +349,7 @@ apply plugin: 'kotlin-android' ...@@ -349,7 +349,7 @@ apply plugin: 'kotlin-android'
void testWithMocks(String description, Future<void> testMethod()) { void testWithMocks(String description, Future<void> testMethod()) {
testUsingContext(description, testMethod, overrides: <Type, Generator>{ testUsingContext(description, testMethod, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
PlistParser: () => mockPlistUtils, PlistParser: () => mockPlistUtils,
XcodeProjectInterpreter: () => mockXcodeProjectInterpreter, XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
FlutterProjectFactory: () => flutterProjectFactory, FlutterProjectFactory: () => flutterProjectFactory,
...@@ -617,7 +617,7 @@ void testInMemory(String description, Future<void> testMethod()) { ...@@ -617,7 +617,7 @@ void testInMemory(String description, Future<void> testMethod()) {
testMethod, testMethod,
overrides: <Type, Generator>{ overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Cache: () => Cache(), Cache: () => Cache(),
FlutterProjectFactory: () => flutterProjectFactory, FlutterProjectFactory: () => flutterProjectFactory,
}, },
......
...@@ -67,7 +67,7 @@ void main() { ...@@ -67,7 +67,7 @@ void main() {
expect(versionChecked, isTrue); expect(versionChecked, isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => platform, Platform: () => platform,
}, initializeFlutterRoot: false); }, initializeFlutterRoot: false);
...@@ -79,7 +79,7 @@ void main() { ...@@ -79,7 +79,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => platform, Platform: () => platform,
}, initializeFlutterRoot: false); }, initializeFlutterRoot: false);
...@@ -95,7 +95,7 @@ void main() { ...@@ -95,7 +95,7 @@ void main() {
await runner.run(<String>['dummy', '--local-engine=ios_debug']); await runner.run(<String>['dummy', '--local-engine=ios_debug']);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => platform, Platform: () => platform,
}, initializeFlutterRoot: false); }, initializeFlutterRoot: false);
...@@ -105,7 +105,7 @@ void main() { ...@@ -105,7 +105,7 @@ void main() {
await runner.run(<String>['dummy', '--local-engine-src-path=$_kArbitraryEngineRoot/src', '--local-engine=ios_debug']); await runner.run(<String>['dummy', '--local-engine-src-path=$_kArbitraryEngineRoot/src', '--local-engine=ios_debug']);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => platform, Platform: () => platform,
}, initializeFlutterRoot: false); }, initializeFlutterRoot: false);
...@@ -115,7 +115,7 @@ void main() { ...@@ -115,7 +115,7 @@ void main() {
await runner.run(<String>['dummy', '--local-engine=ios_debug']); await runner.run(<String>['dummy', '--local-engine=ios_debug']);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => platform, Platform: () => platform,
}, initializeFlutterRoot: false); }, initializeFlutterRoot: false);
}); });
...@@ -130,7 +130,7 @@ void main() { ...@@ -130,7 +130,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => platform, Platform: () => platform,
}, initializeFlutterRoot: false); }, initializeFlutterRoot: false);
...@@ -188,7 +188,7 @@ void main() { ...@@ -188,7 +188,7 @@ void main() {
]); ]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Platform: () => platform, Platform: () => platform,
}, initializeFlutterRoot: false); }, initializeFlutterRoot: false);
}); });
...@@ -201,7 +201,7 @@ void main() { ...@@ -201,7 +201,7 @@ void main() {
expect(fakeCommand.preferences.wrapText, isTrue); expect(fakeCommand.preferences.wrapText, isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Stdio: () => FakeStdio(hasFakeTerminal: true), Stdio: () => FakeStdio(hasFakeTerminal: true),
}, initializeFlutterRoot: false); }, initializeFlutterRoot: false);
...@@ -212,7 +212,7 @@ void main() { ...@@ -212,7 +212,7 @@ void main() {
expect(fakeCommand.preferences.wrapText, isFalse); expect(fakeCommand.preferences.wrapText, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Stdio: () => FakeStdio(hasFakeTerminal: false), Stdio: () => FakeStdio(hasFakeTerminal: false),
}, initializeFlutterRoot: false); }, initializeFlutterRoot: false);
...@@ -223,7 +223,7 @@ void main() { ...@@ -223,7 +223,7 @@ void main() {
expect(fakeCommand.preferences.wrapText, isFalse); expect(fakeCommand.preferences.wrapText, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Stdio: () => FakeStdio(hasFakeTerminal: true), Stdio: () => FakeStdio(hasFakeTerminal: true),
}, initializeFlutterRoot: false); }, initializeFlutterRoot: false);
...@@ -234,7 +234,7 @@ void main() { ...@@ -234,7 +234,7 @@ void main() {
expect(fakeCommand.preferences.wrapText, isTrue); expect(fakeCommand.preferences.wrapText, isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Stdio: () => FakeStdio(hasFakeTerminal: false), Stdio: () => FakeStdio(hasFakeTerminal: false),
}, initializeFlutterRoot: false); }, initializeFlutterRoot: false);
}); });
......
...@@ -71,7 +71,7 @@ void main() { ...@@ -71,7 +71,7 @@ void main() {
'FLUTTER_ROOT': '/', 'FLUTTER_ROOT': '/',
}), }),
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Usage: () => CrashingUsage(), Usage: () => CrashingUsage(),
}); });
}); });
......
...@@ -37,7 +37,7 @@ void main() { ...@@ -37,7 +37,7 @@ void main() {
expect(app.packagesFile.path, fs.path.join(projectPath, '.packages')); expect(app.packagesFile.path, fs.path.join(projectPath, '.packages'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
......
...@@ -49,7 +49,7 @@ void main() { ...@@ -49,7 +49,7 @@ void main() {
expect(WindowsDevice().isSupportedForProject(flutterProject), true); expect(WindowsDevice().isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('isSupportedForProject is false with no host app', () async { testUsingContext('isSupportedForProject is false with no host app', () async {
...@@ -60,7 +60,7 @@ void main() { ...@@ -60,7 +60,7 @@ void main() {
expect(WindowsDevice().isSupportedForProject(flutterProject), false); expect(WindowsDevice().isSupportedForProject(flutterProject), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
testUsingContext('executablePathForDevice uses the correct package executable', () async { testUsingContext('executablePathForDevice uses the correct package executable', () async {
...@@ -77,7 +77,7 @@ void main() { ...@@ -77,7 +77,7 @@ void main() {
expect(WindowsDevice().executablePathForDevice(mockApp, BuildMode.release), releasePath); expect(WindowsDevice().executablePathForDevice(mockApp, BuildMode.release), releasePath);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
}); });
}); });
} }
......
...@@ -9,12 +9,8 @@ import 'package:flutter_tools/src/base/io.dart'; ...@@ -9,12 +9,8 @@ import 'package:flutter_tools/src/base/io.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:process/process.dart'; import 'package:process/process.dart';
import 'common.dart';
export 'package:process/process.dart' show ProcessManager; export 'package:process/process.dart' show ProcessManager;
typedef VoidCallback = void Function();
/// A command for [FakeProcessManager]. /// A command for [FakeProcessManager].
@immutable @immutable
class FakeCommand { class FakeCommand {
...@@ -23,29 +19,28 @@ class FakeCommand { ...@@ -23,29 +19,28 @@ class FakeCommand {
this.workingDirectory, this.workingDirectory,
this.environment, this.environment,
this.duration = const Duration(), this.duration = const Duration(),
this.onRun, @required this.exitCode,
this.exitCode = 0, @required this.stdout,
this.stdout = '', @required this.stderr,
this.stderr = '',
}) : assert(command != null), }) : assert(command != null),
assert(duration != null), assert(duration != null),
assert(exitCode != null),
assert(stdout != null), assert(stdout != null),
assert(stderr != null); assert(stderr != null);
/// The exact commands that must be matched for this [FakeCommand] to be /// The exact commands that must be matched for this [FakeCommand] to be
/// considered correct. /// selected from those given to the [FakeProcessManager].
final List<String> command; final List<String> command;
/// The exact working directory that must be matched for this [FakeCommand] to /// The exact working directory that must be matched for this [FakeCommand] to
/// be considered correct. /// be selected from those given to the [FakeProcessManager].
/// ///
/// If this is null, the working directory is ignored. /// If this is null, then it matches any working directory.
final String workingDirectory; final String workingDirectory;
/// The environment that must be matched for this [FakeCommand] to be considered correct. /// The environment that must be matched for this [FakeCommand] to be selected
/// from those given to the [FakeProcessManager].
/// ///
/// If this is null, then the environment is ignored. /// If this is null, then it matches any environment.
/// ///
/// Otherwise, each key in this environment must be present and must have a /// Otherwise, each key in this environment must be present and must have a
/// value that matches the one given here for the [FakeCommand] to match. /// value that matches the one given here for the [FakeCommand] to match.
...@@ -58,10 +53,6 @@ class FakeCommand { ...@@ -58,10 +53,6 @@ class FakeCommand {
/// otherwise the test will be artificially slow. /// otherwise the test will be artificially slow.
final Duration duration; final Duration duration;
/// A callback that is run after [duration] expires but before the [exitCode]
/// (and output) are passed back.
final VoidCallback onRun;
/// The process' exit code. /// The process' exit code.
/// ///
/// To simulate a never-ending process, set [duration] to a value greated than /// To simulate a never-ending process, set [duration] to a value greated than
...@@ -119,20 +110,13 @@ class _FakeProcess implements Process { ...@@ -119,20 +110,13 @@ class _FakeProcess implements Process {
_FakeProcess( _FakeProcess(
this._exitCode, this._exitCode,
Duration duration, Duration duration,
VoidCallback onRun,
this.pid, this.pid,
this._stderr, this._stderr,
this.stdin, this.stdin,
this._stdout, this._stdout,
) : exitCode = Future<void>.delayed(duration).then((void value) { ) : exitCode = Future<void>.delayed(duration).then((void value) => _exitCode),
if (onRun != null) {
onRun();
}
return _exitCode;
}),
stderr = Stream<List<int>>.value(utf8.encode(_stderr)), stderr = Stream<List<int>>.value(utf8.encode(_stderr)),
stdout = Stream<List<int>>.value(utf8.encode(_stdout)); stdout = Stream<List<int>>.value(utf8.encode(_stdout));
final int _exitCode; final int _exitCode;
@override @override
...@@ -161,42 +145,44 @@ class _FakeProcess implements Process { ...@@ -161,42 +145,44 @@ class _FakeProcess implements Process {
} }
} }
abstract class FakeProcessManager implements ProcessManager { /// A fake [ProcessManager] which responds to particular commands with particular results.
/// A fake [ProcessManager] which responds to all commands as if they had run ///
/// instantaneously with an exit code of 0 and no output. /// On creation, pass in a list of [FakeCommand] objects. When the [ProcessManager] methods
factory FakeProcessManager.any() = _FakeAnyProcessManager; /// such as [start] are invoked, the first matching [FakeCommand] is found and its settings
/// are used to simulate the result of running that command.
/// A fake [ProcessManager] which responds to particular commands with ///
/// particular results. /// If no command is found, then one is implied which immediately returns exit
/// /// code 0 with no output.
/// On creation, pass in a list of [FakeCommand] objects. When the class FakeProcessManager implements ProcessManager {
/// [ProcessManager] methods such as [start] are invoked, the next FakeProcessManager(this._commands);
/// [FakeCommand] must match (otherwise the test fails); its settings are used
/// to simulate the result of running that command.
///
/// If no command is found, then one is implied which immediately returns exit
/// code 0 with no output.
///
/// There is no logic to ensure that all the listed commands are run. Use
/// [FakeCommand.onRun] to set a flag, or specify a sentinel command as your
/// last command and verify its execution is successful, to ensure that all
/// the specified commands are actually called.
factory FakeProcessManager.list(List<FakeCommand> commands) = _SequenceProcessManager;
FakeProcessManager._(); final List<FakeCommand> _commands;
@protected FakeCommand _findCommand(List<String> command, String workingDirectory, Map<String, String> environment) {
FakeCommand findCommand(List<String> command, String workingDirectory, Map<String, String> environment); for (FakeCommand candidate in _commands) {
if (candidate._matches(command, workingDirectory, environment)) {
return candidate;
}
}
return FakeCommand(
command: command,
workingDirectory: workingDirectory,
environment: environment,
duration: const Duration(),
exitCode: 0,
stdout: '',
stderr: '',
);
}
int _pid = 9999; int _pid = 9999;
_FakeProcess _runCommand(List<String> command, String workingDirectory, Map<String, String> environment) { _FakeProcess _runCommand(List<String> command, String workingDirectory, Map<String, String> environment) {
_pid += 1; _pid += 1;
final FakeCommand fakeCommand = findCommand(command, workingDirectory, environment); final FakeCommand fakeCommand = _findCommand(command, workingDirectory, environment);
return _FakeProcess( return _FakeProcess(
fakeCommand.exitCode, fakeCommand.exitCode,
fakeCommand.duration, fakeCommand.duration,
fakeCommand.onRun,
_pid, _pid,
fakeCommand.stdout, fakeCommand.stdout,
null, // stdin null, // stdin
...@@ -262,41 +248,3 @@ abstract class FakeProcessManager implements ProcessManager { ...@@ -262,41 +248,3 @@ abstract class FakeProcessManager implements ProcessManager {
return false; return false;
} }
} }
class _FakeAnyProcessManager extends FakeProcessManager {
_FakeAnyProcessManager() : super._();
@override
FakeCommand findCommand(List<String> command, String workingDirectory, Map<String, String> environment) {
return FakeCommand(
command: command,
workingDirectory: workingDirectory,
environment: environment,
duration: const Duration(),
exitCode: 0,
stdout: '',
stderr: '',
);
}
}
class _SequenceProcessManager extends FakeProcessManager {
_SequenceProcessManager(this._commands) : super._();
final List<FakeCommand> _commands;
@override
FakeCommand findCommand(List<String> command, String workingDirectory, Map<String, String> environment) {
expect(_commands, isNotEmpty,
reason: 'ProcessManager was told to execute $command (in $workingDirectory) '
'but the FakeProcessManager.list expected no more processes.'
);
expect(_commands.first._matches(command, workingDirectory, environment), isTrue,
reason: 'ProcessManager was told to execute $command '
'(in $workingDirectory, with environment $environment) '
'but the next process that was expected was ${_commands.first.command} '
'(in ${_commands.first.workingDirectory}, with environment ${_commands.first.environment})}.'
);
return _commands.removeAt(0);
}
}
...@@ -35,7 +35,7 @@ export 'package:flutter_tools/src/base/context.dart' show Generator; ...@@ -35,7 +35,7 @@ export 'package:flutter_tools/src/base/context.dart' show Generator;
final Map<Type, Generator> _testbedDefaults = <Type, Generator>{ final Map<Type, Generator> _testbedDefaults = <Type, Generator>{
// Keeps tests fast by avoiding the actual file system. // Keeps tests fast by avoiding the actual file system.
FileSystem: () => MemoryFileSystem(style: platform.isWindows ? FileSystemStyle.windows : FileSystemStyle.posix), FileSystem: () => MemoryFileSystem(style: platform.isWindows ? FileSystemStyle.windows : FileSystemStyle.posix),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
Logger: () => BufferLogger(), // Allows reading logs and prevents stdout. Logger: () => BufferLogger(), // Allows reading logs and prevents stdout.
OperatingSystemUtils: () => FakeOperatingSystemUtils(), OperatingSystemUtils: () => FakeOperatingSystemUtils(),
OutputPreferences: () => OutputPreferences.test(), // configures BufferLogger to avoid color codes. OutputPreferences: () => OutputPreferences.test(), // configures BufferLogger to avoid color codes.
......
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