Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e8fbb43a
Unverified
Commit
e8fbb43a
authored
Sep 30, 2020
by
Jenn Magder
Committed by
GitHub
Sep 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace MockFile with memory file system files (#66941)
parent
07e56d48
Changes
44
Show whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
174 additions
and
224 deletions
+174
-224
build_ios_framework_test.dart
...est/commands.shard/hermetic/build_ios_framework_test.dart
+1
-1
clean_test.dart
...lutter_tools/test/commands.shard/hermetic/clean_test.dart
+1
-1
doctor_test.dart
...utter_tools/test/commands.shard/hermetic/doctor_test.dart
+1
-1
drive_test.dart
...lutter_tools/test/commands.shard/hermetic/drive_test.dart
+1
-1
run_test.dart
.../flutter_tools/test/commands.shard/hermetic/run_test.dart
+1
-1
shell_completion_test.dart
...s/test/commands.shard/hermetic/shell_completion_test.dart
+3
-3
test_test.dart
...flutter_tools/test/commands.shard/hermetic/test_test.dart
+1
-1
build_bundle_test.dart
...ools/test/commands.shard/permeable/build_bundle_test.dart
+7
-7
analytics_test.dart
...ages/flutter_tools/test/general.shard/analytics_test.dart
+3
-3
android_workflow_test.dart
...ols/test/general.shard/android/android_workflow_test.dart
+1
-1
gradle_test.dart
...flutter_tools/test/general.shard/android/gradle_test.dart
+7
-7
gradle_utils_test.dart
...r_tools/test/general.shard/android/gradle_utils_test.dart
+3
-3
application_package_test.dart
...er_tools/test/general.shard/application_package_test.dart
+3
-3
artifacts_test.dart
...ages/flutter_tools/test/general.shard/artifacts_test.dart
+2
-2
file_system_test.dart
...utter_tools/test/general.shard/base/file_system_test.dart
+6
-6
io_test.dart
packages/flutter_tools/test/general.shard/base/io_test.dart
+1
-1
net_test.dart
packages/flutter_tools/test/general.shard/base/net_test.dart
+1
-1
os_test.dart
packages/flutter_tools/test/general.shard/base/os_test.dart
+1
-1
icon_tree_shaker_test.dart
...ral.shard/build_system/targets/icon_tree_shaker_test.dart
+1
-1
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+9
-9
channel_test.dart
packages/flutter_tools/test/general.shard/channel_test.dart
+3
-3
cold_test.dart
packages/flutter_tools/test/general.shard/cold_test.dart
+2
-2
config_test.dart
packages/flutter_tools/test/general.shard/config_test.dart
+1
-1
desktop_device_test.dart
...flutter_tools/test/general.shard/desktop_device_test.dart
+5
-10
fuchsia_device_test.dart
...tools/test/general.shard/fuchsia/fuchsia_device_test.dart
+18
-33
fuchsia_pm_test.dart
...ter_tools/test/general.shard/fuchsia/fuchsia_pm_test.dart
+3
-4
github_template_test.dart
...lutter_tools/test/general.shard/github_template_test.dart
+3
-3
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+12
-12
ios_project_migration_test.dart
...ls/test/general.shard/ios/ios_project_migration_test.dart
+3
-3
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+25
-39
simulators_test.dart
...flutter_tools/test/general.shard/ios/simulators_test.dart
+6
-10
xcodeproj_test.dart
.../flutter_tools/test/general.shard/ios/xcodeproj_test.dart
+3
-3
linux_device_test.dart
...ter_tools/test/general.shard/linux/linux_device_test.dart
+3
-3
persistent_tool_state_test.dart
..._tools/test/general.shard/persistent_tool_state_test.dart
+2
-2
plugins_test.dart
packages/flutter_tools/test/general.shard/plugins_test.dart
+2
-5
project_file_invalidator_test.dart
...ols/test/general.shard/project_file_invalidator_test.dart
+4
-4
project_test.dart
packages/flutter_tools/test/general.shard/project_test.dart
+7
-7
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+1
-1
flutter_command_runner_test.dart
...est/general.shard/runner/flutter_command_runner_test.dart
+1
-1
runner_test.dart
.../flutter_tools/test/general.shard/runner/runner_test.dart
+3
-3
vscode_test.dart
.../flutter_tools/test/general.shard/vscode/vscode_test.dart
+1
-1
windows_device_test.dart
...tools/test/general.shard/windows/windows_device_test.dart
+4
-4
windows_workflow_test.dart
...ols/test/general.shard/windows/windows_workflow_test.dart
+4
-12
template_test.dart
packages/flutter_tools/test/template_test.dart
+4
-4
No files found.
packages/flutter_tools/test/commands.shard/hermetic/build_ios_framework_test.dart
View file @
e8fbb43a
...
...
@@ -32,7 +32,7 @@ void main() {
});
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
mockFlutterVersion
=
MockFlutterVersion
();
mockGitTagVersion
=
MockGitTagVersion
();
mockCache
=
MockCache
();
...
...
packages/flutter_tools/test/commands.shard/hermetic/clean_test.dart
View file @
e8fbb43a
...
...
@@ -31,7 +31,7 @@ void main() {
FlutterProject
projectUnderTest
;
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
mockXcodeProjectInterpreter
=
MockXcodeProjectInterpreter
();
final
Directory
currentDirectory
=
fs
.
currentDirectory
;
...
...
packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
View file @
e8fbb43a
...
...
@@ -607,7 +607,7 @@ void main() {
expect
(
logger
.
statusText
,
contains
(
'No issues found!'
));
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockArtifacts
,
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart
View file @
e8fbb43a
...
...
@@ -38,7 +38,7 @@ void main() {
setUp
(()
{
command
=
DriveCommand
();
applyMocksToCommand
(
command
);
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
tempDir
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_drive_test.'
);
fs
.
currentDirectory
=
tempDir
;
fs
.
directory
(
'test'
).
createSync
();
...
...
packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
View file @
e8fbb43a
...
...
@@ -150,7 +150,7 @@ void main() {
mockArtifacts
=
MockArtifacts
();
mockCache
=
MockCache
();
mockUsage
=
MockUsage
();
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
mockProcessManager
=
MockProcessManager
();
tempDir
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_run_test.'
);
...
...
packages/flutter_tools/test/commands.shard/hermetic/shell_completion_test.dart
View file @
e8fbb43a
...
...
@@ -52,7 +52,7 @@ void main() {
expect
(
globals
.
fs
.
isFileSync
(
outputFile
),
isTrue
);
expect
(
globals
.
fs
.
file
(
outputFile
).
readAsStringSync
(),
contains
(
'__flutter_completion'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Stdio:
()
=>
mockStdio
,
});
...
...
@@ -73,7 +73,7 @@ void main() {
expect
(
globals
.
fs
.
isFileSync
(
outputFile
),
isTrue
);
expect
(
globals
.
fs
.
file
(
outputFile
).
readAsStringSync
(),
isEmpty
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Stdio:
()
=>
mockStdio
,
});
...
...
@@ -88,7 +88,7 @@ void main() {
expect
(
globals
.
fs
.
isFileSync
(
outputFile
),
isTrue
);
expect
(
globals
.
fs
.
file
(
outputFile
).
readAsStringSync
(),
contains
(
'__flutter_completion'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Stdio:
()
=>
mockStdio
,
});
...
...
packages/flutter_tools/test/commands.shard/hermetic/test_test.dart
View file @
e8fbb43a
...
...
@@ -26,7 +26,7 @@ void main() {
MemoryFileSystem
fs
;
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
directory
(
'test'
).
childFile
(
'some_test.dart'
).
createSync
(
recursive:
true
);
...
...
packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart
View file @
e8fbb43a
...
...
@@ -112,7 +112,7 @@ void main() {
'--target-platform=windows-x64'
,
]),
throwsToolExit
());
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsEnabled:
false
),
});
...
...
@@ -130,7 +130,7 @@ void main() {
'--target-platform=linux-x64'
,
]),
throwsToolExit
());
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isLinuxEnabled:
false
),
});
...
...
@@ -148,7 +148,7 @@ void main() {
'--target-platform=darwin-x64'
,
]),
throwsToolExit
());
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isMacOSEnabled:
false
),
});
...
...
@@ -166,7 +166,7 @@ void main() {
'--target-platform=windows-x64'
,
]);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsEnabled:
true
),
});
...
...
@@ -184,7 +184,7 @@ void main() {
'--target-platform=linux-x64'
,
]);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isLinuxEnabled:
true
),
});
...
...
@@ -202,7 +202,7 @@ void main() {
'--target-platform=darwin-x64'
,
]);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isMacOSEnabled:
true
),
});
...
...
@@ -234,7 +234,7 @@ void main() {
]);
},
overrides:
<
Type
,
Generator
>{
BuildSystem:
()
=>
MockBuildSystem
(),
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
}
...
...
packages/flutter_tools/test/general.shard/analytics_test.dart
View file @
e8fbb43a
...
...
@@ -117,7 +117,7 @@ void main() {
Platform:
()
=>
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_ANALYTICS_LOG_FILE'
:
'test'
,
}),
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -143,7 +143,7 @@ void main() {
Platform:
()
=>
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_ANALYTICS_LOG_FILE'
:
'test'
,
}),
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
...
...
@@ -157,7 +157,7 @@ void main() {
List
<
int
>
mockTimes
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
mockStdio
=
MockStdio
();
mockUsage
=
MockUsage
();
when
(
mockUsage
.
isFirstRun
).
thenReturn
(
false
);
...
...
packages/flutter_tools/test/general.shard/android/android_workflow_test.dart
View file @
e8fbb43a
...
...
@@ -35,7 +35,7 @@ void main() {
setUp
(()
{
sdk
=
MockAndroidSdk
();
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
fs
.
directory
(
'/home/me'
).
createSync
(
recursive:
true
);
logger
=
BufferLogger
(
terminal:
AnsiTerminal
(
...
...
packages/flutter_tools/test/general.shard/android/gradle_test.dart
View file @
e8fbb43a
...
...
@@ -322,7 +322,7 @@ void main() {
),
).
called
(
1
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Usage:
()
=>
mockUsage
,
});
...
...
@@ -472,7 +472,7 @@ include ':app'
expect
(
tempDir
.
childFile
(
'settings_aar.gradle'
).
existsSync
(),
isTrue
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -505,7 +505,7 @@ include ':app'
expect
(
tempDir
.
childFile
(
'settings_aar.gradle'
).
existsSync
(),
isTrue
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
...
...
@@ -517,7 +517,7 @@ include ':app'
FileSystem
fs
;
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
mockArtifacts
=
MockLocalEngineArtifacts
();
mockProcessManager
=
MockProcessManager
();
android
=
fakePlatform
(
'android'
);
...
...
@@ -786,7 +786,7 @@ flutter:
FileSystem
fs
;
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
});
testUsingContext
(
'returns true when the project is using AndroidX'
,
()
async
{
...
...
@@ -834,7 +834,7 @@ flutter:
MockAndroidSdk
mockAndroidSdk
;
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
fakeProcessManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[]);
mockAndroidSdk
=
MockAndroidSdk
();
when
(
mockAndroidSdk
.
directory
).
thenReturn
(
'irrelevant'
);
...
...
@@ -1013,7 +1013,7 @@ plugin1=${plugin1.path}
setUp
(()
{
mockUsage
=
MockUsage
();
fileSystem
=
MemoryFileSystem
();
fileSystem
=
MemoryFileSystem
.
test
();
fileSystemUtils
=
MockFileSystemUtils
();
mockAndroidSdk
=
MockAndroidSdk
();
mockAndroidStudio
=
MockAndroidStudio
();
...
...
packages/flutter_tools/test/general.shard/android/gradle_utils_test.dart
View file @
e8fbb43a
...
...
@@ -22,7 +22,7 @@ void main() {
Directory
gradleWrapperDirectory
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
tempDir
=
memoryFileSystem
.
systemTempDirectory
.
createTempSync
(
'flutter_artifacts_test.'
);
gradleWrapperDirectory
=
memoryFileSystem
.
directory
(
memoryFileSystem
.
path
.
join
(
tempDir
.
path
,
'bin'
,
'cache'
,
'artifacts'
,
'gradle_wrapper'
));
...
...
@@ -124,7 +124,7 @@ void main() {
MemoryFileSystem
memoryFileSystem
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
});
testUsingContext
(
"throws ToolExit if gradle.properties doesn't exist"
,
()
{
...
...
@@ -229,7 +229,7 @@ void main() {
MockGradleUtils
gradleUtils
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
operatingSystemUtils
=
MockOperatingSystemUtils
();
gradleUtils
=
MockGradleUtils
();
});
...
...
packages/flutter_tools/test/general.shard/application_package_test.dart
View file @
e8fbb43a
...
...
@@ -51,7 +51,7 @@ void main() {
setUp
(()
async
{
sdk
=
MockitoAndroidSdk
();
mockProcessManager
=
MockitoProcessManager
();
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
mockCache
=
MockCache
();
Cache
.
flutterRoot
=
'../..'
;
when
(
sdk
.
licensesAvailable
).
thenReturn
(
true
);
...
...
@@ -217,7 +217,7 @@ void main() {
group
(
'PrebuiltIOSApp'
,
()
{
MockOperatingSystemUtils
os
;
final
Map
<
Type
,
Generator
>
overrides
=
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
PlistParser:
()
=>
MockPlistUtils
(),
Platform:
_kNoColorTerminalPlatform
,
...
...
@@ -365,7 +365,7 @@ void main() {
group
(
'FuchsiaApp'
,
()
{
final
Map
<
Type
,
Generator
>
overrides
=
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
_kNoColorTerminalPlatform
,
OperatingSystemUtils:
()
=>
MockOperatingSystemUtils
(),
...
...
packages/flutter_tools/test/general.shard/artifacts_test.dart
View file @
e8fbb43a
...
...
@@ -23,7 +23,7 @@ void main() {
Platform
platform
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
();
fileSystem
=
MemoryFileSystem
.
test
();
final
Directory
cacheRoot
=
fileSystem
.
directory
(
'root'
)
..
createSync
();
platform
=
FakePlatform
(
operatingSystem:
'linux'
);
...
...
@@ -110,7 +110,7 @@ void main() {
Platform
platform
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
();
fileSystem
=
MemoryFileSystem
.
test
();
final
Directory
cacheRoot
=
fileSystem
.
directory
(
'root'
)
..
createSync
();
platform
=
FakePlatform
(
operatingSystem:
'linux'
);
...
...
packages/flutter_tools/test/general.shard/base/file_system_test.dart
View file @
e8fbb43a
...
...
@@ -21,7 +21,7 @@ void main() {
FileSystemUtils
fsUtils
;
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
fsUtils
=
FileSystemUtils
(
fileSystem:
fs
,
platform:
FakePlatform
(),
...
...
@@ -61,7 +61,7 @@ void main() {
/// Test file_systems.copyDirectorySync() using MemoryFileSystem.
/// Copies between 2 instances of file systems which is also supported by copyDirectorySync().
testWithoutContext
(
'test directory copy'
,
()
async
{
final
MemoryFileSystem
sourceMemoryFs
=
MemoryFileSystem
();
final
MemoryFileSystem
sourceMemoryFs
=
MemoryFileSystem
.
test
();
const
String
sourcePath
=
'/some/origin'
;
final
Directory
sourceDirectory
=
await
sourceMemoryFs
.
directory
(
sourcePath
).
create
(
recursive:
true
);
sourceMemoryFs
.
currentDirectory
=
sourcePath
;
...
...
@@ -71,7 +71,7 @@ void main() {
sourceMemoryFs
.
directory
(
'empty_directory'
).
createSync
();
// Copy to another memory file system instance.
final
MemoryFileSystem
targetMemoryFs
=
MemoryFileSystem
();
final
MemoryFileSystem
targetMemoryFs
=
MemoryFileSystem
.
test
();
const
String
targetPath
=
'/some/non-existent/target'
;
final
Directory
targetDirectory
=
targetMemoryFs
.
directory
(
targetPath
);
...
...
@@ -94,7 +94,7 @@ void main() {
});
testWithoutContext
(
'Skip files if shouldCopyFile returns false'
,
()
{
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
();
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileSystemUtils
fsUtils
=
FileSystemUtils
(
fileSystem:
fileSystem
,
platform:
FakePlatform
(),
...
...
@@ -122,7 +122,7 @@ void main() {
group
(
'escapePath'
,
()
{
testWithoutContext
(
'on Windows'
,
()
{
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
();
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileSystemUtils
fsUtils
=
FileSystemUtils
(
fileSystem:
fileSystem
,
platform:
FakePlatform
(
operatingSystem:
'windows'
),
...
...
@@ -133,7 +133,7 @@ void main() {
});
testWithoutContext
(
'on Linux'
,
()
{
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
();
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileSystemUtils
fsUtils
=
FileSystemUtils
(
fileSystem:
fileSystem
,
platform:
FakePlatform
(
operatingSystem:
'linux'
),
...
...
packages/flutter_tools/test/general.shard/base/io_test.dart
View file @
e8fbb43a
...
...
@@ -15,7 +15,7 @@ import '../../src/io.dart';
void
main
(
)
{
test
(
'IOOverrides can inject a memory file system'
,
()
async
{
final
MemoryFileSystem
memoryFileSystem
=
MemoryFileSystem
();
final
MemoryFileSystem
memoryFileSystem
=
MemoryFileSystem
.
test
();
final
FlutterIOOverrides
flutterIOOverrides
=
FlutterIOOverrides
(
fileSystem:
memoryFileSystem
);
await
io
.
IOOverrides
.
runWithIOOverrides
(()
async
{
// statics delegate correctly.
...
...
packages/flutter_tools/test/general.shard/base/net_test.dart
View file @
e8fbb43a
...
...
@@ -55,7 +55,7 @@ void main() {
testWithoutContext
(
'fetchUrl(destFile) writes the data to a file'
,
()
async
{
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
List
<
int
>
data
=
await
net
.
fetchUrl
(
Uri
.
parse
(
'http://example.invalid/'
),
...
...
packages/flutter_tools/test/general.shard/base/os_test.dart
View file @
e8fbb43a
...
...
@@ -29,7 +29,7 @@ void main() {
OperatingSystemUtils
createOSUtils
(
Platform
platform
)
{
return
OperatingSystemUtils
(
fileSystem:
MemoryFileSystem
(),
fileSystem:
MemoryFileSystem
.
test
(),
logger:
BufferLogger
.
test
(),
platform:
platform
,
processManager:
mockProcessManager
,
...
...
packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart
View file @
e8fbb43a
...
...
@@ -90,7 +90,7 @@ void main() {
mockProcessManager
=
MockProcessManager
();
fontSubsetProcess
=
MockProcess
();
mockArtifacts
=
MockArtifacts
();
fileSystem
=
MemoryFileSystem
();
fileSystem
=
MemoryFileSystem
.
test
();
logger
=
BufferLogger
(
terminal:
AnsiTerminal
(
stdio:
mocks
.
MockStdio
(),
...
...
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
e8fbb43a
...
...
@@ -32,7 +32,7 @@ void main() {
setUp
(()
{
mockFileSystem
=
MockFileSystem
();
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
mockFile
=
MockFile
();
mockRandomAccessFile
=
MockRandomAccessFile
();
when
(
mockFileSystem
.
path
).
thenReturn
(
memoryFileSystem
.
path
);
...
...
@@ -89,7 +89,7 @@ void main() {
setUp
(()
{
mockCache
=
MockCache
();
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
});
testUsingContext
(
'Continues on failed stamp file update'
,
()
async
{
...
...
@@ -247,9 +247,9 @@ void main() {
});
testWithoutContext
(
'flattenNameSubdirs'
,
()
{
expect
(
flattenNameSubdirs
(
Uri
.
parse
(
'http://flutter.dev/foo/bar'
),
MemoryFileSystem
()),
'flutter.dev/foo/bar'
);
expect
(
flattenNameSubdirs
(
Uri
.
parse
(
'http://docs.flutter.io/foo/bar'
),
MemoryFileSystem
()),
'docs.flutter.io/foo/bar'
);
expect
(
flattenNameSubdirs
(
Uri
.
parse
(
'https://www.flutter.dev'
),
MemoryFileSystem
()),
'www.flutter.dev'
);
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
.
test
()),
'docs.flutter.io/foo/bar'
);
expect
(
flattenNameSubdirs
(
Uri
.
parse
(
'https://www.flutter.dev'
),
MemoryFileSystem
.
test
()),
'www.flutter.dev'
);
});
group
(
'EngineCachedArtifact'
,
()
{
...
...
@@ -303,7 +303,7 @@ void main() {
MockCache
mockCache
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
processManager
=
MockProcessManager
();
mockCache
=
MockCache
();
});
...
...
@@ -372,7 +372,7 @@ void main() {
expect
(
iosUsbArtifacts
.
isUpToDateInner
(),
false
);
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockCache
,
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -390,7 +390,7 @@ void main() {
expect
(
iosUsbArtifacts
.
isUpToDateInner
(),
false
);
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockCache
,
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -402,7 +402,7 @@ void main() {
expect
(
iosUsbArtifacts
.
isUpToDateInner
(),
true
);
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockCache
,
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
packages/flutter_tools/test/general.shard/channel_test.dart
View file @
e8fbb43a
...
...
@@ -254,7 +254,7 @@ void main() {
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
mockProcessManager
,
});
...
...
@@ -307,7 +307,7 @@ void main() {
);
expect
(
testLogger
.
errorText
,
hasLength
(
0
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
mockProcessManager
,
});
...
...
@@ -368,7 +368,7 @@ void main() {
expect
(
testLogger
.
errorText
,
hasLength
(
0
));
expect
(
versionCheckFile
.
existsSync
(),
isFalse
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
mockProcessManager
,
});
});
...
...
packages/flutter_tools/test/general.shard/cold_test.dart
View file @
e8fbb43a
...
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// 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/io.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
...
...
@@ -94,7 +95,7 @@ void main() {
route:
anyNamed
(
'route'
)
)).
thenAnswer
((
Invocation
invocation
)
=>
Future
<
int
>.
value
(
1
));
final
List
<
FlutterDevice
>
devices
=
<
FlutterDevice
>[
mockFlutterDevice
];
final
MockFile
applicationBinary
=
MockFile
(
);
final
File
applicationBinary
=
MemoryFileSystem
.
test
().
file
(
'binary'
);
final
int
result
=
await
ColdRunner
(
devices
,
applicationBinary:
applicationBinary
,
...
...
@@ -110,7 +111,6 @@ void main() {
});
}
class
MockFile
extends
Mock
implements
File
{}
class
MockFlutterDevice
extends
Mock
implements
FlutterDevice
{}
class
MockDevice
extends
Mock
implements
Device
{
MockDevice
()
{
...
...
packages/flutter_tools/test/general.shard/config_test.dart
View file @
e8fbb43a
...
...
@@ -19,7 +19,7 @@ void main() {
FakePlatform
fakePlatform
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
fakePlatform
=
FakePlatform
(
operatingSystem:
'linux'
,
environment:
<
String
,
String
>{
...
...
packages/flutter_tools/test/general.shard/desktop_device_test.dart
View file @
e8fbb43a
...
...
@@ -5,6 +5,7 @@
import
'dart:async'
;
import
'dart:convert'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/application_package.dart'
;
import
'package:flutter_tools/src/base/context.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
...
...
@@ -74,10 +75,6 @@ class NullExecutableDesktopDevice extends FakeDesktopDevice {
class
MockAppplicationPackage
extends
Mock
implements
ApplicationPackage
{}
class
MockFileSystem
extends
Mock
implements
FileSystem
{}
class
MockFile
extends
Mock
implements
File
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
void
main
(
)
{
...
...
@@ -122,16 +119,14 @@ void main() {
});
group
(
'Starting and stopping application'
,
()
{
final
MockFileSystem
mockFileSystem
=
MockFileSystem
();
final
FileSystem
memoryFileSystem
=
MemoryFileSystem
.
test
();
final
MockProcessManager
mockProcessManager
=
MockProcessManager
();
// Configures mock environment so that startApp will be able to find and
// run an FakeDesktopDevice exectuable with for the given mode.
void
setUpMockExecutable
(
FakeDesktopDevice
device
,
BuildMode
mode
,
{
Future
<
int
>
exitFuture
})
{
final
String
executableName
=
device
.
executablePathForDevice
(
null
,
mode
);
final
MockFile
mockFile
=
MockFile
();
when
(
mockFileSystem
.
file
(
executableName
)).
thenReturn
(
mockFile
);
when
(
mockFile
.
existsSync
()).
thenReturn
(
true
);
memoryFileSystem
.
file
(
executableName
).
writeAsStringSync
(
'
\n
'
);
when
(
mockProcessManager
.
start
(<
String
>[
executableName
])).
thenAnswer
((
Invocation
invocation
)
async
{
return
FakeProcess
(
exitCode:
Completer
<
int
>().
future
,
...
...
@@ -160,7 +155,7 @@ void main() {
expect
(
result
.
started
,
true
);
expect
(
result
.
observatoryUri
,
Uri
.
parse
(
'http://127.0.0.1/0'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
m
ock
FileSystem
,
FileSystem:
()
=>
m
emory
FileSystem
,
ProcessManager:
()
=>
mockProcessManager
,
});
...
...
@@ -180,7 +175,7 @@ void main() {
expect
(
result
.
started
,
true
);
expect
(
await
device
.
stopApp
(
package
),
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
m
ock
FileSystem
,
FileSystem:
()
=>
m
emory
FileSystem
,
ProcessManager:
()
=>
mockProcessManager
,
});
});
...
...
packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart
View file @
e8fbb43a
...
...
@@ -60,13 +60,11 @@ final vm_service.Isolate fakeIsolate = vm_service.Isolate(
void
main
(
)
{
group
(
'fuchsia device'
,
()
{
MemoryFileSystem
memoryFileSystem
;
Mock
File
sshConfig
;
File
sshConfig
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
sshConfig
=
MockFile
();
when
(
sshConfig
.
existsSync
()).
thenReturn
(
true
);
when
(
sshConfig
.
absolute
).
thenReturn
(
sshConfig
);
memoryFileSystem
=
MemoryFileSystem
.
test
();
sshConfig
=
memoryFileSystem
.
file
(
'ssh_config'
)..
writeAsStringSync
(
'
\n
'
);
});
testWithoutContext
(
'stores the requested id and name'
,
()
{
...
...
@@ -293,14 +291,14 @@ void main() {
group
(
'displays friendly error when'
,
()
{
MockProcessManager
mockProcessManager
;
MockProcessResult
mockProcessResult
;
MockFile
mock
File
;
File
artifact
File
;
MockProcessManager
emptyStdoutProcessManager
;
MockProcessResult
emptyStdoutProcessResult
;
setUp
(()
{
mockProcessManager
=
MockProcessManager
();
mockProcessResult
=
MockProcessResult
();
mockFile
=
MockFile
(
);
artifactFile
=
MemoryFileSystem
.
test
().
file
(
'artifact'
);
when
(
mockProcessManager
.
run
(
any
,
environment:
anyNamed
(
'environment'
),
...
...
@@ -310,8 +308,6 @@ void main() {
when
(
mockProcessResult
.
exitCode
).
thenReturn
(
1
);
when
<
String
>(
mockProcessResult
.
stdout
as
String
).
thenReturn
(
''
);
when
<
String
>(
mockProcessResult
.
stderr
as
String
).
thenReturn
(
''
);
when
(
mockFile
.
absolute
).
thenReturn
(
mockFile
);
when
(
mockFile
.
path
).
thenReturn
(
''
);
emptyStdoutProcessManager
=
MockProcessManager
();
emptyStdoutProcessResult
=
MockProcessResult
();
...
...
@@ -341,8 +337,8 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
emptyStdoutProcessManager
,
FuchsiaArtifacts:
()
=>
FuchsiaArtifacts
(
sshConfig:
mock
File
,
devFinder:
mock
File
,
sshConfig:
artifact
File
,
devFinder:
artifact
File
,
),
FuchsiaSdk:
()
=>
MockFuchsiaSdk
(),
});
...
...
@@ -362,8 +358,8 @@ void main() {
Completer
<
int
>
exitCode
;
StreamController
<
List
<
int
>>
stdout
;
StreamController
<
List
<
int
>>
stderr
;
Mock
File
devFinder
;
Mock
File
sshConfig
;
File
devFinder
;
File
sshConfig
;
setUp
(()
{
mockProcessManager
=
MockProcessManager
();
...
...
@@ -376,12 +372,9 @@ void main() {
when
(
mockProcess
.
exitCode
).
thenAnswer
((
Invocation
_
)
=>
exitCode
.
future
);
when
(
mockProcess
.
stdout
).
thenAnswer
((
Invocation
_
)
=>
stdout
.
stream
);
when
(
mockProcess
.
stderr
).
thenAnswer
((
Invocation
_
)
=>
stderr
.
stream
);
devFinder
=
MockFile
();
sshConfig
=
MockFile
();
when
(
devFinder
.
existsSync
()).
thenReturn
(
true
);
when
(
sshConfig
.
existsSync
()).
thenReturn
(
true
);
when
(
devFinder
.
absolute
).
thenReturn
(
devFinder
);
when
(
sshConfig
.
absolute
).
thenReturn
(
sshConfig
);
final
FileSystem
memoryFileSystem
=
MemoryFileSystem
.
test
();
devFinder
=
memoryFileSystem
.
file
(
'device-finder'
)..
writeAsStringSync
(
'
\n
'
);
sshConfig
=
memoryFileSystem
.
file
(
'ssh_config'
)..
writeAsStringSync
(
'
\n
'
);
});
tearDown
(()
{
...
...
@@ -700,15 +693,11 @@ void main() {
group
(
'portForwarder'
,
()
{
MockProcessManager
mockProcessManager
;
Mock
File
sshConfig
;
File
sshConfig
;
setUp
(()
{
mockProcessManager
=
MockProcessManager
();
sshConfig
=
MockFile
();
when
(
sshConfig
.
path
).
thenReturn
(
'irrelevant'
);
when
(
sshConfig
.
existsSync
()).
thenReturn
(
true
);
when
(
sshConfig
.
absolute
).
thenReturn
(
sshConfig
);
sshConfig
=
MemoryFileSystem
.
test
().
file
(
'irrelevant'
)..
writeAsStringSync
(
'
\n
'
);
});
testUsingContext
(
'`unforward` prints stdout and stderr if ssh command failed'
,
()
async
{
...
...
@@ -721,7 +710,7 @@ void main() {
when
(
mockProcessManager
.
run
(<
String
>[
'ssh'
,
'-F'
,
'irrelevant'
,
sshConfig
.
absolute
.
path
,
'-O'
,
'cancel'
,
'-vvv'
,
...
...
@@ -890,7 +879,7 @@ void main() {
File
runner
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
osUtils
=
FakeOperatingSystemUtils
();
fuchsiaDeviceTools
=
FakeFuchsiaDeviceTools
();
fuchsiaSdk
=
MockFuchsiaSdk
();
...
...
@@ -1105,7 +1094,7 @@ void main() {
});
group
(
'sdkNameAndVersion: '
,
()
{
Mock
File
sshConfig
;
File
sshConfig
;
MockProcessManager
mockSuccessProcessManager
;
MockProcessResult
mockSuccessProcessResult
;
MockProcessManager
mockFailureProcessManager
;
...
...
@@ -1114,9 +1103,7 @@ void main() {
MockProcessResult
emptyStdoutProcessResult
;
setUp
(()
{
sshConfig
=
MockFile
();
when
(
sshConfig
.
existsSync
()).
thenReturn
(
true
);
when
(
sshConfig
.
absolute
).
thenReturn
(
sshConfig
);
sshConfig
=
MemoryFileSystem
.
test
().
file
(
'ssh_config'
)..
writeAsStringSync
(
'
\n
'
);
mockSuccessProcessManager
=
MockProcessManager
();
mockSuccessProcessResult
=
MockProcessResult
();
...
...
@@ -1196,8 +1183,6 @@ class MockProcessManager extends Mock implements ProcessManager {}
class
MockProcessResult
extends
Mock
implements
ProcessResult
{}
class
MockFile
extends
Mock
implements
File
{}
class
MockProcess
extends
Mock
implements
Process
{}
Process
_createMockProcess
(
{
...
...
packages/flutter_tools/test/general.shard/fuchsia/fuchsia_pm_test.dart
View file @
e8fbb43a
...
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:file/memory.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'
;
...
...
@@ -16,13 +17,12 @@ import '../../src/mocks.dart';
void
main
(
)
{
group
(
'FuchsiaPM'
,
()
{
Mock
File
pm
;
File
pm
;
MockProcessManager
mockProcessManager
;
MockFuchsiaArtifacts
mockFuchsiaArtifacts
;
setUp
(()
{
pm
=
MockFile
();
when
(
pm
.
path
).
thenReturn
(
'pm'
);
pm
=
MemoryFileSystem
.
test
().
file
(
'pm'
);
mockFuchsiaArtifacts
=
MockFuchsiaArtifacts
();
when
(
mockFuchsiaArtifacts
.
pm
).
thenReturn
(
pm
);
...
...
@@ -74,6 +74,5 @@ void main() {
class
MockFuchsiaArtifacts
extends
Mock
implements
FuchsiaArtifacts
{}
class
MockProcessUtils
extends
Mock
implements
ProcessUtils
{}
class
MockFile
extends
Mock
implements
File
{}
class
MockProcess
extends
Mock
implements
Process
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
packages/flutter_tools/test/general.shard/github_template_test.dart
View file @
e8fbb43a
...
...
@@ -21,7 +21,7 @@ void main() {
FileSystem
fs
;
setUp
(()
{
logger
=
BufferLogger
.
test
();
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
});
group
(
'GitHub template creator'
,
()
{
...
...
@@ -170,7 +170,7 @@ void main() {
_kShortURL
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -196,7 +196,7 @@ void main() {
);
expect
(
logger
.
traceText
,
contains
(
'Failed to shorten GitHub template URL'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
e8fbb43a
...
...
@@ -42,7 +42,7 @@ void main() {
Logger
logger
;
IOSDeploy
iosDeploy
;
IMobileDevice
iMobileDevice
;
FileSystem
mock
FileSystem
;
FileSystem
null
FileSystem
;
setUp
(()
{
mockArtifacts
=
MockArtifacts
();
...
...
@@ -70,7 +70,7 @@ void main() {
IOSDevice
(
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
mock
FileSystem
,
fileSystem:
null
FileSystem
,
logger:
logger
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
...
...
@@ -87,7 +87,7 @@ void main() {
expect
(
IOSDevice
(
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
mock
FileSystem
,
fileSystem:
null
FileSystem
,
logger:
logger
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
...
...
@@ -101,7 +101,7 @@ void main() {
expect
(
IOSDevice
(
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
mock
FileSystem
,
fileSystem:
null
FileSystem
,
logger:
logger
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
...
...
@@ -115,7 +115,7 @@ void main() {
expect
(
IOSDevice
(
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
mock
FileSystem
,
fileSystem:
null
FileSystem
,
logger:
logger
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
...
...
@@ -129,7 +129,7 @@ void main() {
expect
(
IOSDevice
(
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
mock
FileSystem
,
fileSystem:
null
FileSystem
,
logger:
logger
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
...
...
@@ -143,7 +143,7 @@ void main() {
expect
(
IOSDevice
(
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
mock
FileSystem
,
fileSystem:
null
FileSystem
,
logger:
logger
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
...
...
@@ -160,7 +160,7 @@ void main() {
final
IOSDevice
device
=
IOSDevice
(
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
mock
FileSystem
,
fileSystem:
null
FileSystem
,
logger:
logger
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
...
...
@@ -185,7 +185,7 @@ void main() {
IOSDevice
(
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
mock
FileSystem
,
fileSystem:
null
FileSystem
,
logger:
logger
,
platform:
platform
,
iosDeploy:
iosDeploy
,
...
...
@@ -217,7 +217,7 @@ void main() {
MockCache
mockCache
;
Logger
logger
;
IOSDeploy
iosDeploy
;
FileSystem
mock
FileSystem
;
FileSystem
null
FileSystem
;
IProxy
iproxy
;
IOSDevicePortForwarder
createPortForwarder
(
...
...
@@ -228,7 +228,7 @@ void main() {
id:
device
.
id
,
logger:
logger
,
operatingSystemUtils:
OperatingSystemUtils
(
fileSystem:
mock
FileSystem
,
fileSystem:
null
FileSystem
,
logger:
logger
,
platform:
FakePlatform
(
operatingSystem:
'macos'
),
processManager:
FakeProcessManager
.
any
(),
...
...
@@ -276,7 +276,7 @@ void main() {
device
=
IOSDevice
(
'123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
mock
FileSystem
,
fileSystem:
null
FileSystem
,
logger:
logger
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
...
...
packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart
View file @
e8fbb43a
...
...
@@ -46,7 +46,7 @@ void main () {
MockXcode
mockXcode
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
mockXcode
=
MockXcode
();
xcodeProjectInfoFile
=
memoryFileSystem
.
file
(
'project.pbxproj'
);
...
...
@@ -265,7 +265,7 @@ keep this 2
File
xcodeWorkspaceSharedSettings
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
xcodeWorkspaceSharedSettings
=
memoryFileSystem
.
file
(
'WorkspaceSettings.xcsettings'
);
testLogger
=
BufferLogger
(
...
...
@@ -345,7 +345,7 @@ keep this 2
File
xcodeProjectInfoFile
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
xcodeProjectInfoFile
=
memoryFileSystem
.
file
(
'project.pbxproj'
);
testLogger
=
BufferLogger
(
...
...
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
e8fbb43a
...
...
@@ -31,7 +31,6 @@ final Map<Type, Generator> noColorTerminalOverride = <Type, Generator>{
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockFile
extends
Mock
implements
File
{}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
class
MockIosProject
extends
Mock
implements
IosProject
{}
...
...
@@ -58,21 +57,18 @@ void main() {
});
group
(
'screenshot'
,
()
{
final
String
outputPath
=
globals
.
fs
.
path
.
join
(
'some'
,
'test'
,
'path'
,
'image.png'
);
MockProcessManager
mockProcessManager
;
MockFile
mockO
utputFile
;
File
o
utputFile
;
setUp
(()
{
mockProcessManager
=
MockProcessManager
();
mockOutputFile
=
MockFile
(
);
outputFile
=
MemoryFileSystem
.
test
().
file
(
'image.png'
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
idevicescreenshot
,
platform:
anyNamed
(
'platform'
))).
thenReturn
(
idevicescreenshotPath
);
});
testWithoutContext
(
'error if idevicescreenshot is not installed'
,
()
async
{
when
(
mockOutputFile
.
path
).
thenReturn
(
outputPath
);
// Let `idevicescreenshot` fail with exit code 1.
when
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
output
P
ath
],
when
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
output
File
.
p
ath
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
workingDirectory:
null
,
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
1
,
''
,
''
)));
...
...
@@ -85,14 +81,13 @@ void main() {
);
expect
(()
async
=>
await
iMobileDevice
.
takeScreenshot
(
mockO
utputFile
,
o
utputFile
,
'1234'
,
IOSDeviceInterface
.
usb
,
),
throwsA
(
anything
));
});
testWithoutContext
(
'idevicescreenshot captures and returns USB screenshot'
,
()
async
{
when
(
mockOutputFile
.
path
).
thenReturn
(
outputPath
);
when
(
mockProcessManager
.
run
(
any
,
environment:
anyNamed
(
'environment'
),
workingDirectory:
null
)).
thenAnswer
(
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
...
...
@@ -104,18 +99,17 @@ void main() {
);
await
iMobileDevice
.
takeScreenshot
(
mockO
utputFile
,
o
utputFile
,
'1234'
,
IOSDeviceInterface
.
usb
,
);
verify
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
output
P
ath
,
'--udid'
,
'1234'
],
verify
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
output
File
.
p
ath
,
'--udid'
,
'1234'
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
workingDirectory:
null
,
));
});
testWithoutContext
(
'idevicescreenshot captures and returns network screenshot'
,
()
async
{
when
(
mockOutputFile
.
path
).
thenReturn
(
outputPath
);
when
(
mockProcessManager
.
run
(
any
,
environment:
anyNamed
(
'environment'
),
workingDirectory:
null
)).
thenAnswer
(
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
...
...
@@ -127,11 +121,11 @@ void main() {
);
await
iMobileDevice
.
takeScreenshot
(
mockO
utputFile
,
o
utputFile
,
'1234'
,
IOSDeviceInterface
.
network
,
);
verify
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
output
P
ath
,
'--udid'
,
'1234'
,
'--network'
],
verify
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
output
File
.
p
ath
,
'--udid'
,
'1234'
,
'--network'
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
workingDirectory:
null
,
));
...
...
@@ -403,33 +397,27 @@ Exited (sigterm)''',
});
group('Upgrades project.pbxproj for old asset usage', () {
const List<String> flutterAssetPbxProjLines = <String>[
'/* flutter_assets */',
'/* App.framework',
'another line',
];
const List<String> appFlxPbxProjLines = <String>[
'/* app.flx',
'/* App.framework',
'another line',
];
const List<String> cleanPbxProjLines = <String>[
'/* App.framework',
'another line',
];
const String flutterAssetPbxProjLines =
'/* flutter_assets */
\n
'
'/* App.framework
\n
'
'another line';
const String appFlxPbxProjLines =
'/* app.flx
\n
'
'/* App.framework
\n
'
'another line';
const String cleanPbxProjLines =
'/* App.framework
\n
'
'another line';
testWithoutContext('upgradePbxProjWithFlutterAssets', () async {
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.hostAppBundleName(any)).thenAnswer((_) => Future<String>.value('UnitTestRunner.app'));
when(pbxprojFile.readAsLinesSync())
.thenAnswer((_) => flutterAssetPbxProjLines);
when(pbxprojFile.existsSync())
.thenAnswer((_) => true);
bool result = upgradePbxProjWithFlutterAssets(project, logger);
expect(result, true);
...
...
@@ -439,8 +427,7 @@ Exited (sigterm)''',
);
logger.clear();
when(pbxprojFile.readAsLinesSync())
.thenAnswer((_) => appFlxPbxProjLines);
pbxprojFile.writeAsStringSync(appFlxPbxProjLines);
result = upgradePbxProjWithFlutterAssets(project, logger);
expect(result, true);
expect(
...
...
@@ -449,8 +436,7 @@ Exited (sigterm)''',
);
logger.clear();
when(pbxprojFile.readAsLinesSync())
.thenAnswer((_) => cleanPbxProjLines);
pbxprojFile.writeAsStringSync(cleanPbxProjLines);
result = upgradePbxProjWithFlutterAssets(project, logger);
expect(result, true);
expect(
...
...
packages/flutter_tools/test/general.shard/ios/simulators_test.dart
View file @
e8fbb43a
...
...
@@ -27,7 +27,6 @@ import '../../src/common.dart';
import
'../../src/context.dart'
;
import
'../../src/mocks.dart'
;
class
MockFile
extends
Mock
implements
File
{}
class
MockIMobileDevice
extends
Mock
implements
IMobileDevice
{}
class
MockLogger
extends
Mock
implements
Logger
{}
class
MockProcess
extends
Mock
implements
Process
{}
...
...
@@ -376,8 +375,6 @@ void main() {
MockLogger
mockLogger
;
MockProcessManager
mockProcessManager
;
IOSSimulator
deviceUnderTest
;
// only used for fs.path.join()
final
FileSystem
fs
=
globals
.
fs
;
setUp
(()
{
mockXcode
=
MockXcode
();
...
...
@@ -415,9 +412,8 @@ void main() {
when
(
mockXcode
.
majorVersion
).
thenReturn
(
8
);
when
(
mockXcode
.
minorVersion
).
thenReturn
(
2
);
expect
(
deviceUnderTest
.
supportsScreenshot
,
true
);
final
MockFile
mockFile
=
MockFile
();
when
(
mockFile
.
path
).
thenReturn
(
fs
.
path
.
join
(
'some'
,
'path'
,
'to'
,
'screenshot.png'
));
await
deviceUnderTest
.
takeScreenshot
(
mockFile
);
final
File
screenshot
=
MemoryFileSystem
.
test
().
file
(
'screenshot.png'
);
await
deviceUnderTest
.
takeScreenshot
(
screenshot
);
verify
(
mockProcessManager
.
run
(
<
String
>[
'/usr/bin/xcrun'
,
...
...
@@ -425,7 +421,7 @@ void main() {
'io'
,
'x'
,
'screenshot'
,
fs
.
path
.
join
(
'some'
,
'path'
,
'to'
,
'screenshot.png'
)
,
'screenshot.png'
,
],
environment:
null
,
workingDirectory:
null
,
...
...
@@ -944,7 +940,7 @@ flutter:
);
expect
(
simulator
.
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -962,7 +958,7 @@ flutter:
);
expect
(
simulator
.
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -978,7 +974,7 @@ flutter:
);
expect
(
simulator
.
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
...
...
packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart
View file @
e8fbb43a
...
...
@@ -33,7 +33,7 @@ void main() {
setUp
(()
{
processManager
=
mocks
.
MockProcessManager
();
platform
=
FakePlatform
(
operatingSystem:
'macos'
);
final
FileSystem
fileSystem
=
MemoryFileSystem
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
fileSystem
.
file
(
xcodebuild
).
createSync
(
recursive:
true
);
final
AnsiTerminal
terminal
=
MockAnsiTerminal
();
logger
=
BufferLogger
.
test
(
...
...
@@ -85,7 +85,7 @@ void main() {
setUp
(()
{
fakeProcessManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[]);
platform
=
FakePlatform
(
operatingSystem:
'macos'
);
fileSystem
=
MemoryFileSystem
();
fileSystem
=
MemoryFileSystem
.
test
();
fileSystem
.
file
(
xcodebuild
).
createSync
(
recursive:
true
);
terminal
=
MockAnsiTerminal
();
logger
=
BufferLogger
.
test
(
...
...
@@ -534,7 +534,7 @@ Information about project "Runner":
FileSystem
fs
;
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
mockArtifacts
=
MockLocalEngineArtifacts
();
macOS
=
FakePlatform
(
operatingSystem:
'macos'
);
fs
.
file
(
xcodebuild
).
createSync
(
recursive:
true
);
...
...
packages/flutter_tools/test/general.shard/linux/linux_device_test.dart
View file @
e8fbb43a
...
...
@@ -104,7 +104,7 @@ void main() {
fileSystem:
MemoryFileSystem
.
test
(),
).
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -119,7 +119,7 @@ void main() {
fileSystem:
MemoryFileSystem
.
test
(),
).
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -141,7 +141,7 @@ void main() {
expect
(
device
.
executablePathForDevice
(
mockApp
,
BuildMode
.
profile
),
profilePath
);
expect
(
device
.
executablePathForDevice
(
mockApp
,
BuildMode
.
release
),
releasePath
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
}
...
...
packages/flutter_tools/test/general.shard/persistent_tool_state_test.dart
View file @
e8fbb43a
...
...
@@ -12,7 +12,7 @@ import '../src/common.dart';
void
main
(
)
{
testWithoutContext
(
'state can be set and persists'
,
()
{
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
();
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
Directory
directory
=
fileSystem
.
directory
(
'state_dir'
);
directory
.
createSync
();
final
File
stateFile
=
directory
.
childFile
(
'.flutter_tool_state'
);
...
...
@@ -35,7 +35,7 @@ void main() {
});
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
PersistentToolState
state1
=
PersistentToolState
.
test
(
directory:
directory
,
...
...
packages/flutter_tools/test/general.shard/plugins_test.dart
View file @
e8fbb43a
...
...
@@ -106,7 +106,7 @@ void main() {
}
setUp
(()
async
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
fsWindows
=
MemoryFileSystem
(
style:
FileSystemStyle
.
windows
);
mockClock
=
MockClock
();
mockVersion
=
MockFlutterVersion
();
...
...
@@ -841,8 +841,7 @@ dependencies:
testUsingContext
(
'Does not throw when AndroidManifest.xml is not found'
,
()
async
{
when
(
flutterProject
.
isModule
).
thenReturn
(
false
);
final
File
manifest
=
MockFile
();
when
(
manifest
.
existsSync
()).
thenReturn
(
false
);
final
File
manifest
=
fs
.
file
(
'AndroidManifest.xml'
);
when
(
androidProject
.
appManifestFile
).
thenReturn
(
manifest
);
await
injectPlugins
(
flutterProject
);
...
...
@@ -1421,8 +1420,6 @@ flutter:
class
MockAndroidProject
extends
Mock
implements
AndroidProject
{}
class
MockFeatureFlags
extends
Mock
implements
FeatureFlags
{}
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
MockMacOSProject
extends
Mock
implements
MacOSProject
{}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
...
...
packages/flutter_tools/test/general.shard/project_file_invalidator_test.dart
View file @
e8fbb43a
...
...
@@ -18,7 +18,7 @@ final DateTime inFuture = DateTime.now().add(const Duration(days: 100));
void
main
(
)
{
for
(
final
bool
asyncScanning
in
<
bool
>[
true
,
false
])
{
testWithoutContext
(
'No last compile, asyncScanning:
$asyncScanning
'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
ProjectFileInvalidator
projectFileInvalidator
=
ProjectFileInvalidator
(
fileSystem:
fileSystem
,
platform:
FakePlatform
(),
...
...
@@ -39,7 +39,7 @@ void main() {
});
testWithoutContext
(
'Empty project, asyncScanning:
$asyncScanning
'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
ProjectFileInvalidator
projectFileInvalidator
=
ProjectFileInvalidator
(
fileSystem:
fileSystem
,
platform:
FakePlatform
(),
...
...
@@ -60,9 +60,9 @@ void main() {
});
testWithoutContext
(
'Non-existent files are ignored, asyncScanning:
$asyncScanning
'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
ProjectFileInvalidator
projectFileInvalidator
=
ProjectFileInvalidator
(
fileSystem:
MemoryFileSystem
(),
fileSystem:
MemoryFileSystem
.
test
(),
platform:
FakePlatform
(),
logger:
BufferLogger
.
test
(),
);
...
...
packages/flutter_tools/test/general.shard/project_test.dart
View file @
e8fbb43a
...
...
@@ -167,7 +167,7 @@ void main() {
await
project
.
ensureReadyForPlatformSpecificTooling
();
expectExists
(
project
.
macos
.
managedDirectory
.
childFile
(
'GeneratedPluginRegistrant.swift'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isMacOSEnabled:
true
),
FlutterProjectFactory:
()
=>
FlutterProjectFactory
(
...
...
@@ -181,7 +181,7 @@ void main() {
await
project
.
ensureReadyForPlatformSpecificTooling
();
expectExists
(
project
.
macos
.
generatedXcodePropertiesFile
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isMacOSEnabled:
true
),
FlutterProjectFactory:
()
=>
FlutterProjectFactory
(
...
...
@@ -196,7 +196,7 @@ void main() {
expectExists
(
project
.
linux
.
managedDirectory
.
childFile
(
'generated_plugin_registrant.h'
));
expectExists
(
project
.
linux
.
managedDirectory
.
childFile
(
'generated_plugin_registrant.cc'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isLinuxEnabled:
true
),
FlutterProjectFactory:
()
=>
FlutterProjectFactory
(
...
...
@@ -211,7 +211,7 @@ void main() {
expectExists
(
project
.
windows
.
managedDirectory
.
childFile
(
'generated_plugin_registrant.h'
));
expectExists
(
project
.
windows
.
managedDirectory
.
childFile
(
'generated_plugin_registrant.cc'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsEnabled:
true
),
FlutterProjectFactory:
()
=>
FlutterProjectFactory
(
...
...
@@ -294,7 +294,7 @@ void main() {
MemoryFileSystem
fs
;
FlutterProjectFactory
flutterProjectFactory
;
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
mockXcodeProjectInterpreter
=
MockXcodeProjectInterpreter
();
flutterProjectFactory
=
FlutterProjectFactory
(
logger:
logger
,
...
...
@@ -332,7 +332,7 @@ apply plugin: 'kotlin-android'
MockXcodeProjectInterpreter
mockXcodeProjectInterpreter
;
FlutterProjectFactory
flutterProjectFactory
;
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
mockPlistUtils
=
MockPlistUtils
();
mockXcodeProjectInterpreter
=
MockXcodeProjectInterpreter
();
flutterProjectFactory
=
FlutterProjectFactory
(
...
...
@@ -496,7 +496,7 @@ apply plugin: 'kotlin-android'
MemoryFileSystem
fs
;
MockXcodeProjectInterpreter
mockXcodeProjectInterpreter
;
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
mockXcodeProjectInterpreter
=
MockXcodeProjectInterpreter
();
});
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
e8fbb43a
...
...
@@ -2196,7 +2196,7 @@ void main() {
expect
(
testLogger
.
errorText
,
contains
(
'Failed to write vmservice-out-file at foo'
));
expect
(
fakeVmServiceHost
.
hasRemainingExpectations
,
false
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
ThrowingForwardingFileSystem
(
MemoryFileSystem
()),
FileSystem:
()
=>
ThrowingForwardingFileSystem
(
MemoryFileSystem
.
test
()),
}));
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_runner_test.dart
View file @
e8fbb43a
...
...
@@ -39,7 +39,7 @@ void main() {
});
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
fs
.
directory
(
_kFlutterRoot
).
createSync
(
recursive:
true
);
fs
.
directory
(
_kProjectRoot
).
createSync
(
recursive:
true
);
fs
.
currentDirectory
=
_kProjectRoot
;
...
...
packages/flutter_tools/test/general.shard/runner/runner_test.dart
View file @
e8fbb43a
...
...
@@ -89,7 +89,7 @@ void main() {
'FLUTTER_ANALYTICS_LOG_FILE'
:
'test'
,
'FLUTTER_ROOT'
:
'/'
,
}),
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Usage:
()
=>
CrashingUsage
(),
});
...
...
@@ -130,7 +130,7 @@ void main() {
'FLUTTER_ANALYTICS_LOG_FILE'
:
'test'
,
'FLUTTER_ROOT'
:
'/'
,
}),
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
CrashReporter:
()
=>
WaitingCrashReporter
(
commandCompleter
.
future
),
...
...
@@ -190,7 +190,7 @@ void main() {
},
operatingSystem:
'linux'
),
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
UserMessages:
()
=>
CustomBugInstructions
(),
});
...
...
packages/flutter_tools/test/general.shard/vscode/vscode_test.dart
View file @
e8fbb43a
...
...
@@ -26,7 +26,7 @@ void main() {
expect
(
vsCode
.
version
,
Version
.
unknown
);
expect
(
bufferLogger
.
traceText
,
contains
(
'Error parsing VSCode'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
}
packages/flutter_tools/test/general.shard/windows/windows_device_test.dart
View file @
e8fbb43a
...
...
@@ -76,7 +76,7 @@ void main() {
expect
(
WindowsDevice
().
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -87,7 +87,7 @@ void main() {
expect
(
WindowsDevice
().
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -99,7 +99,7 @@ void main() {
expect
(
WindowsDevice
().
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -116,7 +116,7 @@ void main() {
expect
(
WindowsDevice
().
executablePathForDevice
(
mockApp
,
BuildMode
.
profile
),
profilePath
);
expect
(
WindowsDevice
().
executablePathForDevice
(
mockApp
,
BuildMode
.
release
),
releasePath
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
...
...
packages/flutter_tools/test/general.shard/windows/windows_workflow_test.dart
View file @
e8fbb43a
...
...
@@ -5,7 +5,6 @@
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/windows/windows_workflow.dart'
;
import
'package:mockito/mockito.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
...
...
@@ -13,14 +12,12 @@ import '../../src/testbed.dart';
void
main
(
)
{
Testbed
testbed
;
Mock
Platform
windows
;
Mock
Platform
notWindows
;
Fake
Platform
windows
;
Fake
Platform
notWindows
;
setUp
(()
{
windows
=
MockPlatform
();
notWindows
=
MockPlatform
();
when
(
windows
.
isWindows
).
thenReturn
(
true
);
when
(
notWindows
.
isWindows
).
thenReturn
(
false
);
windows
=
FakePlatform
(
operatingSystem:
'windows'
);
notWindows
=
FakePlatform
(
operatingSystem:
'linux'
);
testbed
=
Testbed
(
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windows
,
...
...
@@ -54,8 +51,3 @@ void main() {
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsEnabled:
false
),
}));
}
class
MockPlatform
extends
Mock
implements
Platform
{
@override
final
Map
<
String
,
String
>
environment
=
<
String
,
String
>{};
}
packages/flutter_tools/test/template_test.dart
View file @
e8fbb43a
...
...
@@ -57,7 +57,7 @@ void main() {
});
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
imageSourceDir
=
fileSystem
.
directory
(
'template_images'
);
final
Directory
destination
=
fileSystem
.
directory
(
'target'
);
...
...
@@ -84,7 +84,7 @@ void main() {
});
testWithoutContext
(
'Template.fromName runs pub get if .packages is missing'
,
()
async
{
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
();
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
MockPub
pub
=
MockPub
();
when
(
pub
.
get
(
context:
PubContext
.
pubGet
,
...
...
@@ -107,7 +107,7 @@ void main() {
});
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
();
when
(
pub
.
get
(
context:
PubContext
.
pubGet
,
...
...
@@ -137,7 +137,7 @@ void main() {
});
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
();
Cache
.
flutterRoot
=
'/flutter'
;
final
File
packagesFile
=
fileSystem
.
directory
(
Cache
.
flutterRoot
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment