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