Unverified Commit e8fbb43a authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Replace MockFile with memory file system files (#66941)

parent 07e56d48
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
}); });
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
mockFlutterVersion = MockFlutterVersion(); mockFlutterVersion = MockFlutterVersion();
mockGitTagVersion = MockGitTagVersion(); mockGitTagVersion = MockGitTagVersion();
mockCache = MockCache(); mockCache = MockCache();
......
...@@ -31,7 +31,7 @@ void main() { ...@@ -31,7 +31,7 @@ void main() {
FlutterProject projectUnderTest; FlutterProject projectUnderTest;
setUp(() { setUp(() {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
mockXcodeProjectInterpreter = MockXcodeProjectInterpreter(); mockXcodeProjectInterpreter = MockXcodeProjectInterpreter();
final Directory currentDirectory = fs.currentDirectory; final Directory currentDirectory = fs.currentDirectory;
......
...@@ -607,7 +607,7 @@ void main() { ...@@ -607,7 +607,7 @@ void main() {
expect(logger.statusText, contains('No issues found!')); expect(logger.statusText, contains('No issues found!'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => mockArtifacts, Artifacts: () => mockArtifacts,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
......
...@@ -38,7 +38,7 @@ void main() { ...@@ -38,7 +38,7 @@ void main() {
setUp(() { setUp(() {
command = DriveCommand(); command = DriveCommand();
applyMocksToCommand(command); applyMocksToCommand(command);
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
tempDir = fs.systemTempDirectory.createTempSync('flutter_drive_test.'); tempDir = fs.systemTempDirectory.createTempSync('flutter_drive_test.');
fs.currentDirectory = tempDir; fs.currentDirectory = tempDir;
fs.directory('test').createSync(); fs.directory('test').createSync();
......
...@@ -150,7 +150,7 @@ void main() { ...@@ -150,7 +150,7 @@ void main() {
mockArtifacts = MockArtifacts(); mockArtifacts = MockArtifacts();
mockCache = MockCache(); mockCache = MockCache();
mockUsage = MockUsage(); mockUsage = MockUsage();
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
mockProcessManager = MockProcessManager(); mockProcessManager = MockProcessManager();
tempDir = fs.systemTempDirectory.createTempSync('flutter_run_test.'); tempDir = fs.systemTempDirectory.createTempSync('flutter_run_test.');
......
...@@ -52,7 +52,7 @@ void main() { ...@@ -52,7 +52,7 @@ void main() {
expect(globals.fs.isFileSync(outputFile), isTrue); expect(globals.fs.isFileSync(outputFile), isTrue);
expect(globals.fs.file(outputFile).readAsStringSync(), contains('__flutter_completion')); expect(globals.fs.file(outputFile).readAsStringSync(), contains('__flutter_completion'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
Stdio: () => mockStdio, Stdio: () => mockStdio,
}); });
...@@ -73,7 +73,7 @@ void main() { ...@@ -73,7 +73,7 @@ void main() {
expect(globals.fs.isFileSync(outputFile), isTrue); expect(globals.fs.isFileSync(outputFile), isTrue);
expect(globals.fs.file(outputFile).readAsStringSync(), isEmpty); expect(globals.fs.file(outputFile).readAsStringSync(), isEmpty);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
Stdio: () => mockStdio, Stdio: () => mockStdio,
}); });
...@@ -88,7 +88,7 @@ void main() { ...@@ -88,7 +88,7 @@ void main() {
expect(globals.fs.isFileSync(outputFile), isTrue); expect(globals.fs.isFileSync(outputFile), isTrue);
expect(globals.fs.file(outputFile).readAsStringSync(), contains('__flutter_completion')); expect(globals.fs.file(outputFile).readAsStringSync(), contains('__flutter_completion'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
Stdio: () => mockStdio, Stdio: () => mockStdio,
}); });
......
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
MemoryFileSystem fs; MemoryFileSystem fs;
setUp(() { setUp(() {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
fs.file('pubspec.yaml').createSync(); fs.file('pubspec.yaml').createSync();
fs.file('.packages').createSync(); fs.file('.packages').createSync();
fs.directory('test').childFile('some_test.dart').createSync(recursive: true); fs.directory('test').childFile('some_test.dart').createSync(recursive: true);
......
...@@ -112,7 +112,7 @@ void main() { ...@@ -112,7 +112,7 @@ void main() {
'--target-platform=windows-x64', '--target-platform=windows-x64',
]), throwsToolExit()); ]), throwsToolExit());
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false), FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false),
}); });
...@@ -130,7 +130,7 @@ void main() { ...@@ -130,7 +130,7 @@ void main() {
'--target-platform=linux-x64', '--target-platform=linux-x64',
]), throwsToolExit()); ]), throwsToolExit());
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false),
}); });
...@@ -148,7 +148,7 @@ void main() { ...@@ -148,7 +148,7 @@ void main() {
'--target-platform=darwin-x64', '--target-platform=darwin-x64',
]), throwsToolExit()); ]), throwsToolExit());
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false),
}); });
...@@ -166,7 +166,7 @@ void main() { ...@@ -166,7 +166,7 @@ void main() {
'--target-platform=windows-x64', '--target-platform=windows-x64',
]); ]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true), FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
}); });
...@@ -184,7 +184,7 @@ void main() { ...@@ -184,7 +184,7 @@ void main() {
'--target-platform=linux-x64', '--target-platform=linux-x64',
]); ]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true), FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
}); });
...@@ -202,7 +202,7 @@ void main() { ...@@ -202,7 +202,7 @@ void main() {
'--target-platform=darwin-x64', '--target-platform=darwin-x64',
]); ]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
}); });
...@@ -234,7 +234,7 @@ void main() { ...@@ -234,7 +234,7 @@ void main() {
]); ]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
BuildSystem: () => MockBuildSystem(), BuildSystem: () => MockBuildSystem(),
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
} }
......
...@@ -117,7 +117,7 @@ void main() { ...@@ -117,7 +117,7 @@ void main() {
Platform: () => FakePlatform(environment: <String, String>{ Platform: () => FakePlatform(environment: <String, String>{
'FLUTTER_ANALYTICS_LOG_FILE': 'test', 'FLUTTER_ANALYTICS_LOG_FILE': 'test',
}), }),
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -143,7 +143,7 @@ void main() { ...@@ -143,7 +143,7 @@ void main() {
Platform: () => FakePlatform(environment: <String, String>{ Platform: () => FakePlatform(environment: <String, String>{
'FLUTTER_ANALYTICS_LOG_FILE': 'test', 'FLUTTER_ANALYTICS_LOG_FILE': 'test',
}), }),
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
}); });
...@@ -157,7 +157,7 @@ void main() { ...@@ -157,7 +157,7 @@ void main() {
List<int> mockTimes; List<int> mockTimes;
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
mockStdio = MockStdio(); mockStdio = MockStdio();
mockUsage = MockUsage(); mockUsage = MockUsage();
when(mockUsage.isFirstRun).thenReturn(false); when(mockUsage.isFirstRun).thenReturn(false);
......
...@@ -35,7 +35,7 @@ void main() { ...@@ -35,7 +35,7 @@ void main() {
setUp(() { setUp(() {
sdk = MockAndroidSdk(); sdk = MockAndroidSdk();
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
fs.directory('/home/me').createSync(recursive: true); fs.directory('/home/me').createSync(recursive: true);
logger = BufferLogger( logger = BufferLogger(
terminal: AnsiTerminal( terminal: AnsiTerminal(
......
...@@ -322,7 +322,7 @@ void main() { ...@@ -322,7 +322,7 @@ void main() {
), ),
).called(1); ).called(1);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
Usage: () => mockUsage, Usage: () => mockUsage,
}); });
...@@ -472,7 +472,7 @@ include ':app' ...@@ -472,7 +472,7 @@ include ':app'
expect(tempDir.childFile('settings_aar.gradle').existsSync(), isTrue); expect(tempDir.childFile('settings_aar.gradle').existsSync(), isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -505,7 +505,7 @@ include ':app' ...@@ -505,7 +505,7 @@ include ':app'
expect(tempDir.childFile('settings_aar.gradle').existsSync(), isTrue); expect(tempDir.childFile('settings_aar.gradle').existsSync(), isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
}); });
...@@ -517,7 +517,7 @@ include ':app' ...@@ -517,7 +517,7 @@ include ':app'
FileSystem fs; FileSystem fs;
setUp(() { setUp(() {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
mockArtifacts = MockLocalEngineArtifacts(); mockArtifacts = MockLocalEngineArtifacts();
mockProcessManager = MockProcessManager(); mockProcessManager = MockProcessManager();
android = fakePlatform('android'); android = fakePlatform('android');
...@@ -786,7 +786,7 @@ flutter: ...@@ -786,7 +786,7 @@ flutter:
FileSystem fs; FileSystem fs;
setUp(() { setUp(() {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
}); });
testUsingContext('returns true when the project is using AndroidX', () async { testUsingContext('returns true when the project is using AndroidX', () async {
...@@ -834,7 +834,7 @@ flutter: ...@@ -834,7 +834,7 @@ flutter:
MockAndroidSdk mockAndroidSdk; MockAndroidSdk mockAndroidSdk;
setUp(() { setUp(() {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
fakeProcessManager = FakeProcessManager.list(<FakeCommand>[]); fakeProcessManager = FakeProcessManager.list(<FakeCommand>[]);
mockAndroidSdk = MockAndroidSdk(); mockAndroidSdk = MockAndroidSdk();
when(mockAndroidSdk.directory).thenReturn('irrelevant'); when(mockAndroidSdk.directory).thenReturn('irrelevant');
...@@ -1013,7 +1013,7 @@ plugin1=${plugin1.path} ...@@ -1013,7 +1013,7 @@ plugin1=${plugin1.path}
setUp(() { setUp(() {
mockUsage = MockUsage(); mockUsage = MockUsage();
fileSystem = MemoryFileSystem(); fileSystem = MemoryFileSystem.test();
fileSystemUtils = MockFileSystemUtils(); fileSystemUtils = MockFileSystemUtils();
mockAndroidSdk = MockAndroidSdk(); mockAndroidSdk = MockAndroidSdk();
mockAndroidStudio = MockAndroidStudio(); mockAndroidStudio = MockAndroidStudio();
......
...@@ -22,7 +22,7 @@ void main() { ...@@ -22,7 +22,7 @@ void main() {
Directory gradleWrapperDirectory; Directory gradleWrapperDirectory;
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
tempDir = memoryFileSystem.systemTempDirectory.createTempSync('flutter_artifacts_test.'); tempDir = memoryFileSystem.systemTempDirectory.createTempSync('flutter_artifacts_test.');
gradleWrapperDirectory = memoryFileSystem.directory( gradleWrapperDirectory = memoryFileSystem.directory(
memoryFileSystem.path.join(tempDir.path, 'bin', 'cache', 'artifacts', 'gradle_wrapper')); memoryFileSystem.path.join(tempDir.path, 'bin', 'cache', 'artifacts', 'gradle_wrapper'));
...@@ -124,7 +124,7 @@ void main() { ...@@ -124,7 +124,7 @@ void main() {
MemoryFileSystem memoryFileSystem; MemoryFileSystem memoryFileSystem;
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
}); });
testUsingContext("throws ToolExit if gradle.properties doesn't exist", () { testUsingContext("throws ToolExit if gradle.properties doesn't exist", () {
...@@ -229,7 +229,7 @@ void main() { ...@@ -229,7 +229,7 @@ void main() {
MockGradleUtils gradleUtils; MockGradleUtils gradleUtils;
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
operatingSystemUtils = MockOperatingSystemUtils(); operatingSystemUtils = MockOperatingSystemUtils();
gradleUtils = MockGradleUtils(); gradleUtils = MockGradleUtils();
}); });
......
...@@ -51,7 +51,7 @@ void main() { ...@@ -51,7 +51,7 @@ void main() {
setUp(() async { setUp(() async {
sdk = MockitoAndroidSdk(); sdk = MockitoAndroidSdk();
mockProcessManager = MockitoProcessManager(); mockProcessManager = MockitoProcessManager();
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
mockCache = MockCache(); mockCache = MockCache();
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
when(sdk.licensesAvailable).thenReturn(true); when(sdk.licensesAvailable).thenReturn(true);
...@@ -217,7 +217,7 @@ void main() { ...@@ -217,7 +217,7 @@ void main() {
group('PrebuiltIOSApp', () { group('PrebuiltIOSApp', () {
MockOperatingSystemUtils os; MockOperatingSystemUtils os;
final Map<Type, Generator> overrides = <Type, Generator>{ final Map<Type, Generator> overrides = <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
PlistParser: () => MockPlistUtils(), PlistParser: () => MockPlistUtils(),
Platform: _kNoColorTerminalPlatform, Platform: _kNoColorTerminalPlatform,
...@@ -365,7 +365,7 @@ void main() { ...@@ -365,7 +365,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.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
Platform: _kNoColorTerminalPlatform, Platform: _kNoColorTerminalPlatform,
OperatingSystemUtils: () => MockOperatingSystemUtils(), OperatingSystemUtils: () => MockOperatingSystemUtils(),
......
...@@ -23,7 +23,7 @@ void main() { ...@@ -23,7 +23,7 @@ void main() {
Platform platform; Platform platform;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem(); fileSystem = MemoryFileSystem.test();
final Directory cacheRoot = fileSystem.directory('root') final Directory cacheRoot = fileSystem.directory('root')
..createSync(); ..createSync();
platform = FakePlatform(operatingSystem: 'linux'); platform = FakePlatform(operatingSystem: 'linux');
...@@ -110,7 +110,7 @@ void main() { ...@@ -110,7 +110,7 @@ void main() {
Platform platform; Platform platform;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem(); fileSystem = MemoryFileSystem.test();
final Directory cacheRoot = fileSystem.directory('root') final Directory cacheRoot = fileSystem.directory('root')
..createSync(); ..createSync();
platform = FakePlatform(operatingSystem: 'linux'); platform = FakePlatform(operatingSystem: 'linux');
......
...@@ -21,7 +21,7 @@ void main() { ...@@ -21,7 +21,7 @@ void main() {
FileSystemUtils fsUtils; FileSystemUtils fsUtils;
setUp(() { setUp(() {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
fsUtils = FileSystemUtils( fsUtils = FileSystemUtils(
fileSystem: fs, fileSystem: fs,
platform: FakePlatform(), platform: FakePlatform(),
...@@ -61,7 +61,7 @@ void main() { ...@@ -61,7 +61,7 @@ void main() {
/// Test file_systems.copyDirectorySync() using MemoryFileSystem. /// Test file_systems.copyDirectorySync() using MemoryFileSystem.
/// Copies between 2 instances of file systems which is also supported by copyDirectorySync(). /// Copies between 2 instances of file systems which is also supported by copyDirectorySync().
testWithoutContext('test directory copy', () async { testWithoutContext('test directory copy', () async {
final MemoryFileSystem sourceMemoryFs = MemoryFileSystem(); final MemoryFileSystem sourceMemoryFs = MemoryFileSystem.test();
const String sourcePath = '/some/origin'; const String sourcePath = '/some/origin';
final Directory sourceDirectory = await sourceMemoryFs.directory(sourcePath).create(recursive: true); final Directory sourceDirectory = await sourceMemoryFs.directory(sourcePath).create(recursive: true);
sourceMemoryFs.currentDirectory = sourcePath; sourceMemoryFs.currentDirectory = sourcePath;
...@@ -71,7 +71,7 @@ void main() { ...@@ -71,7 +71,7 @@ void main() {
sourceMemoryFs.directory('empty_directory').createSync(); sourceMemoryFs.directory('empty_directory').createSync();
// Copy to another memory file system instance. // Copy to another memory file system instance.
final MemoryFileSystem targetMemoryFs = MemoryFileSystem(); final MemoryFileSystem targetMemoryFs = MemoryFileSystem.test();
const String targetPath = '/some/non-existent/target'; const String targetPath = '/some/non-existent/target';
final Directory targetDirectory = targetMemoryFs.directory(targetPath); final Directory targetDirectory = targetMemoryFs.directory(targetPath);
...@@ -94,7 +94,7 @@ void main() { ...@@ -94,7 +94,7 @@ void main() {
}); });
testWithoutContext('Skip files if shouldCopyFile returns false', () { testWithoutContext('Skip files if shouldCopyFile returns false', () {
final MemoryFileSystem fileSystem = MemoryFileSystem(); final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final FileSystemUtils fsUtils = FileSystemUtils( final FileSystemUtils fsUtils = FileSystemUtils(
fileSystem: fileSystem, fileSystem: fileSystem,
platform: FakePlatform(), platform: FakePlatform(),
...@@ -122,7 +122,7 @@ void main() { ...@@ -122,7 +122,7 @@ void main() {
group('escapePath', () { group('escapePath', () {
testWithoutContext('on Windows', () { testWithoutContext('on Windows', () {
final MemoryFileSystem fileSystem = MemoryFileSystem(); final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final FileSystemUtils fsUtils = FileSystemUtils( final FileSystemUtils fsUtils = FileSystemUtils(
fileSystem: fileSystem, fileSystem: fileSystem,
platform: FakePlatform(operatingSystem: 'windows'), platform: FakePlatform(operatingSystem: 'windows'),
...@@ -133,7 +133,7 @@ void main() { ...@@ -133,7 +133,7 @@ void main() {
}); });
testWithoutContext('on Linux', () { testWithoutContext('on Linux', () {
final MemoryFileSystem fileSystem = MemoryFileSystem(); final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final FileSystemUtils fsUtils = FileSystemUtils( final FileSystemUtils fsUtils = FileSystemUtils(
fileSystem: fileSystem, fileSystem: fileSystem,
platform: FakePlatform(operatingSystem: 'linux'), platform: FakePlatform(operatingSystem: 'linux'),
......
...@@ -15,7 +15,7 @@ import '../../src/io.dart'; ...@@ -15,7 +15,7 @@ import '../../src/io.dart';
void main() { void main() {
test('IOOverrides can inject a memory file system', () async { test('IOOverrides can inject a memory file system', () async {
final MemoryFileSystem memoryFileSystem = MemoryFileSystem(); final MemoryFileSystem memoryFileSystem = MemoryFileSystem.test();
final FlutterIOOverrides flutterIOOverrides = FlutterIOOverrides(fileSystem: memoryFileSystem); final FlutterIOOverrides flutterIOOverrides = FlutterIOOverrides(fileSystem: memoryFileSystem);
await io.IOOverrides.runWithIOOverrides(() async { await io.IOOverrides.runWithIOOverrides(() async {
// statics delegate correctly. // statics delegate correctly.
......
...@@ -55,7 +55,7 @@ void main() { ...@@ -55,7 +55,7 @@ void main() {
testWithoutContext('fetchUrl(destFile) writes the data to a file', () async { testWithoutContext('fetchUrl(destFile) writes the data to a file', () async {
final Net net = createNet(FakeHttpClient(200, data: responseString)); final Net net = createNet(FakeHttpClient(200, data: responseString));
final MemoryFileSystem fs = MemoryFileSystem(); final MemoryFileSystem fs = MemoryFileSystem.test();
final File destFile = fs.file('dest_file')..createSync(); final File destFile = fs.file('dest_file')..createSync();
final List<int> data = await net.fetchUrl( final List<int> data = await net.fetchUrl(
Uri.parse('http://example.invalid/'), Uri.parse('http://example.invalid/'),
......
...@@ -29,7 +29,7 @@ void main() { ...@@ -29,7 +29,7 @@ void main() {
OperatingSystemUtils createOSUtils(Platform platform) { OperatingSystemUtils createOSUtils(Platform platform) {
return OperatingSystemUtils( return OperatingSystemUtils(
fileSystem: MemoryFileSystem(), fileSystem: MemoryFileSystem.test(),
logger: BufferLogger.test(), logger: BufferLogger.test(),
platform: platform, platform: platform,
processManager: mockProcessManager, processManager: mockProcessManager,
......
...@@ -90,7 +90,7 @@ void main() { ...@@ -90,7 +90,7 @@ void main() {
mockProcessManager = MockProcessManager(); mockProcessManager = MockProcessManager();
fontSubsetProcess = MockProcess(); fontSubsetProcess = MockProcess();
mockArtifacts = MockArtifacts(); mockArtifacts = MockArtifacts();
fileSystem = MemoryFileSystem(); fileSystem = MemoryFileSystem.test();
logger = BufferLogger( logger = BufferLogger(
terminal: AnsiTerminal( terminal: AnsiTerminal(
stdio: mocks.MockStdio(), stdio: mocks.MockStdio(),
......
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
setUp(() { setUp(() {
mockFileSystem = MockFileSystem(); mockFileSystem = MockFileSystem();
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
mockFile = MockFile(); mockFile = MockFile();
mockRandomAccessFile = MockRandomAccessFile(); mockRandomAccessFile = MockRandomAccessFile();
when(mockFileSystem.path).thenReturn(memoryFileSystem.path); when(mockFileSystem.path).thenReturn(memoryFileSystem.path);
...@@ -89,7 +89,7 @@ void main() { ...@@ -89,7 +89,7 @@ void main() {
setUp(() { setUp(() {
mockCache = MockCache(); mockCache = MockCache();
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
}); });
testUsingContext('Continues on failed stamp file update', () async { testUsingContext('Continues on failed stamp file update', () async {
...@@ -247,9 +247,9 @@ void main() { ...@@ -247,9 +247,9 @@ void main() {
}); });
testWithoutContext('flattenNameSubdirs', () { testWithoutContext('flattenNameSubdirs', () {
expect(flattenNameSubdirs(Uri.parse('http://flutter.dev/foo/bar'), MemoryFileSystem()), 'flutter.dev/foo/bar'); expect(flattenNameSubdirs(Uri.parse('http://flutter.dev/foo/bar'), MemoryFileSystem.test()), 'flutter.dev/foo/bar');
expect(flattenNameSubdirs(Uri.parse('http://docs.flutter.io/foo/bar'), MemoryFileSystem()), 'docs.flutter.io/foo/bar'); expect(flattenNameSubdirs(Uri.parse('http://docs.flutter.io/foo/bar'), MemoryFileSystem.test()), 'docs.flutter.io/foo/bar');
expect(flattenNameSubdirs(Uri.parse('https://www.flutter.dev'), MemoryFileSystem()), 'www.flutter.dev'); expect(flattenNameSubdirs(Uri.parse('https://www.flutter.dev'), MemoryFileSystem.test()), 'www.flutter.dev');
}); });
group('EngineCachedArtifact', () { group('EngineCachedArtifact', () {
...@@ -303,7 +303,7 @@ void main() { ...@@ -303,7 +303,7 @@ void main() {
MockCache mockCache; MockCache mockCache;
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
processManager = MockProcessManager(); processManager = MockProcessManager();
mockCache = MockCache(); mockCache = MockCache();
}); });
...@@ -372,7 +372,7 @@ void main() { ...@@ -372,7 +372,7 @@ void main() {
expect(iosUsbArtifacts.isUpToDateInner(), false); expect(iosUsbArtifacts.isUpToDateInner(), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: () => mockCache, Cache: () => mockCache,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -390,7 +390,7 @@ void main() { ...@@ -390,7 +390,7 @@ void main() {
expect(iosUsbArtifacts.isUpToDateInner(), false); expect(iosUsbArtifacts.isUpToDateInner(), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: () => mockCache, Cache: () => mockCache,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -402,7 +402,7 @@ void main() { ...@@ -402,7 +402,7 @@ void main() {
expect(iosUsbArtifacts.isUpToDateInner(), true); expect(iosUsbArtifacts.isUpToDateInner(), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: () => mockCache, Cache: () => mockCache,
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
......
...@@ -254,7 +254,7 @@ void main() { ...@@ -254,7 +254,7 @@ void main() {
environment: anyNamed('environment'), environment: anyNamed('environment'),
)).called(1); )).called(1);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
}); });
...@@ -307,7 +307,7 @@ void main() { ...@@ -307,7 +307,7 @@ void main() {
); );
expect(testLogger.errorText, hasLength(0)); expect(testLogger.errorText, hasLength(0));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
}); });
...@@ -368,7 +368,7 @@ void main() { ...@@ -368,7 +368,7 @@ void main() {
expect(testLogger.errorText, hasLength(0)); expect(testLogger.errorText, hasLength(0));
expect(versionCheckFile.existsSync(), isFalse); expect(versionCheckFile.existsSync(), isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
}); });
}); });
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.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/build_info.dart'; import 'package:flutter_tools/src/build_info.dart';
...@@ -94,7 +95,7 @@ void main() { ...@@ -94,7 +95,7 @@ void main() {
route: anyNamed('route') route: anyNamed('route')
)).thenAnswer((Invocation invocation) => Future<int>.value(1)); )).thenAnswer((Invocation invocation) => Future<int>.value(1));
final List<FlutterDevice> devices = <FlutterDevice>[mockFlutterDevice]; final List<FlutterDevice> devices = <FlutterDevice>[mockFlutterDevice];
final MockFile applicationBinary = MockFile(); final File applicationBinary = MemoryFileSystem.test().file('binary');
final int result = await ColdRunner( final int result = await ColdRunner(
devices, devices,
applicationBinary: applicationBinary, applicationBinary: applicationBinary,
...@@ -110,7 +111,6 @@ void main() { ...@@ -110,7 +111,6 @@ void main() {
}); });
} }
class MockFile extends Mock implements File {}
class MockFlutterDevice extends Mock implements FlutterDevice {} class MockFlutterDevice extends Mock implements FlutterDevice {}
class MockDevice extends Mock implements Device { class MockDevice extends Mock implements Device {
MockDevice() { MockDevice() {
......
...@@ -19,7 +19,7 @@ void main() { ...@@ -19,7 +19,7 @@ void main() {
FakePlatform fakePlatform; FakePlatform fakePlatform;
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
fakePlatform = FakePlatform( fakePlatform = FakePlatform(
operatingSystem: 'linux', operatingSystem: 'linux',
environment: <String, String>{ environment: <String, String>{
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/application_package.dart'; import 'package:flutter_tools/src/application_package.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/file_system.dart';
...@@ -74,10 +75,6 @@ class NullExecutableDesktopDevice extends FakeDesktopDevice { ...@@ -74,10 +75,6 @@ class NullExecutableDesktopDevice extends FakeDesktopDevice {
class MockAppplicationPackage extends Mock implements ApplicationPackage {} class MockAppplicationPackage extends Mock implements ApplicationPackage {}
class MockFileSystem extends Mock implements FileSystem {}
class MockFile extends Mock implements File {}
class MockProcessManager extends Mock implements ProcessManager {} class MockProcessManager extends Mock implements ProcessManager {}
void main() { void main() {
...@@ -122,16 +119,14 @@ void main() { ...@@ -122,16 +119,14 @@ void main() {
}); });
group('Starting and stopping application', () { group('Starting and stopping application', () {
final MockFileSystem mockFileSystem = MockFileSystem(); final FileSystem memoryFileSystem = MemoryFileSystem.test();
final MockProcessManager mockProcessManager = MockProcessManager(); final MockProcessManager mockProcessManager = MockProcessManager();
// Configures mock environment so that startApp will be able to find and // Configures mock environment so that startApp will be able to find and
// run an FakeDesktopDevice exectuable with for the given mode. // run an FakeDesktopDevice exectuable with for the given mode.
void setUpMockExecutable(FakeDesktopDevice device, BuildMode mode, {Future<int> exitFuture}) { void setUpMockExecutable(FakeDesktopDevice device, BuildMode mode, {Future<int> exitFuture}) {
final String executableName = device.executablePathForDevice(null, mode); final String executableName = device.executablePathForDevice(null, mode);
final MockFile mockFile = MockFile(); memoryFileSystem.file(executableName).writeAsStringSync('\n');
when(mockFileSystem.file(executableName)).thenReturn(mockFile);
when(mockFile.existsSync()).thenReturn(true);
when(mockProcessManager.start(<String>[executableName])).thenAnswer((Invocation invocation) async { when(mockProcessManager.start(<String>[executableName])).thenAnswer((Invocation invocation) async {
return FakeProcess( return FakeProcess(
exitCode: Completer<int>().future, exitCode: Completer<int>().future,
...@@ -160,7 +155,7 @@ void main() { ...@@ -160,7 +155,7 @@ void main() {
expect(result.started, true); expect(result.started, true);
expect(result.observatoryUri, Uri.parse('http://127.0.0.1/0')); expect(result.observatoryUri, Uri.parse('http://127.0.0.1/0'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => mockFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
}); });
...@@ -180,7 +175,7 @@ void main() { ...@@ -180,7 +175,7 @@ void main() {
expect(result.started, true); expect(result.started, true);
expect(await device.stopApp(package), true); expect(await device.stopApp(package), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => mockFileSystem, FileSystem: () => memoryFileSystem,
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
}); });
}); });
......
...@@ -60,13 +60,11 @@ final vm_service.Isolate fakeIsolate = vm_service.Isolate( ...@@ -60,13 +60,11 @@ final vm_service.Isolate fakeIsolate = vm_service.Isolate(
void main() { void main() {
group('fuchsia device', () { group('fuchsia device', () {
MemoryFileSystem memoryFileSystem; MemoryFileSystem memoryFileSystem;
MockFile sshConfig; File sshConfig;
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
sshConfig = MockFile(); sshConfig = memoryFileSystem.file('ssh_config')..writeAsStringSync('\n');
when(sshConfig.existsSync()).thenReturn(true);
when(sshConfig.absolute).thenReturn(sshConfig);
}); });
testWithoutContext('stores the requested id and name', () { testWithoutContext('stores the requested id and name', () {
...@@ -293,14 +291,14 @@ void main() { ...@@ -293,14 +291,14 @@ void main() {
group('displays friendly error when', () { group('displays friendly error when', () {
MockProcessManager mockProcessManager; MockProcessManager mockProcessManager;
MockProcessResult mockProcessResult; MockProcessResult mockProcessResult;
MockFile mockFile; File artifactFile;
MockProcessManager emptyStdoutProcessManager; MockProcessManager emptyStdoutProcessManager;
MockProcessResult emptyStdoutProcessResult; MockProcessResult emptyStdoutProcessResult;
setUp(() { setUp(() {
mockProcessManager = MockProcessManager(); mockProcessManager = MockProcessManager();
mockProcessResult = MockProcessResult(); mockProcessResult = MockProcessResult();
mockFile = MockFile(); artifactFile = MemoryFileSystem.test().file('artifact');
when(mockProcessManager.run( when(mockProcessManager.run(
any, any,
environment: anyNamed('environment'), environment: anyNamed('environment'),
...@@ -310,8 +308,6 @@ void main() { ...@@ -310,8 +308,6 @@ void main() {
when(mockProcessResult.exitCode).thenReturn(1); when(mockProcessResult.exitCode).thenReturn(1);
when<String>(mockProcessResult.stdout as String).thenReturn(''); when<String>(mockProcessResult.stdout as String).thenReturn('');
when<String>(mockProcessResult.stderr as String).thenReturn(''); when<String>(mockProcessResult.stderr as String).thenReturn('');
when(mockFile.absolute).thenReturn(mockFile);
when(mockFile.path).thenReturn('');
emptyStdoutProcessManager = MockProcessManager(); emptyStdoutProcessManager = MockProcessManager();
emptyStdoutProcessResult = MockProcessResult(); emptyStdoutProcessResult = MockProcessResult();
...@@ -341,8 +337,8 @@ void main() { ...@@ -341,8 +337,8 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => emptyStdoutProcessManager, ProcessManager: () => emptyStdoutProcessManager,
FuchsiaArtifacts: () => FuchsiaArtifacts( FuchsiaArtifacts: () => FuchsiaArtifacts(
sshConfig: mockFile, sshConfig: artifactFile,
devFinder: mockFile, devFinder: artifactFile,
), ),
FuchsiaSdk: () => MockFuchsiaSdk(), FuchsiaSdk: () => MockFuchsiaSdk(),
}); });
...@@ -362,8 +358,8 @@ void main() { ...@@ -362,8 +358,8 @@ void main() {
Completer<int> exitCode; Completer<int> exitCode;
StreamController<List<int>> stdout; StreamController<List<int>> stdout;
StreamController<List<int>> stderr; StreamController<List<int>> stderr;
MockFile devFinder; File devFinder;
MockFile sshConfig; File sshConfig;
setUp(() { setUp(() {
mockProcessManager = MockProcessManager(); mockProcessManager = MockProcessManager();
...@@ -376,12 +372,9 @@ void main() { ...@@ -376,12 +372,9 @@ void main() {
when(mockProcess.exitCode).thenAnswer((Invocation _) => exitCode.future); when(mockProcess.exitCode).thenAnswer((Invocation _) => exitCode.future);
when(mockProcess.stdout).thenAnswer((Invocation _) => stdout.stream); when(mockProcess.stdout).thenAnswer((Invocation _) => stdout.stream);
when(mockProcess.stderr).thenAnswer((Invocation _) => stderr.stream); when(mockProcess.stderr).thenAnswer((Invocation _) => stderr.stream);
devFinder = MockFile(); final FileSystem memoryFileSystem = MemoryFileSystem.test();
sshConfig = MockFile(); devFinder = memoryFileSystem.file('device-finder')..writeAsStringSync('\n');
when(devFinder.existsSync()).thenReturn(true); sshConfig = memoryFileSystem.file('ssh_config')..writeAsStringSync('\n');
when(sshConfig.existsSync()).thenReturn(true);
when(devFinder.absolute).thenReturn(devFinder);
when(sshConfig.absolute).thenReturn(sshConfig);
}); });
tearDown(() { tearDown(() {
...@@ -700,15 +693,11 @@ void main() { ...@@ -700,15 +693,11 @@ void main() {
group('portForwarder', () { group('portForwarder', () {
MockProcessManager mockProcessManager; MockProcessManager mockProcessManager;
MockFile sshConfig; File sshConfig;
setUp(() { setUp(() {
mockProcessManager = MockProcessManager(); mockProcessManager = MockProcessManager();
sshConfig = MemoryFileSystem.test().file('irrelevant')..writeAsStringSync('\n');
sshConfig = MockFile();
when(sshConfig.path).thenReturn('irrelevant');
when(sshConfig.existsSync()).thenReturn(true);
when(sshConfig.absolute).thenReturn(sshConfig);
}); });
testUsingContext('`unforward` prints stdout and stderr if ssh command failed', () async { testUsingContext('`unforward` prints stdout and stderr if ssh command failed', () async {
...@@ -721,7 +710,7 @@ void main() { ...@@ -721,7 +710,7 @@ void main() {
when(mockProcessManager.run(<String>[ when(mockProcessManager.run(<String>[
'ssh', 'ssh',
'-F', '-F',
'irrelevant', sshConfig.absolute.path,
'-O', '-O',
'cancel', 'cancel',
'-vvv', '-vvv',
...@@ -890,7 +879,7 @@ void main() { ...@@ -890,7 +879,7 @@ void main() {
File runner; File runner;
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
osUtils = FakeOperatingSystemUtils(); osUtils = FakeOperatingSystemUtils();
fuchsiaDeviceTools = FakeFuchsiaDeviceTools(); fuchsiaDeviceTools = FakeFuchsiaDeviceTools();
fuchsiaSdk = MockFuchsiaSdk(); fuchsiaSdk = MockFuchsiaSdk();
...@@ -1105,7 +1094,7 @@ void main() { ...@@ -1105,7 +1094,7 @@ void main() {
}); });
group('sdkNameAndVersion: ', () { group('sdkNameAndVersion: ', () {
MockFile sshConfig; File sshConfig;
MockProcessManager mockSuccessProcessManager; MockProcessManager mockSuccessProcessManager;
MockProcessResult mockSuccessProcessResult; MockProcessResult mockSuccessProcessResult;
MockProcessManager mockFailureProcessManager; MockProcessManager mockFailureProcessManager;
...@@ -1114,9 +1103,7 @@ void main() { ...@@ -1114,9 +1103,7 @@ void main() {
MockProcessResult emptyStdoutProcessResult; MockProcessResult emptyStdoutProcessResult;
setUp(() { setUp(() {
sshConfig = MockFile(); sshConfig = MemoryFileSystem.test().file('ssh_config')..writeAsStringSync('\n');
when(sshConfig.existsSync()).thenReturn(true);
when(sshConfig.absolute).thenReturn(sshConfig);
mockSuccessProcessManager = MockProcessManager(); mockSuccessProcessManager = MockProcessManager();
mockSuccessProcessResult = MockProcessResult(); mockSuccessProcessResult = MockProcessResult();
...@@ -1196,8 +1183,6 @@ class MockProcessManager extends Mock implements ProcessManager {} ...@@ -1196,8 +1183,6 @@ class MockProcessManager extends Mock implements ProcessManager {}
class MockProcessResult extends Mock implements ProcessResult {} class MockProcessResult extends Mock implements ProcessResult {}
class MockFile extends Mock implements File {}
class MockProcess extends Mock implements Process {} class MockProcess extends Mock implements Process {}
Process _createMockProcess({ Process _createMockProcess({
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:file/memory.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/file_system.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
...@@ -16,13 +17,12 @@ import '../../src/mocks.dart'; ...@@ -16,13 +17,12 @@ import '../../src/mocks.dart';
void main() { void main() {
group('FuchsiaPM', () { group('FuchsiaPM', () {
MockFile pm; File pm;
MockProcessManager mockProcessManager; MockProcessManager mockProcessManager;
MockFuchsiaArtifacts mockFuchsiaArtifacts; MockFuchsiaArtifacts mockFuchsiaArtifacts;
setUp(() { setUp(() {
pm = MockFile(); pm = MemoryFileSystem.test().file('pm');
when(pm.path).thenReturn('pm');
mockFuchsiaArtifacts = MockFuchsiaArtifacts(); mockFuchsiaArtifacts = MockFuchsiaArtifacts();
when(mockFuchsiaArtifacts.pm).thenReturn(pm); when(mockFuchsiaArtifacts.pm).thenReturn(pm);
...@@ -74,6 +74,5 @@ void main() { ...@@ -74,6 +74,5 @@ void main() {
class MockFuchsiaArtifacts extends Mock implements FuchsiaArtifacts {} class MockFuchsiaArtifacts extends Mock implements FuchsiaArtifacts {}
class MockProcessUtils extends Mock implements ProcessUtils {} class MockProcessUtils extends Mock implements ProcessUtils {}
class MockFile extends Mock implements File {}
class MockProcess extends Mock implements Process {} class MockProcess extends Mock implements Process {}
class MockProcessManager extends Mock implements ProcessManager {} class MockProcessManager extends Mock implements ProcessManager {}
...@@ -21,7 +21,7 @@ void main() { ...@@ -21,7 +21,7 @@ void main() {
FileSystem fs; FileSystem fs;
setUp(() { setUp(() {
logger = BufferLogger.test(); logger = BufferLogger.test();
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
}); });
group('GitHub template creator', () { group('GitHub template creator', () {
...@@ -170,7 +170,7 @@ void main() { ...@@ -170,7 +170,7 @@ void main() {
_kShortURL _kShortURL
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -196,7 +196,7 @@ void main() { ...@@ -196,7 +196,7 @@ void main() {
); );
expect(logger.traceText, contains('Failed to shorten GitHub template URL')); expect(logger.traceText, contains('Failed to shorten GitHub template URL'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
......
...@@ -42,7 +42,7 @@ void main() { ...@@ -42,7 +42,7 @@ void main() {
Logger logger; Logger logger;
IOSDeploy iosDeploy; IOSDeploy iosDeploy;
IMobileDevice iMobileDevice; IMobileDevice iMobileDevice;
FileSystem mockFileSystem; FileSystem nullFileSystem;
setUp(() { setUp(() {
mockArtifacts = MockArtifacts(); mockArtifacts = MockArtifacts();
...@@ -70,7 +70,7 @@ void main() { ...@@ -70,7 +70,7 @@ void main() {
IOSDevice( IOSDevice(
'device-123', 'device-123',
iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()),
fileSystem: mockFileSystem, fileSystem: nullFileSystem,
logger: logger, logger: logger,
platform: macPlatform, platform: macPlatform,
iosDeploy: iosDeploy, iosDeploy: iosDeploy,
...@@ -87,7 +87,7 @@ void main() { ...@@ -87,7 +87,7 @@ void main() {
expect(IOSDevice( expect(IOSDevice(
'device-123', 'device-123',
iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()),
fileSystem: mockFileSystem, fileSystem: nullFileSystem,
logger: logger, logger: logger,
platform: macPlatform, platform: macPlatform,
iosDeploy: iosDeploy, iosDeploy: iosDeploy,
...@@ -101,7 +101,7 @@ void main() { ...@@ -101,7 +101,7 @@ void main() {
expect(IOSDevice( expect(IOSDevice(
'device-123', 'device-123',
iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()),
fileSystem: mockFileSystem, fileSystem: nullFileSystem,
logger: logger, logger: logger,
platform: macPlatform, platform: macPlatform,
iosDeploy: iosDeploy, iosDeploy: iosDeploy,
...@@ -115,7 +115,7 @@ void main() { ...@@ -115,7 +115,7 @@ void main() {
expect(IOSDevice( expect(IOSDevice(
'device-123', 'device-123',
iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()),
fileSystem: mockFileSystem, fileSystem: nullFileSystem,
logger: logger, logger: logger,
platform: macPlatform, platform: macPlatform,
iosDeploy: iosDeploy, iosDeploy: iosDeploy,
...@@ -129,7 +129,7 @@ void main() { ...@@ -129,7 +129,7 @@ void main() {
expect(IOSDevice( expect(IOSDevice(
'device-123', 'device-123',
iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()),
fileSystem: mockFileSystem, fileSystem: nullFileSystem,
logger: logger, logger: logger,
platform: macPlatform, platform: macPlatform,
iosDeploy: iosDeploy, iosDeploy: iosDeploy,
...@@ -143,7 +143,7 @@ void main() { ...@@ -143,7 +143,7 @@ void main() {
expect(IOSDevice( expect(IOSDevice(
'device-123', 'device-123',
iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()),
fileSystem: mockFileSystem, fileSystem: nullFileSystem,
logger: logger, logger: logger,
platform: macPlatform, platform: macPlatform,
iosDeploy: iosDeploy, iosDeploy: iosDeploy,
...@@ -160,7 +160,7 @@ void main() { ...@@ -160,7 +160,7 @@ void main() {
final IOSDevice device = IOSDevice( final IOSDevice device = IOSDevice(
'device-123', 'device-123',
iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()),
fileSystem: mockFileSystem, fileSystem: nullFileSystem,
logger: logger, logger: logger,
platform: macPlatform, platform: macPlatform,
iosDeploy: iosDeploy, iosDeploy: iosDeploy,
...@@ -185,7 +185,7 @@ void main() { ...@@ -185,7 +185,7 @@ void main() {
IOSDevice( IOSDevice(
'device-123', 'device-123',
iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()),
fileSystem: mockFileSystem, fileSystem: nullFileSystem,
logger: logger, logger: logger,
platform: platform, platform: platform,
iosDeploy: iosDeploy, iosDeploy: iosDeploy,
...@@ -217,7 +217,7 @@ void main() { ...@@ -217,7 +217,7 @@ void main() {
MockCache mockCache; MockCache mockCache;
Logger logger; Logger logger;
IOSDeploy iosDeploy; IOSDeploy iosDeploy;
FileSystem mockFileSystem; FileSystem nullFileSystem;
IProxy iproxy; IProxy iproxy;
IOSDevicePortForwarder createPortForwarder( IOSDevicePortForwarder createPortForwarder(
...@@ -228,7 +228,7 @@ void main() { ...@@ -228,7 +228,7 @@ void main() {
id: device.id, id: device.id,
logger: logger, logger: logger,
operatingSystemUtils: OperatingSystemUtils( operatingSystemUtils: OperatingSystemUtils(
fileSystem: mockFileSystem, fileSystem: nullFileSystem,
logger: logger, logger: logger,
platform: FakePlatform(operatingSystem: 'macos'), platform: FakePlatform(operatingSystem: 'macos'),
processManager: FakeProcessManager.any(), processManager: FakeProcessManager.any(),
...@@ -276,7 +276,7 @@ void main() { ...@@ -276,7 +276,7 @@ void main() {
device = IOSDevice( device = IOSDevice(
'123', '123',
iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()),
fileSystem: mockFileSystem, fileSystem: nullFileSystem,
logger: logger, logger: logger,
platform: macPlatform, platform: macPlatform,
iosDeploy: iosDeploy, iosDeploy: iosDeploy,
......
...@@ -46,7 +46,7 @@ void main () { ...@@ -46,7 +46,7 @@ void main () {
MockXcode mockXcode; MockXcode mockXcode;
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
mockXcode = MockXcode(); mockXcode = MockXcode();
xcodeProjectInfoFile = memoryFileSystem.file('project.pbxproj'); xcodeProjectInfoFile = memoryFileSystem.file('project.pbxproj');
...@@ -265,7 +265,7 @@ keep this 2 ...@@ -265,7 +265,7 @@ keep this 2
File xcodeWorkspaceSharedSettings; File xcodeWorkspaceSharedSettings;
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
xcodeWorkspaceSharedSettings = memoryFileSystem.file('WorkspaceSettings.xcsettings'); xcodeWorkspaceSharedSettings = memoryFileSystem.file('WorkspaceSettings.xcsettings');
testLogger = BufferLogger( testLogger = BufferLogger(
...@@ -345,7 +345,7 @@ keep this 2 ...@@ -345,7 +345,7 @@ keep this 2
File xcodeProjectInfoFile; File xcodeProjectInfoFile;
setUp(() { setUp(() {
memoryFileSystem = MemoryFileSystem(); memoryFileSystem = MemoryFileSystem.test();
xcodeProjectInfoFile = memoryFileSystem.file('project.pbxproj'); xcodeProjectInfoFile = memoryFileSystem.file('project.pbxproj');
testLogger = BufferLogger( testLogger = BufferLogger(
......
...@@ -31,7 +31,6 @@ final Map<Type, Generator> noColorTerminalOverride = <Type, Generator>{ ...@@ -31,7 +31,6 @@ final Map<Type, Generator> noColorTerminalOverride = <Type, Generator>{
class MockArtifacts extends Mock implements Artifacts {} class MockArtifacts extends Mock implements Artifacts {}
class MockCache extends Mock implements Cache {} class MockCache extends Mock implements Cache {}
class MockProcessManager extends Mock implements ProcessManager {} class MockProcessManager extends Mock implements ProcessManager {}
class MockFile extends Mock implements File {}
class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter {} class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter {}
class MockIosProject extends Mock implements IosProject {} class MockIosProject extends Mock implements IosProject {}
...@@ -58,21 +57,18 @@ void main() { ...@@ -58,21 +57,18 @@ void main() {
}); });
group('screenshot', () { group('screenshot', () {
final String outputPath = globals.fs.path.join('some', 'test', 'path', 'image.png');
MockProcessManager mockProcessManager; MockProcessManager mockProcessManager;
MockFile mockOutputFile; File outputFile;
setUp(() { setUp(() {
mockProcessManager = MockProcessManager(); mockProcessManager = MockProcessManager();
mockOutputFile = MockFile(); outputFile = MemoryFileSystem.test().file('image.png');
when(mockArtifacts.getArtifactPath(Artifact.idevicescreenshot, platform: anyNamed('platform'))).thenReturn(idevicescreenshotPath); when(mockArtifacts.getArtifactPath(Artifact.idevicescreenshot, platform: anyNamed('platform'))).thenReturn(idevicescreenshotPath);
}); });
testWithoutContext('error if idevicescreenshot is not installed', () async { testWithoutContext('error if idevicescreenshot is not installed', () async {
when(mockOutputFile.path).thenReturn(outputPath);
// Let `idevicescreenshot` fail with exit code 1. // Let `idevicescreenshot` fail with exit code 1.
when(mockProcessManager.run(<String>[idevicescreenshotPath, outputPath], when(mockProcessManager.run(<String>[idevicescreenshotPath, outputFile.path],
environment: <String, String>{'DYLD_LIBRARY_PATH': libimobiledevicePath}, environment: <String, String>{'DYLD_LIBRARY_PATH': libimobiledevicePath},
workingDirectory: null, workingDirectory: null,
)).thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(4, 1, '', ''))); )).thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(4, 1, '', '')));
...@@ -85,14 +81,13 @@ void main() { ...@@ -85,14 +81,13 @@ void main() {
); );
expect(() async => await iMobileDevice.takeScreenshot( expect(() async => await iMobileDevice.takeScreenshot(
mockOutputFile, outputFile,
'1234', '1234',
IOSDeviceInterface.usb, IOSDeviceInterface.usb,
), throwsA(anything)); ), throwsA(anything));
}); });
testWithoutContext('idevicescreenshot captures and returns USB screenshot', () async { testWithoutContext('idevicescreenshot captures and returns USB screenshot', () async {
when(mockOutputFile.path).thenReturn(outputPath);
when(mockProcessManager.run(any, environment: anyNamed('environment'), workingDirectory: null)).thenAnswer( when(mockProcessManager.run(any, environment: anyNamed('environment'), workingDirectory: null)).thenAnswer(
(Invocation invocation) => Future<ProcessResult>.value(ProcessResult(4, 0, '', ''))); (Invocation invocation) => Future<ProcessResult>.value(ProcessResult(4, 0, '', '')));
...@@ -104,18 +99,17 @@ void main() { ...@@ -104,18 +99,17 @@ void main() {
); );
await iMobileDevice.takeScreenshot( await iMobileDevice.takeScreenshot(
mockOutputFile, outputFile,
'1234', '1234',
IOSDeviceInterface.usb, IOSDeviceInterface.usb,
); );
verify(mockProcessManager.run(<String>[idevicescreenshotPath, outputPath, '--udid', '1234'], verify(mockProcessManager.run(<String>[idevicescreenshotPath, outputFile.path, '--udid', '1234'],
environment: <String, String>{'DYLD_LIBRARY_PATH': libimobiledevicePath}, environment: <String, String>{'DYLD_LIBRARY_PATH': libimobiledevicePath},
workingDirectory: null, workingDirectory: null,
)); ));
}); });
testWithoutContext('idevicescreenshot captures and returns network screenshot', () async { testWithoutContext('idevicescreenshot captures and returns network screenshot', () async {
when(mockOutputFile.path).thenReturn(outputPath);
when(mockProcessManager.run(any, environment: anyNamed('environment'), workingDirectory: null)).thenAnswer( when(mockProcessManager.run(any, environment: anyNamed('environment'), workingDirectory: null)).thenAnswer(
(Invocation invocation) => Future<ProcessResult>.value(ProcessResult(4, 0, '', ''))); (Invocation invocation) => Future<ProcessResult>.value(ProcessResult(4, 0, '', '')));
...@@ -127,11 +121,11 @@ void main() { ...@@ -127,11 +121,11 @@ void main() {
); );
await iMobileDevice.takeScreenshot( await iMobileDevice.takeScreenshot(
mockOutputFile, outputFile,
'1234', '1234',
IOSDeviceInterface.network, IOSDeviceInterface.network,
); );
verify(mockProcessManager.run(<String>[idevicescreenshotPath, outputPath, '--udid', '1234', '--network'], verify(mockProcessManager.run(<String>[idevicescreenshotPath, outputFile.path, '--udid', '1234', '--network'],
environment: <String, String>{'DYLD_LIBRARY_PATH': libimobiledevicePath}, environment: <String, String>{'DYLD_LIBRARY_PATH': libimobiledevicePath},
workingDirectory: null, workingDirectory: null,
)); ));
...@@ -403,33 +397,27 @@ Exited (sigterm)''', ...@@ -403,33 +397,27 @@ Exited (sigterm)''',
}); });
group('Upgrades project.pbxproj for old asset usage', () { group('Upgrades project.pbxproj for old asset usage', () {
const List<String> flutterAssetPbxProjLines = <String>[ const String flutterAssetPbxProjLines =
'/* flutter_assets */', '/* flutter_assets */\n'
'/* App.framework', '/* App.framework\n'
'another line', 'another line';
];
const String appFlxPbxProjLines =
const List<String> appFlxPbxProjLines = <String>[ '/* app.flx\n'
'/* app.flx', '/* App.framework\n'
'/* App.framework', 'another line';
'another line',
]; const String cleanPbxProjLines =
'/* App.framework\n'
const List<String> cleanPbxProjLines = <String>[ 'another line';
'/* App.framework',
'another line',
];
testWithoutContext('upgradePbxProjWithFlutterAssets', () async { testWithoutContext('upgradePbxProjWithFlutterAssets', () async {
final MockIosProject project = MockIosProject(); final MockIosProject project = MockIosProject();
final MockFile pbxprojFile = MockFile(); final File pbxprojFile = MemoryFileSystem.test().file('project.pbxproj')
..writeAsStringSync(flutterAssetPbxProjLines);
when(project.xcodeProjectInfoFile).thenReturn(pbxprojFile); when(project.xcodeProjectInfoFile).thenReturn(pbxprojFile);
when(project.hostAppBundleName(any)).thenAnswer((_) => Future<String>.value('UnitTestRunner.app')); when(project.hostAppBundleName(any)).thenAnswer((_) => Future<String>.value('UnitTestRunner.app'));
when(pbxprojFile.readAsLinesSync())
.thenAnswer((_) => flutterAssetPbxProjLines);
when(pbxprojFile.existsSync())
.thenAnswer((_) => true);
bool result = upgradePbxProjWithFlutterAssets(project, logger); bool result = upgradePbxProjWithFlutterAssets(project, logger);
expect(result, true); expect(result, true);
...@@ -439,8 +427,7 @@ Exited (sigterm)''', ...@@ -439,8 +427,7 @@ Exited (sigterm)''',
); );
logger.clear(); logger.clear();
when(pbxprojFile.readAsLinesSync()) pbxprojFile.writeAsStringSync(appFlxPbxProjLines);
.thenAnswer((_) => appFlxPbxProjLines);
result = upgradePbxProjWithFlutterAssets(project, logger); result = upgradePbxProjWithFlutterAssets(project, logger);
expect(result, true); expect(result, true);
expect( expect(
...@@ -449,8 +436,7 @@ Exited (sigterm)''', ...@@ -449,8 +436,7 @@ Exited (sigterm)''',
); );
logger.clear(); logger.clear();
when(pbxprojFile.readAsLinesSync()) pbxprojFile.writeAsStringSync(cleanPbxProjLines);
.thenAnswer((_) => cleanPbxProjLines);
result = upgradePbxProjWithFlutterAssets(project, logger); result = upgradePbxProjWithFlutterAssets(project, logger);
expect(result, true); expect(result, true);
expect( expect(
......
...@@ -27,7 +27,6 @@ import '../../src/common.dart'; ...@@ -27,7 +27,6 @@ import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/mocks.dart'; import '../../src/mocks.dart';
class MockFile extends Mock implements File {}
class MockIMobileDevice extends Mock implements IMobileDevice {} class MockIMobileDevice extends Mock implements IMobileDevice {}
class MockLogger extends Mock implements Logger {} class MockLogger extends Mock implements Logger {}
class MockProcess extends Mock implements Process {} class MockProcess extends Mock implements Process {}
...@@ -376,8 +375,6 @@ void main() { ...@@ -376,8 +375,6 @@ void main() {
MockLogger mockLogger; MockLogger mockLogger;
MockProcessManager mockProcessManager; MockProcessManager mockProcessManager;
IOSSimulator deviceUnderTest; IOSSimulator deviceUnderTest;
// only used for fs.path.join()
final FileSystem fs = globals.fs;
setUp(() { setUp(() {
mockXcode = MockXcode(); mockXcode = MockXcode();
...@@ -415,9 +412,8 @@ void main() { ...@@ -415,9 +412,8 @@ void main() {
when(mockXcode.majorVersion).thenReturn(8); when(mockXcode.majorVersion).thenReturn(8);
when(mockXcode.minorVersion).thenReturn(2); when(mockXcode.minorVersion).thenReturn(2);
expect(deviceUnderTest.supportsScreenshot, true); expect(deviceUnderTest.supportsScreenshot, true);
final MockFile mockFile = MockFile(); final File screenshot = MemoryFileSystem.test().file('screenshot.png');
when(mockFile.path).thenReturn(fs.path.join('some', 'path', 'to', 'screenshot.png')); await deviceUnderTest.takeScreenshot(screenshot);
await deviceUnderTest.takeScreenshot(mockFile);
verify(mockProcessManager.run( verify(mockProcessManager.run(
<String>[ <String>[
'/usr/bin/xcrun', '/usr/bin/xcrun',
...@@ -425,7 +421,7 @@ void main() { ...@@ -425,7 +421,7 @@ void main() {
'io', 'io',
'x', 'x',
'screenshot', 'screenshot',
fs.path.join('some', 'path', 'to', 'screenshot.png'), 'screenshot.png',
], ],
environment: null, environment: null,
workingDirectory: null, workingDirectory: null,
...@@ -944,7 +940,7 @@ flutter: ...@@ -944,7 +940,7 @@ flutter:
); );
expect(simulator.isSupportedForProject(flutterProject), true); expect(simulator.isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -962,7 +958,7 @@ flutter: ...@@ -962,7 +958,7 @@ flutter:
); );
expect(simulator.isSupportedForProject(flutterProject), true); expect(simulator.isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -978,7 +974,7 @@ flutter: ...@@ -978,7 +974,7 @@ flutter:
); );
expect(simulator.isSupportedForProject(flutterProject), false); expect(simulator.isSupportedForProject(flutterProject), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
}); });
......
...@@ -33,7 +33,7 @@ void main() { ...@@ -33,7 +33,7 @@ void main() {
setUp(() { setUp(() {
processManager = mocks.MockProcessManager(); processManager = mocks.MockProcessManager();
platform = FakePlatform(operatingSystem: 'macos'); platform = FakePlatform(operatingSystem: 'macos');
final FileSystem fileSystem = MemoryFileSystem(); final FileSystem fileSystem = MemoryFileSystem.test();
fileSystem.file(xcodebuild).createSync(recursive: true); fileSystem.file(xcodebuild).createSync(recursive: true);
final AnsiTerminal terminal = MockAnsiTerminal(); final AnsiTerminal terminal = MockAnsiTerminal();
logger = BufferLogger.test( logger = BufferLogger.test(
...@@ -85,7 +85,7 @@ void main() { ...@@ -85,7 +85,7 @@ void main() {
setUp(() { setUp(() {
fakeProcessManager = FakeProcessManager.list(<FakeCommand>[]); fakeProcessManager = FakeProcessManager.list(<FakeCommand>[]);
platform = FakePlatform(operatingSystem: 'macos'); platform = FakePlatform(operatingSystem: 'macos');
fileSystem = MemoryFileSystem(); fileSystem = MemoryFileSystem.test();
fileSystem.file(xcodebuild).createSync(recursive: true); fileSystem.file(xcodebuild).createSync(recursive: true);
terminal = MockAnsiTerminal(); terminal = MockAnsiTerminal();
logger = BufferLogger.test( logger = BufferLogger.test(
...@@ -534,7 +534,7 @@ Information about project "Runner": ...@@ -534,7 +534,7 @@ Information about project "Runner":
FileSystem fs; FileSystem fs;
setUp(() { setUp(() {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
mockArtifacts = MockLocalEngineArtifacts(); mockArtifacts = MockLocalEngineArtifacts();
macOS = FakePlatform(operatingSystem: 'macos'); macOS = FakePlatform(operatingSystem: 'macos');
fs.file(xcodebuild).createSync(recursive: true); fs.file(xcodebuild).createSync(recursive: true);
......
...@@ -104,7 +104,7 @@ void main() { ...@@ -104,7 +104,7 @@ void main() {
fileSystem: MemoryFileSystem.test(), fileSystem: MemoryFileSystem.test(),
).isSupportedForProject(flutterProject), true); ).isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -119,7 +119,7 @@ void main() { ...@@ -119,7 +119,7 @@ void main() {
fileSystem: MemoryFileSystem.test(), fileSystem: MemoryFileSystem.test(),
).isSupportedForProject(flutterProject), false); ).isSupportedForProject(flutterProject), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -141,7 +141,7 @@ void main() { ...@@ -141,7 +141,7 @@ void main() {
expect(device.executablePathForDevice(mockApp, BuildMode.profile), profilePath); expect(device.executablePathForDevice(mockApp, BuildMode.profile), profilePath);
expect(device.executablePathForDevice(mockApp, BuildMode.release), releasePath); expect(device.executablePathForDevice(mockApp, BuildMode.release), releasePath);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
} }
......
...@@ -12,7 +12,7 @@ import '../src/common.dart'; ...@@ -12,7 +12,7 @@ import '../src/common.dart';
void main() { void main() {
testWithoutContext('state can be set and persists', () { testWithoutContext('state can be set and persists', () {
final MemoryFileSystem fileSystem = MemoryFileSystem(); final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final Directory directory = fileSystem.directory('state_dir'); final Directory directory = fileSystem.directory('state_dir');
directory.createSync(); directory.createSync();
final File stateFile = directory.childFile('.flutter_tool_state'); final File stateFile = directory.childFile('.flutter_tool_state');
...@@ -35,7 +35,7 @@ void main() { ...@@ -35,7 +35,7 @@ void main() {
}); });
testWithoutContext('channel versions can be cached and stored', () { testWithoutContext('channel versions can be cached and stored', () {
final MemoryFileSystem fileSystem = MemoryFileSystem(); final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final Directory directory = fileSystem.directory('state_dir')..createSync(); final Directory directory = fileSystem.directory('state_dir')..createSync();
final PersistentToolState state1 = PersistentToolState.test( final PersistentToolState state1 = PersistentToolState.test(
directory: directory, directory: directory,
......
...@@ -106,7 +106,7 @@ void main() { ...@@ -106,7 +106,7 @@ void main() {
} }
setUp(() async { setUp(() async {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
fsWindows = MemoryFileSystem(style: FileSystemStyle.windows); fsWindows = MemoryFileSystem(style: FileSystemStyle.windows);
mockClock = MockClock(); mockClock = MockClock();
mockVersion = MockFlutterVersion(); mockVersion = MockFlutterVersion();
...@@ -841,8 +841,7 @@ dependencies: ...@@ -841,8 +841,7 @@ dependencies:
testUsingContext('Does not throw when AndroidManifest.xml is not found', () async { testUsingContext('Does not throw when AndroidManifest.xml is not found', () async {
when(flutterProject.isModule).thenReturn(false); when(flutterProject.isModule).thenReturn(false);
final File manifest = MockFile(); final File manifest = fs.file('AndroidManifest.xml');
when(manifest.existsSync()).thenReturn(false);
when(androidProject.appManifestFile).thenReturn(manifest); when(androidProject.appManifestFile).thenReturn(manifest);
await injectPlugins(flutterProject); await injectPlugins(flutterProject);
...@@ -1421,8 +1420,6 @@ flutter: ...@@ -1421,8 +1420,6 @@ flutter:
class MockAndroidProject extends Mock implements AndroidProject {} class MockAndroidProject extends Mock implements AndroidProject {}
class MockFeatureFlags extends Mock implements FeatureFlags {} class MockFeatureFlags extends Mock implements FeatureFlags {}
class MockFlutterProject extends Mock implements FlutterProject {} class MockFlutterProject extends Mock implements FlutterProject {}
class MockFile extends Mock implements File {}
class MockFileSystem extends Mock implements FileSystem {}
class MockIosProject extends Mock implements IosProject {} class MockIosProject extends Mock implements IosProject {}
class MockMacOSProject extends Mock implements MacOSProject {} class MockMacOSProject extends Mock implements MacOSProject {}
class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter {} class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter {}
......
...@@ -18,7 +18,7 @@ final DateTime inFuture = DateTime.now().add(const Duration(days: 100)); ...@@ -18,7 +18,7 @@ final DateTime inFuture = DateTime.now().add(const Duration(days: 100));
void main() { void main() {
for (final bool asyncScanning in <bool>[true, false]) { for (final bool asyncScanning in <bool>[true, false]) {
testWithoutContext('No last compile, asyncScanning: $asyncScanning', () async { testWithoutContext('No last compile, asyncScanning: $asyncScanning', () async {
final FileSystem fileSystem = MemoryFileSystem(); final FileSystem fileSystem = MemoryFileSystem.test();
final ProjectFileInvalidator projectFileInvalidator = ProjectFileInvalidator( final ProjectFileInvalidator projectFileInvalidator = ProjectFileInvalidator(
fileSystem: fileSystem, fileSystem: fileSystem,
platform: FakePlatform(), platform: FakePlatform(),
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
}); });
testWithoutContext('Empty project, asyncScanning: $asyncScanning', () async { testWithoutContext('Empty project, asyncScanning: $asyncScanning', () async {
final FileSystem fileSystem = MemoryFileSystem(); final FileSystem fileSystem = MemoryFileSystem.test();
final ProjectFileInvalidator projectFileInvalidator = ProjectFileInvalidator( final ProjectFileInvalidator projectFileInvalidator = ProjectFileInvalidator(
fileSystem: fileSystem, fileSystem: fileSystem,
platform: FakePlatform(), platform: FakePlatform(),
...@@ -60,9 +60,9 @@ void main() { ...@@ -60,9 +60,9 @@ void main() {
}); });
testWithoutContext('Non-existent files are ignored, asyncScanning: $asyncScanning', () async { testWithoutContext('Non-existent files are ignored, asyncScanning: $asyncScanning', () async {
final FileSystem fileSystem = MemoryFileSystem(); final FileSystem fileSystem = MemoryFileSystem.test();
final ProjectFileInvalidator projectFileInvalidator = ProjectFileInvalidator( final ProjectFileInvalidator projectFileInvalidator = ProjectFileInvalidator(
fileSystem: MemoryFileSystem(), fileSystem: MemoryFileSystem.test(),
platform: FakePlatform(), platform: FakePlatform(),
logger: BufferLogger.test(), logger: BufferLogger.test(),
); );
......
...@@ -167,7 +167,7 @@ void main() { ...@@ -167,7 +167,7 @@ void main() {
await project.ensureReadyForPlatformSpecificTooling(); await project.ensureReadyForPlatformSpecificTooling();
expectExists(project.macos.managedDirectory.childFile('GeneratedPluginRegistrant.swift')); expectExists(project.macos.managedDirectory.childFile('GeneratedPluginRegistrant.swift'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
FlutterProjectFactory: () => FlutterProjectFactory( FlutterProjectFactory: () => FlutterProjectFactory(
...@@ -181,7 +181,7 @@ void main() { ...@@ -181,7 +181,7 @@ void main() {
await project.ensureReadyForPlatformSpecificTooling(); await project.ensureReadyForPlatformSpecificTooling();
expectExists(project.macos.generatedXcodePropertiesFile); expectExists(project.macos.generatedXcodePropertiesFile);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
FlutterProjectFactory: () => FlutterProjectFactory( FlutterProjectFactory: () => FlutterProjectFactory(
...@@ -196,7 +196,7 @@ void main() { ...@@ -196,7 +196,7 @@ void main() {
expectExists(project.linux.managedDirectory.childFile('generated_plugin_registrant.h')); expectExists(project.linux.managedDirectory.childFile('generated_plugin_registrant.h'));
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.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true), FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
FlutterProjectFactory: () => FlutterProjectFactory( FlutterProjectFactory: () => FlutterProjectFactory(
...@@ -211,7 +211,7 @@ void main() { ...@@ -211,7 +211,7 @@ void main() {
expectExists(project.windows.managedDirectory.childFile('generated_plugin_registrant.h')); expectExists(project.windows.managedDirectory.childFile('generated_plugin_registrant.h'));
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.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true), FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
FlutterProjectFactory: () => FlutterProjectFactory( FlutterProjectFactory: () => FlutterProjectFactory(
...@@ -294,7 +294,7 @@ void main() { ...@@ -294,7 +294,7 @@ void main() {
MemoryFileSystem fs; MemoryFileSystem fs;
FlutterProjectFactory flutterProjectFactory; FlutterProjectFactory flutterProjectFactory;
setUp(() { setUp(() {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
mockXcodeProjectInterpreter = MockXcodeProjectInterpreter(); mockXcodeProjectInterpreter = MockXcodeProjectInterpreter();
flutterProjectFactory = FlutterProjectFactory( flutterProjectFactory = FlutterProjectFactory(
logger: logger, logger: logger,
...@@ -332,7 +332,7 @@ apply plugin: 'kotlin-android' ...@@ -332,7 +332,7 @@ apply plugin: 'kotlin-android'
MockXcodeProjectInterpreter mockXcodeProjectInterpreter; MockXcodeProjectInterpreter mockXcodeProjectInterpreter;
FlutterProjectFactory flutterProjectFactory; FlutterProjectFactory flutterProjectFactory;
setUp(() { setUp(() {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
mockPlistUtils = MockPlistUtils(); mockPlistUtils = MockPlistUtils();
mockXcodeProjectInterpreter = MockXcodeProjectInterpreter(); mockXcodeProjectInterpreter = MockXcodeProjectInterpreter();
flutterProjectFactory = FlutterProjectFactory( flutterProjectFactory = FlutterProjectFactory(
...@@ -496,7 +496,7 @@ apply plugin: 'kotlin-android' ...@@ -496,7 +496,7 @@ apply plugin: 'kotlin-android'
MemoryFileSystem fs; MemoryFileSystem fs;
MockXcodeProjectInterpreter mockXcodeProjectInterpreter; MockXcodeProjectInterpreter mockXcodeProjectInterpreter;
setUp(() { setUp(() {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
mockXcodeProjectInterpreter = MockXcodeProjectInterpreter(); mockXcodeProjectInterpreter = MockXcodeProjectInterpreter();
}); });
......
...@@ -2196,7 +2196,7 @@ void main() { ...@@ -2196,7 +2196,7 @@ void main() {
expect(testLogger.errorText, contains('Failed to write vmservice-out-file at foo')); expect(testLogger.errorText, contains('Failed to write vmservice-out-file at foo'));
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => ThrowingForwardingFileSystem(MemoryFileSystem()), FileSystem: () => ThrowingForwardingFileSystem(MemoryFileSystem.test()),
})); }));
......
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
}); });
setUp(() { setUp(() {
fs = MemoryFileSystem(); fs = MemoryFileSystem.test();
fs.directory(_kFlutterRoot).createSync(recursive: true); fs.directory(_kFlutterRoot).createSync(recursive: true);
fs.directory(_kProjectRoot).createSync(recursive: true); fs.directory(_kProjectRoot).createSync(recursive: true);
fs.currentDirectory = _kProjectRoot; fs.currentDirectory = _kProjectRoot;
......
...@@ -89,7 +89,7 @@ void main() { ...@@ -89,7 +89,7 @@ void main() {
'FLUTTER_ANALYTICS_LOG_FILE': 'test', 'FLUTTER_ANALYTICS_LOG_FILE': 'test',
'FLUTTER_ROOT': '/', 'FLUTTER_ROOT': '/',
}), }),
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
Usage: () => CrashingUsage(), Usage: () => CrashingUsage(),
}); });
...@@ -130,7 +130,7 @@ void main() { ...@@ -130,7 +130,7 @@ void main() {
'FLUTTER_ANALYTICS_LOG_FILE': 'test', 'FLUTTER_ANALYTICS_LOG_FILE': 'test',
'FLUTTER_ROOT': '/', 'FLUTTER_ROOT': '/',
}), }),
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
CrashReporter: () => WaitingCrashReporter(commandCompleter.future), CrashReporter: () => WaitingCrashReporter(commandCompleter.future),
...@@ -190,7 +190,7 @@ void main() { ...@@ -190,7 +190,7 @@ void main() {
}, },
operatingSystem: 'linux' operatingSystem: 'linux'
), ),
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
UserMessages: () => CustomBugInstructions(), UserMessages: () => CustomBugInstructions(),
}); });
......
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
expect(vsCode.version, Version.unknown); expect(vsCode.version, Version.unknown);
expect(bufferLogger.traceText, contains('Error parsing VSCode')); expect(bufferLogger.traceText, contains('Error parsing VSCode'));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
} }
...@@ -76,7 +76,7 @@ void main() { ...@@ -76,7 +76,7 @@ void main() {
expect(WindowsDevice().isSupportedForProject(flutterProject), true); expect(WindowsDevice().isSupportedForProject(flutterProject), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -87,7 +87,7 @@ void main() { ...@@ -87,7 +87,7 @@ void main() {
expect(WindowsDevice().isSupportedForProject(flutterProject), false); expect(WindowsDevice().isSupportedForProject(flutterProject), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -99,7 +99,7 @@ void main() { ...@@ -99,7 +99,7 @@ void main() {
expect(WindowsDevice().isSupportedForProject(flutterProject), false); expect(WindowsDevice().isSupportedForProject(flutterProject), false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -116,7 +116,7 @@ void main() { ...@@ -116,7 +116,7 @@ void main() {
expect(WindowsDevice().executablePathForDevice(mockApp, BuildMode.profile), profilePath); expect(WindowsDevice().executablePathForDevice(mockApp, BuildMode.profile), profilePath);
expect(WindowsDevice().executablePathForDevice(mockApp, BuildMode.release), releasePath); expect(WindowsDevice().executablePathForDevice(mockApp, BuildMode.release), releasePath);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
}); });
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/features.dart'; import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/windows/windows_workflow.dart'; import 'package:flutter_tools/src/windows/windows_workflow.dart';
import 'package:mockito/mockito.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
...@@ -13,14 +12,12 @@ import '../../src/testbed.dart'; ...@@ -13,14 +12,12 @@ import '../../src/testbed.dart';
void main() { void main() {
Testbed testbed; Testbed testbed;
MockPlatform windows; FakePlatform windows;
MockPlatform notWindows; FakePlatform notWindows;
setUp(() { setUp(() {
windows = MockPlatform(); windows = FakePlatform(operatingSystem: 'windows');
notWindows = MockPlatform(); notWindows = FakePlatform(operatingSystem: 'linux');
when(windows.isWindows).thenReturn(true);
when(notWindows.isWindows).thenReturn(false);
testbed = Testbed( testbed = Testbed(
overrides: <Type, Generator>{ overrides: <Type, Generator>{
Platform: () => windows, Platform: () => windows,
...@@ -54,8 +51,3 @@ void main() { ...@@ -54,8 +51,3 @@ void main() {
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false), FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false),
})); }));
} }
class MockPlatform extends Mock implements Platform {
@override
final Map<String, String> environment = <String, String>{};
}
...@@ -57,7 +57,7 @@ void main() { ...@@ -57,7 +57,7 @@ void main() {
}); });
testWithoutContext('Template.render replaces .img.tmpl files with files from the image source', () { testWithoutContext('Template.render replaces .img.tmpl files with files from the image source', () {
final MemoryFileSystem fileSystem = MemoryFileSystem(); final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final Directory templateDir = fileSystem.directory('templates'); final Directory templateDir = fileSystem.directory('templates');
final Directory imageSourceDir = fileSystem.directory('template_images'); final Directory imageSourceDir = fileSystem.directory('template_images');
final Directory destination = fileSystem.directory('target'); final Directory destination = fileSystem.directory('target');
...@@ -84,7 +84,7 @@ void main() { ...@@ -84,7 +84,7 @@ void main() {
}); });
testWithoutContext('Template.fromName runs pub get if .packages is missing', () async { testWithoutContext('Template.fromName runs pub get if .packages is missing', () async {
final MemoryFileSystem fileSystem = MemoryFileSystem(); final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final MockPub pub = MockPub(); final MockPub pub = MockPub();
when(pub.get( when(pub.get(
context: PubContext.pubGet, context: PubContext.pubGet,
...@@ -107,7 +107,7 @@ void main() { ...@@ -107,7 +107,7 @@ void main() {
}); });
testWithoutContext('Template.fromName runs pub get if .packages is missing flutter_template_images', () async { testWithoutContext('Template.fromName runs pub get if .packages is missing flutter_template_images', () async {
final MemoryFileSystem fileSystem = MemoryFileSystem(); final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final MockPub pub = MockPub(); final MockPub pub = MockPub();
when(pub.get( when(pub.get(
context: PubContext.pubGet, context: PubContext.pubGet,
...@@ -137,7 +137,7 @@ void main() { ...@@ -137,7 +137,7 @@ void main() {
}); });
testWithoutContext('Template.fromName runs pub get if flutter_template_images directory is missing', () async { testWithoutContext('Template.fromName runs pub get if flutter_template_images directory is missing', () async {
final MemoryFileSystem fileSystem = MemoryFileSystem(); final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final MockPub pub = MockPub(); final MockPub pub = MockPub();
Cache.flutterRoot = '/flutter'; Cache.flutterRoot = '/flutter';
final File packagesFile = fileSystem.directory(Cache.flutterRoot) final File packagesFile = fileSystem.directory(Cache.flutterRoot)
......
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