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
d018c24b
Unverified
Commit
d018c24b
authored
Mar 13, 2021
by
Jenn Magder
Committed by
GitHub
Mar 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MockProcessUtils->FakeProcessManager in version_test (#77985)
parent
fad7c367
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
222 additions
and
235 deletions
+222
-235
analyze_continuously_test.dart
...st/commands.shard/hermetic/analyze_continuously_test.dart
+3
-2
packages_test.dart
...er_tools/test/commands.shard/permeable/packages_test.dart
+4
-3
adb_log_reader_test.dart
...tools/test/general.shard/android/adb_log_reader_test.dart
+5
-4
android_device_port_forwarder_test.dart
...ral.shard/android/android_device_port_forwarder_test.dart
+2
-1
android_device_start_test.dart
...test/general.shard/android/android_device_start_test.dart
+4
-3
android_gradle_builder_test.dart
...st/general.shard/android/android_gradle_builder_test.dart
+16
-15
android_install_test.dart
...ools/test/general.shard/android/android_install_test.dart
+8
-7
build_test.dart
...ges/flutter_tools/test/general.shard/base/build_test.dart
+12
-11
android_test.dart
...test/general.shard/build_system/targets/android_test.dart
+3
-2
common_test.dart
.../test/general.shard/build_system/targets/common_test.dart
+14
-13
macos_test.dart
...s/test/general.shard/build_system/targets/macos_test.dart
+2
-1
pub_get_test.dart
...s/flutter_tools/test/general.shard/dart/pub_get_test.dart
+7
-6
flutter_tester_device_test.dart
..._tools/test/general.shard/flutter_tester_device_test.dart
+2
-1
ios_deploy_test.dart
...flutter_tools/test/general.shard/ios/ios_deploy_test.dart
+4
-3
ios_device_install_test.dart
...tools/test/general.shard/ios/ios_device_install_test.dart
+8
-7
ios_device_port_forwarder_test.dart
...est/general.shard/ios/ios_device_port_forwarder_test.dart
+2
-1
ios_device_start_nonprebuilt_test.dart
.../general.shard/ios/ios_device_start_nonprebuilt_test.dart
+3
-3
ios_device_start_prebuilt_test.dart
...est/general.shard/ios/ios_device_start_prebuilt_test.dart
+3
-2
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+3
-2
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+1
-0
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+1
-0
version_test.dart
packages/flutter_tools/test/general.shard/version_test.dart
+75
-146
devices_test.dart
...es/flutter_tools/test/general.shard/web/devices_test.dart
+3
-2
fake_process_manager.dart
packages/flutter_tools/test/src/fake_process_manager.dart
+37
-0
No files found.
packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart
View file @
d018c24b
...
...
@@ -23,6 +23,7 @@ import 'package:process/process.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
void
main
(
)
{
setUpAll
(()
{
...
...
@@ -206,7 +207,7 @@ void main() {
unawaited
(
commandRunner
.
run
(<
String
>[
'analyze'
,
'--watch'
]));
await
stdin
.
stream
.
first
;
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'Can run AnalysisService with customized cache location --watch'
,
()
async
{
...
...
@@ -244,6 +245,6 @@ void main() {
unawaited
(
commandRunner
.
run
(<
String
>[
'analyze'
,
'--watch'
]));
await
stdin
.
stream
.
first
;
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
}
packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
View file @
d018c24b
...
...
@@ -23,6 +23,7 @@ import 'package:flutter_tools/src/globals.dart' as globals;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
import
'../../src/testbed.dart'
;
...
...
@@ -456,7 +457,7 @@ void main() {
);
await
createTestCommandRunner
(
PackagesCommand
()).
run
(<
String
>[
'packages'
,
'test'
]);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
,
environment:
<
String
,
String
>{}),
...
...
@@ -481,7 +482,7 @@ void main() {
);
await
createTestCommandRunner
(
PackagesCommand
()).
run
(<
String
>[
'packages'
,
'test'
]);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
,
environment:
<
String
,
String
>{}),
...
...
@@ -510,7 +511,7 @@ void main() {
);
await
createTestCommandRunner
(
PackagesCommand
()).
run
(<
String
>[
'packages'
,
'--verbose'
,
'pub'
,
'run'
,
'--foo'
,
'bar'
]);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
,
environment:
<
String
,
String
>{}),
...
...
packages/flutter_tools/test/general.shard/android/adb_log_reader_test.dart
View file @
d018c24b
...
...
@@ -11,6 +11,7 @@ import 'package:test/fake.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
const
int
kLollipopVersionCode
=
21
;
const
String
kLastLogcatTimestamp
=
'11-27 15:39:04.506'
;
...
...
@@ -43,7 +44,7 @@ void main() {
processManager
,
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'AdbLogReader calls adb logcat with expected flags apiVersion < 21'
,
()
async
{
...
...
@@ -66,7 +67,7 @@ void main() {
processManager
,
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'AdbLogReader calls adb logcat with expected flags null apiVersion'
,
()
async
{
...
...
@@ -89,7 +90,7 @@ void main() {
processManager
,
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'AdbLogReader calls adb logcat with expected flags when requesting past logs'
,
()
async
{
...
...
@@ -115,7 +116,7 @@ void main() {
includePastLogs:
true
,
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'AdbLogReader handles process early exit'
,
()
async
{
...
...
packages/flutter_tools/test/general.shard/android/android_device_port_forwarder_test.dart
View file @
d018c24b
...
...
@@ -11,6 +11,7 @@ import 'package:flutter_tools/src/device.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
void
main
(
)
{
testWithoutContext
(
'AndroidDevicePortForwarder returns the generated host '
...
...
@@ -123,7 +124,7 @@ void main() {
await
forwarder
.
dispose
();
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'failures to unforward port do not throw if the forward is missing'
,
()
async
{
...
...
packages/flutter_tools/test/general.shard/android/android_device_start_test.dart
View file @
d018c24b
...
...
@@ -17,6 +17,7 @@ import 'package:test/fake.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
const
FakeCommand
kAdbVersionCommand
=
FakeCommand
(
command:
<
String
>[
'adb'
,
'version'
],
...
...
@@ -121,7 +122,7 @@ void main() {
);
expect
(
launchResult
.
started
,
true
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
}
...
...
@@ -160,7 +161,7 @@ void main() {
);
expect
(
launchResult
.
started
,
false
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'AndroidDevice.startApp forwards all supported debugging options'
,
()
async
{
...
...
@@ -285,7 +286,7 @@ void main() {
// This fails to start due to observatory discovery issues.
expect
(
launchResult
.
started
,
false
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
}
...
...
packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart
View file @
d018c24b
...
...
@@ -23,6 +23,7 @@ import 'package:test/fake.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
void
main
(
)
{
group
(
'gradle build'
,
()
{
...
...
@@ -372,7 +373,7 @@ void main() {
);
},
throwsA
(
isA
<
ProcessException
>()));
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'logs success event after a successful retry'
,
()
async
{
...
...
@@ -470,7 +471,7 @@ void main() {
parameters:
<
String
,
String
>{},
),
));
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'performs code size analysis and sends analytics'
,
()
async
{
...
...
@@ -678,7 +679,7 @@ void main() {
parameters:
<
String
,
String
>{},
),
));
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'indicates that an APK has been built successfully'
,
()
async
{
...
...
@@ -742,7 +743,7 @@ void main() {
logger
.
statusText
,
contains
(
'Built build/app/outputs/flutter-apk/app-release.apk (0.0MB)'
),
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
"doesn't indicate how to consume an AAR when printHowToConsumeAar is false"
,
()
async
{
...
...
@@ -805,7 +806,7 @@ void main() {
logger
.
statusText
.
contains
(
'Consuming the Module'
),
isFalse
,
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'gradle exit code and stderr is forwarded to tool exit'
,
()
async
{
...
...
@@ -861,7 +862,7 @@ void main() {
target:
''
,
buildNumber:
'1.0'
,
),
throwsToolExit
(
exitCode:
108
,
message:
'Gradle task assembleAarRelease failed with exit code 108.'
));
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'build apk uses selected local engine with arm32 ABI'
,
()
async
{
...
...
@@ -935,7 +936,7 @@ void main() {
localGradleErrors:
const
<
GradleHandledError
>[],
);
},
throwsToolExit
());
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'build apk uses selected local engine with arm64 ABI'
,
()
async
{
...
...
@@ -1009,7 +1010,7 @@ void main() {
localGradleErrors:
const
<
GradleHandledError
>[],
);
},
throwsToolExit
());
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'build apk uses selected local engine with x86 ABI'
,
()
async
{
...
...
@@ -1083,7 +1084,7 @@ void main() {
localGradleErrors:
const
<
GradleHandledError
>[],
);
},
throwsToolExit
());
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'build apk uses selected local engine with x64 ABI'
,
()
async
{
...
...
@@ -1157,7 +1158,7 @@ void main() {
localGradleErrors:
const
<
GradleHandledError
>[],
);
},
throwsToolExit
());
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'honors --no-android-gradle-daemon setting'
,
()
async
{
...
...
@@ -1212,7 +1213,7 @@ void main() {
localGradleErrors:
const
<
GradleHandledError
>[],
);
},
throwsToolExit
());
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'build aar uses selected local engine with arm32 ABI'
,
()
async
{
...
...
@@ -1297,7 +1298,7 @@ void main() {
'1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/'
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
),
exists
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'build aar uses selected local engine with x64 ABI'
,
()
async
{
...
...
@@ -1382,7 +1383,7 @@ void main() {
'1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/'
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
),
exists
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'build aar uses selected local engine with x86 ABI'
,
()
async
{
...
...
@@ -1467,7 +1468,7 @@ void main() {
'1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/'
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
),
exists
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'build aar uses selected local engine on x64 ABI'
,
()
async
{
...
...
@@ -1552,7 +1553,7 @@ void main() {
'1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/'
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
),
exists
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
});
}
...
...
packages/flutter_tools/test/general.shard/android/android_install_test.dart
View file @
d018c24b
...
...
@@ -15,6 +15,7 @@ import 'package:test/fake.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
const
FakeCommand
kAdbVersionCommand
=
FakeCommand
(
command:
<
String
>[
'adb'
,
'version'
],
...
...
@@ -84,7 +85,7 @@ void main() {
);
expect
(
await
androidDevice
.
installApp
(
androidApk
),
false
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'Cannot install app if APK file is missing'
,
()
async
{
...
...
@@ -128,7 +129,7 @@ void main() {
);
expect
(
await
androidDevice
.
installApp
(
androidApk
,
userIdentifier:
'10'
),
true
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'Defaults to API level 16 if adb returns a null response'
,
()
async
{
...
...
@@ -157,7 +158,7 @@ void main() {
);
expect
(
await
androidDevice
.
installApp
(
androidApk
,
userIdentifier:
'10'
),
true
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'displays error if user not found'
,
()
async
{
...
...
@@ -202,7 +203,7 @@ void main() {
expect
(
await
androidDevice
.
installApp
(
androidApk
,
userIdentifier:
'jane'
),
false
);
expect
(
logger
.
errorText
,
contains
(
'Error: User "jane" not found. Run "adb shell pm list users" to see list of available identifiers.'
));
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'Will skip install if the correct version is up to date'
,
()
async
{
...
...
@@ -235,7 +236,7 @@ void main() {
);
expect
(
await
androidDevice
.
installApp
(
androidApk
,
userIdentifier:
'10'
),
true
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'Will uninstall if the correct version is not up to date and install fails'
,
()
async
{
...
...
@@ -276,7 +277,7 @@ void main() {
);
expect
(
await
androidDevice
.
installApp
(
androidApk
,
userIdentifier:
'10'
),
true
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'Will fail to install if the apk was never installed and it fails the first time'
,
()
async
{
...
...
@@ -309,7 +310,7 @@ void main() {
);
expect
(
await
androidDevice
.
installApp
(
androidApk
,
userIdentifier:
'10'
),
false
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
}
...
...
packages/flutter_tools/test/general.shard/base/build_test.dart
View file @
d018c24b
...
...
@@ -13,6 +13,7 @@ import 'package:flutter_tools/src/macos/xcode.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
const
FakeCommand
kWhichSysctlCommand
=
FakeCommand
(
command:
<
String
>[
...
...
@@ -296,7 +297,7 @@ void main() {
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'builds iOS armv7 snapshot with dwarStackTraces'
,
()
async
{
...
...
@@ -354,7 +355,7 @@ void main() {
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'builds iOS armv7 snapshot with obfuscate'
,
()
async
{
...
...
@@ -410,7 +411,7 @@ void main() {
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
...
...
@@ -465,7 +466,7 @@ void main() {
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'builds iOS arm64 snapshot'
,
()
async
{
...
...
@@ -517,7 +518,7 @@ void main() {
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'builds shared library for android-arm (32bit)'
,
()
async
{
...
...
@@ -546,7 +547,7 @@ void main() {
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'builds shared library for android-arm with dwarf stack traces'
,
()
async
{
...
...
@@ -578,7 +579,7 @@ void main() {
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'builds shared library for android-arm with obfuscate'
,
()
async
{
...
...
@@ -608,7 +609,7 @@ void main() {
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'builds shared library for android-arm without dwarf stack traces due to empty string'
,
()
async
{
...
...
@@ -637,7 +638,7 @@ void main() {
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'builds shared library for android-arm64'
,
()
async
{
...
...
@@ -664,7 +665,7 @@ void main() {
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'--no-strip in extraGenSnapshotOptions suppresses --strip'
,
()
async
{
...
...
@@ -691,7 +692,7 @@ void main() {
);
expect
(
genSnapshotExitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
});
}
packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart
View file @
d018c24b
...
...
@@ -21,6 +21,7 @@ import 'package:flutter_tools/src/convert.dart';
import
'../../../src/common.dart'
;
import
'../../../src/context.dart'
;
import
'../../../src/fake_process_manager.dart'
;
final
Platform
platform
=
FakePlatform
(
operatingSystem:
'linux'
,
environment:
const
<
String
,
String
>{});
void
main
(
)
{
...
...
@@ -204,7 +205,7 @@ void main() {
await
androidAot
.
build
(
environment
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
...
...
@@ -246,7 +247,7 @@ void main() {
await
androidAot
.
build
(
environment
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
...
...
packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart
View file @
d018c24b
...
...
@@ -18,6 +18,7 @@ import 'package:flutter_tools/src/compile.dart';
import
'../../../src/common.dart'
;
import
'../../../src/context.dart'
;
import
'../../../src/fake_process_manager.dart'
;
const
String
kBoundaryKey
=
'4d2d9609-c662-4571-afde-31410f96caa6'
;
const
String
kElfAot
=
'--snapshot_kind=app-aot-elf'
;
...
...
@@ -105,7 +106,7 @@ void main() {
await
expectLater
(()
=>
const
KernelSnapshot
().
build
(
androidEnvironment
),
throwsA
(
isA
<
Exception
>()));
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'KernelSnapshot does not use track widget creation on profile builds'
,
()
async
{
...
...
@@ -141,7 +142,7 @@ void main() {
await
const
KernelSnapshot
().
build
(
androidEnvironment
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'KernelSnapshot correctly handles an empty string in ExtraFrontEndOptions'
,
()
async
{
...
...
@@ -178,7 +179,7 @@ void main() {
await
const
KernelSnapshot
()
.
build
(
androidEnvironment
..
defines
[
kExtraFrontEndOptions
]
=
''
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'KernelSnapshot correctly forwards ExtraFrontEndOptions'
,
()
async
{
...
...
@@ -217,7 +218,7 @@ void main() {
await
const
KernelSnapshot
()
.
build
(
androidEnvironment
..
defines
[
kExtraFrontEndOptions
]
=
'foo,bar'
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'KernelSnapshot can disable track-widget-creation on debug builds'
,
()
async
{
...
...
@@ -254,7 +255,7 @@ void main() {
..
defines
[
kBuildMode
]
=
getNameForBuildMode
(
BuildMode
.
debug
)
..
defines
[
kTrackWidgetCreation
]
=
'false'
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'KernelSnapshot forces platform linking on debug for darwin target platforms'
,
()
async
{
...
...
@@ -292,7 +293,7 @@ void main() {
..
defines
[
kTrackWidgetCreation
]
=
'false'
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'KernelSnapshot does use track widget creation on debug builds'
,
()
async
{
...
...
@@ -339,7 +340,7 @@ void main() {
await
const
KernelSnapshot
().
build
(
testEnvironment
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'AotElfProfile Produces correct output directory'
,
()
async
{
...
...
@@ -364,7 +365,7 @@ void main() {
await
const
AotElfProfile
(
TargetPlatform
.
android_arm
).
build
(
androidEnvironment
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'AotElfRelease configures gen_snapshot with code size directory'
,
()
async
{
...
...
@@ -392,7 +393,7 @@ void main() {
await
const
AotElfRelease
(
TargetPlatform
.
android_arm
).
build
(
androidEnvironment
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'AotElfProfile throws error if missing build mode'
,
()
async
{
...
...
@@ -548,7 +549,7 @@ void main() {
await
const
AotAssemblyProfile
().
build
(
iosEnvironment
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
macPlatform
,
FileSystem:
()
=>
fileSystem
,
...
...
@@ -620,7 +621,7 @@ void main() {
await
const
AotAssemblyProfile
().
build
(
iosEnvironment
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
macPlatform
,
FileSystem:
()
=>
fileSystem
,
...
...
@@ -695,7 +696,7 @@ void main() {
await
const
AotAssemblyProfile
().
build
(
iosEnvironment
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
macPlatform
,
FileSystem:
()
=>
fileSystem
,
...
...
@@ -729,6 +730,6 @@ void main() {
await
const
AotElfRelease
(
TargetPlatform
.
android_arm
).
build
(
androidEnvironment
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
}
packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
View file @
d018c24b
...
...
@@ -18,6 +18,7 @@ import 'package:flutter_tools/src/convert.dart';
import
'../../../src/common.dart'
;
import
'../../../src/context.dart'
;
import
'../../../src/fake_process_manager.dart'
;
void
main
(
)
{
Environment
environment
;
...
...
@@ -76,7 +77,7 @@ void main() {
await
const
DebugUnpackMacOS
().
build
(
environment
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
...
...
packages/flutter_tools/test/general.shard/dart/pub_get_test.dart
View file @
d018c24b
...
...
@@ -20,6 +20,7 @@ import 'package:fake_async/fake_async.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/mocks.dart'
as
mocks
;
void
main
(
)
{
...
...
@@ -93,7 +94,7 @@ void main() {
checkUpToDate:
true
,
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
expect
(
fileSystem
.
file
(
'.dart_tool/version'
).
readAsStringSync
(),
'b'
);
});
...
...
@@ -131,7 +132,7 @@ void main() {
checkUpToDate:
true
,
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
expect
(
fileSystem
.
file
(
'.dart_tool/version'
).
readAsStringSync
(),
'b'
);
});
...
...
@@ -169,7 +170,7 @@ void main() {
checkUpToDate:
true
,
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
expect
(
fileSystem
.
file
(
'.dart_tool/version'
).
readAsStringSync
(),
'b'
);
});
...
...
@@ -206,7 +207,7 @@ void main() {
checkUpToDate:
true
,
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
expect
(
fileSystem
.
file
(
'.dart_tool/version'
).
readAsStringSync
(),
'b'
);
});
...
...
@@ -245,7 +246,7 @@ void main() {
checkUpToDate:
true
,
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
expect
(
fileSystem
.
file
(
'.dart_tool/version'
).
readAsStringSync
(),
'b'
);
});
...
...
@@ -286,7 +287,7 @@ void main() {
checkUpToDate:
true
,
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
expect
(
fileSystem
.
file
(
'.dart_tool/version'
).
readAsStringSync
(),
'b'
);
});
...
...
packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart
View file @
d018c24b
...
...
@@ -22,6 +22,7 @@ import 'package:flutter_tools/src/base/platform.dart';
import
'../src/common.dart'
;
import
'../src/context.dart'
;
import
'../src/fake_process_manager.dart'
;
void
main
(
)
{
FakePlatform
platform
;
...
...
@@ -155,7 +156,7 @@ void main() {
testUsingContext
(
'Can pass additional arguments to tester binary'
,
()
async
{
await
device
.
start
(
compiledEntrypointPath:
'example.dill'
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
});
...
...
packages/flutter_tools/test/general.shard/ios/ios_deploy_test.dart
View file @
d018c24b
...
...
@@ -20,6 +20,7 @@ import 'package:flutter_tools/src/ios/ios_deploy.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
void
main
(
)
{
...
...
@@ -80,7 +81,7 @@ void main () {
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isTrue
);
expect
(
await
iosDeployDebugger
.
logLines
.
toList
(),
<
String
>[
'Did finish launching.'
]);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
expect
(
appDeltaDirectory
,
exists
);
});
});
...
...
@@ -294,7 +295,7 @@ void main () {
);
expect
(
exitCode
,
0
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'returns non-zero exit code when ios-deploy does the same'
,
()
async
{
...
...
@@ -317,7 +318,7 @@ void main () {
);
expect
(
exitCode
,
1
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
});
}
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_install_test.dart
View file @
d018c24b
...
...
@@ -21,6 +21,7 @@ import 'package:meta/meta.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
const
Map
<
String
,
String
>
kDyLdLibEntry
=
<
String
,
String
>{
...
...
@@ -64,7 +65,7 @@ void main() {
final
bool
wasInstalled
=
await
device
.
installApp
(
iosApp
);
expect
(
wasInstalled
,
true
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'IOSDevice.installApp calls ios-deploy correctly with network'
,
()
async
{
...
...
@@ -94,7 +95,7 @@ void main() {
final
bool
wasInstalled
=
await
device
.
installApp
(
iosApp
);
expect
(
wasInstalled
,
true
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'IOSDevice.uninstallApp calls ios-deploy correctly'
,
()
async
{
...
...
@@ -116,7 +117,7 @@ void main() {
final
bool
wasUninstalled
=
await
device
.
uninstallApp
(
iosApp
);
expect
(
wasUninstalled
,
true
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
group
(
'isAppInstalled'
,
()
{
...
...
@@ -141,7 +142,7 @@ void main() {
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
expect
(
isAppInstalled
,
false
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'returns true when app is installed'
,
()
async
{
...
...
@@ -165,7 +166,7 @@ void main() {
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
expect
(
isAppInstalled
,
isTrue
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'returns false when app is not installed'
,
()
async
{
...
...
@@ -190,7 +191,7 @@ void main() {
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
expect
(
isAppInstalled
,
isFalse
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
expect
(
logger
.
traceText
,
contains
(
'
${iosApp.id}
not installed on
${device.id}
'
));
});
...
...
@@ -218,7 +219,7 @@ void main() {
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
expect
(
isAppInstalled
,
isFalse
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
expect
(
logger
.
traceText
,
contains
(
stderr
));
});
});
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_port_forwarder_test.dart
View file @
d018c24b
...
...
@@ -11,6 +11,7 @@ import 'package:mockito/mockito.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
const
Map
<
String
,
String
>
kDyLdLibEntry
=
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
'/path/to/libs'
,
...
...
@@ -49,7 +50,7 @@ void main() {
// First port tried (49154) should fail, then succeed on the next
expect
(
hostPort
,
49154
+
1
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
}
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_start_nonprebuilt_test.dart
View file @
d018c24b
...
...
@@ -163,7 +163,7 @@ void main() {
expect
(
fileSystem
.
directory
(
'build/ios/iphoneos'
),
exists
);
expect
(
launchResult
.
started
,
true
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
FileSystem:
()
=>
fileSystem
,
...
...
@@ -252,7 +252,7 @@ void main() {
expect
(
launchResult
?.
started
,
true
);
expect
(
fileSystem
.
directory
(
'build/ios/iphoneos'
),
exists
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
FileSystem:
()
=>
fileSystem
,
...
...
@@ -316,7 +316,7 @@ void main() {
expect
(
logger
.
statusText
,
contains
(
'Xcode build failed due to concurrent builds, will retry in 2 seconds'
));
expect
(
launchResult
.
started
,
true
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart
View file @
d018c24b
...
...
@@ -23,6 +23,7 @@ import 'package:mockito/mockito.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
// The command used to actually launch the app with args in release/profile.
...
...
@@ -200,7 +201,7 @@ void main() {
expect
(
launchResult
.
started
,
true
);
expect
(
launchResult
.
hasObservatory
,
false
);
expect
(
await
device
.
stopApp
(
iosApp
),
false
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'IOSDevice.startApp forwards all supported debugging options'
,
()
async
{
...
...
@@ -290,7 +291,7 @@ void main() {
expect
(
launchResult
.
started
,
true
);
expect
(
await
device
.
stopApp
(
iosApp
),
false
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
}
...
...
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
d018c24b
...
...
@@ -20,6 +20,7 @@ import 'package:mockito/mockito.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
FakePlatform
_kNoColorTerminalPlatform
(
)
=>
FakePlatform
(
stdoutSupportsAnsi:
false
);
...
...
@@ -471,7 +472,7 @@ Exited (sigterm)''',
]);
await removeFinderExtendedAttributes(iosProjectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger);
expect(processManager
.hasRemainingExpectations, false
);
expect(processManager
, hasNoRemainingExpectations
);
});
testWithoutContext('ignores errors', () async {
...
...
@@ -488,7 +489,7 @@ Exited (sigterm)''',
await removeFinderExtendedAttributes(iosProjectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger);
expect(logger.traceText, contains('Failed to remove xattr com.apple.FinderInfo'));
expect(processManager
.hasRemainingExpectations, false
);
expect(processManager
, hasNoRemainingExpectations
);
});
});
}
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
d018c24b
...
...
@@ -39,6 +39,7 @@ import 'package:mockito/mockito.dart';
import
'../src/common.dart'
;
import
'../src/context.dart'
;
import
'../src/fake_process_manager.dart'
;
import
'../src/fakes.dart'
;
import
'../src/testbed.dart'
;
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
d018c24b
...
...
@@ -34,6 +34,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
import
'../src/common.dart'
;
import
'../src/context.dart'
;
import
'../src/fake_process_manager.dart'
;
import
'../src/fakes.dart'
;
import
'../src/testbed.dart'
;
...
...
packages/flutter_tools/test/general.shard/version_test.dart
View file @
d018c24b
...
...
@@ -20,6 +20,7 @@ import 'package:mockito/mockito.dart';
import
'../src/common.dart'
;
import
'../src/context.dart'
;
import
'../src/fake_process_manager.dart'
;
final
SystemClock
_testClock
=
SystemClock
.
fixed
(
DateTime
(
2015
,
1
,
1
));
final
DateTime
_stampUpToDate
=
_testClock
.
ago
(
FlutterVersion
.
checkAgeConsideredUpToDate
~/
2
);
...
...
@@ -578,168 +579,97 @@ void main() {
});
testUsingContext
(
'determine does not call fetch --tags'
,
()
{
final
MockProcessUtils
processUtils
=
MockProcessUtils
();
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://github.com/flutter/flutter.git'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
105
,
0
,
''
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*'
,
'--long'
,
'--tags'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
106
,
0
,
'v0.1.2-3-1234abcd'
,
''
),
<
String
>[
'git'
,
'describe'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
110
,
0
,
''
,
''
),
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
));
final
FakeProcessManager
fakeProcessManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*'
,
'--long'
,
'--tags'
,
'HEAD'
],
stdout:
'v0.1.2-3-1234abcd'
,
),
]);
final
ProcessUtils
processUtils
=
ProcessUtils
(
processManager:
fakeProcessManager
,
logger:
BufferLogger
.
test
(),
);
GitTagVersion
.
determine
(
processUtils
,
workingDirectory:
'.'
);
verifyNever
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
));
verifyNever
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://github.com/flutter/flutter.git'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
));
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*'
,
'--long'
,
'--tags'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
expect
(
fakeProcessManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'determine does not fetch tags on dev/stable/beta'
,
()
{
final
MockProcessUtils
processUtils
=
MockProcessUtils
();
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
105
,
0
,
'dev'
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://github.com/flutter/flutter.git'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
106
,
0
,
''
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*'
,
'--long'
,
'--tags'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
107
,
0
,
'v0.1.2-3-1234abcd'
,
''
),
<
String
>[
'git'
,
'describe'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
108
,
0
,
''
,
''
),
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
));
final
FakeProcessManager
fakeProcessManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
stdout:
'dev'
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*'
,
'--long'
,
'--tags'
,
'HEAD'
],
stdout:
'v0.1.2-3-1234abcd'
,
),
]);
final
ProcessUtils
processUtils
=
ProcessUtils
(
processManager:
fakeProcessManager
,
logger:
BufferLogger
.
test
(),
);
GitTagVersion
.
determine
(
processUtils
,
workingDirectory:
'.'
,
fetchTags:
true
);
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
verifyNever
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://github.com/flutter/flutter.git'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
));
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*'
,
'--long'
,
'--tags'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
expect
(
fakeProcessManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'determine calls fetch --tags on master'
,
()
{
final
MockProcessUtils
processUtils
=
MockProcessUtils
();
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
108
,
0
,
'master'
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://github.com/flutter/flutter.git'
,
'--tags'
,
'-f'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
109
,
0
,
''
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
110
,
0
,
''
,
''
),
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*'
,
'--long'
,
'--tags'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
111
,
0
,
'v0.1.2-3-1234abcd'
,
''
),
<
String
>[
'git'
,
'describe'
]));
final
FakeProcessManager
fakeProcessManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
stdout:
'master'
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'fetch'
,
'https://github.com/flutter/flutter.git'
,
'--tags'
,
'-f'
],
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*'
,
'--long'
,
'--tags'
,
'HEAD'
],
stdout:
'v0.1.2-3-1234abcd'
,
),
]);
final
ProcessUtils
processUtils
=
ProcessUtils
(
processManager:
fakeProcessManager
,
logger:
BufferLogger
.
test
(),
);
GitTagVersion
.
determine
(
processUtils
,
workingDirectory:
'.'
,
fetchTags:
true
);
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://github.com/flutter/flutter.git'
,
'--tags'
,
'-f'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*'
,
'--long'
,
'--tags'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
expect
(
fakeProcessManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'determine uses overridden git url'
,
()
{
final
MockProcessUtils
processUtils
=
MockProcessUtils
();
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
108
,
0
,
'master'
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://githubmirror.com/flutter.git'
,
'--tags'
,
'-f'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
109
,
0
,
''
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
110
,
0
,
''
,
''
),
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*'
,
'--long'
,
'--tags'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
111
,
0
,
'v0.1.2-3-1234abcd'
,
''
),
<
String
>[
'git'
,
'describe'
]));
final
FakeProcessManager
fakeProcessManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
stdout:
'master'
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'fetch'
,
'https://githubmirror.com/flutter.git'
,
'--tags'
,
'-f'
],
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'tag'
,
'--points-at'
,
'HEAD'
],
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*'
,
'--long'
,
'--tags'
,
'HEAD'
],
stdout:
'v0.1.2-3-1234abcd'
,
),
]);
final
ProcessUtils
processUtils
=
ProcessUtils
(
processManager:
fakeProcessManager
,
logger:
BufferLogger
.
test
(),
);
GitTagVersion
.
determine
(
processUtils
,
workingDirectory:
'.'
,
fetchTags:
true
);
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://githubmirror.com/flutter.git'
,
'--tags'
,
'-f'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
expect
(
fakeProcessManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_GIT_URL'
:
'https://githubmirror.com/flutter.git'
,
...
...
@@ -873,5 +803,4 @@ void fakeData(
}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockProcessUtils
extends
Mock
implements
ProcessUtils
{}
class
MockCache
extends
Mock
implements
Cache
{}
packages/flutter_tools/test/general.shard/web/devices_test.dart
View file @
d018c24b
...
...
@@ -14,6 +14,7 @@ import 'package:flutter_tools/src/web/web_device.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
void
main
(
)
{
...
...
@@ -206,7 +207,7 @@ void main() {
// Verify caching works correctly.
expect
(
await
chromeDevice
.
sdkNameAndVersion
,
'ABC'
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'Chrome and Edge version check invokes registry query on windows.'
,
()
async
{
...
...
@@ -252,7 +253,7 @@ void main() {
// Verify caching works correctly.
expect
(
await
chromeDevice
.
sdkNameAndVersion
,
'Google Chrome 74.0.0'
);
expect
(
processManager
.
hasRemainingExpectations
,
false
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'Edge is not supported on versions less than 73'
,
()
async
{
...
...
packages/flutter_tools/test/src/fake_process_manager.dart
View file @
d018c24b
...
...
@@ -215,6 +215,9 @@ abstract class FakeProcessManager implements ProcessManager {
/// This is always `true` for [FakeProcessManager.any].
bool
get
hasRemainingExpectations
;
/// The expected [FakeCommand]s that have not yet run.
List
<
FakeCommand
>
get
_remainingExpectations
;
@protected
FakeCommand
findCommand
(
List
<
String
>
command
,
...
...
@@ -353,6 +356,9 @@ class _FakeAnyProcessManager extends FakeProcessManager {
@override
bool
get
hasRemainingExpectations
=>
true
;
@override
List
<
FakeCommand
>
get
_remainingExpectations
=>
<
FakeCommand
>[];
}
class
_SequenceProcessManager
extends
FakeProcessManager
{
...
...
@@ -382,4 +388,35 @@ class _SequenceProcessManager extends FakeProcessManager {
@override
bool
get
hasRemainingExpectations
=>
_commands
.
isNotEmpty
;
@override
List
<
FakeCommand
>
get
_remainingExpectations
=>
_commands
;
}
/// Matcher that successfully matches against a [FakeProcessManager] with
/// no remaining expectations ([item.hasRemainingExpectations] returns false).
const
Matcher
hasNoRemainingExpectations
=
_HasNoRemainingExpectations
();
class
_HasNoRemainingExpectations
extends
Matcher
{
const
_HasNoRemainingExpectations
();
@override
bool
matches
(
dynamic
item
,
Map
<
dynamic
,
dynamic
>
matchState
)
=>
item
is
FakeProcessManager
&&
!
item
.
hasRemainingExpectations
;
@override
Description
describe
(
Description
description
)
=>
description
.
add
(
'a fake process manager with no remaining expectations'
);
@override
Description
describeMismatch
(
dynamic
item
,
Description
description
,
Map
<
dynamic
,
dynamic
>
matchState
,
bool
verbose
,
)
{
final
FakeProcessManager
fakeProcessManager
=
item
as
FakeProcessManager
;
return
description
.
add
(
'has remaining expectations:
\n
${fakeProcessManager._remainingExpectations.map((FakeCommand command) => command.command).join('\n')}
'
);
}
}
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