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
becaf491
Unverified
Commit
becaf491
authored
Sep 30, 2020
by
Jenn Magder
Committed by
GitHub
Sep 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace MockCache with Cache.test() (#66946)
parent
f800a67e
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
341 additions
and
274 deletions
+341
-274
gradle_utils.dart
packages/flutter_tools/lib/src/android/gradle_utils.dart
+4
-2
cache.dart
packages/flutter_tools/lib/src/cache.dart
+36
-2
build_ios_framework_test.dart
...est/commands.shard/hermetic/build_ios_framework_test.dart
+26
-19
devices_test.dart
...tter_tools/test/commands.shard/hermetic/devices_test.dart
+2
-5
install_test.dart
...tter_tools/test/commands.shard/hermetic/install_test.dart
+3
-5
application_package_test.dart
...er_tools/test/general.shard/application_package_test.dart
+9
-9
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+84
-84
device_test.dart
packages/flutter_tools/test/general.shard/device_test.dart
+2
-4
fuchsia_device_test.dart
...tools/test/general.shard/fuchsia/fuchsia_device_test.dart
+3
-3
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+11
-14
ios_deploy_test.dart
...flutter_tools/test/general.shard/ios/ios_deploy_test.dart
+29
-23
ios_device_install_test.dart
...tools/test/general.shard/ios/ios_device_install_test.dart
+51
-39
ios_device_start_nonprebuilt_test.dart
.../general.shard/ios/ios_device_start_nonprebuilt_test.dart
+22
-13
ios_device_start_prebuilt_test.dart
...est/general.shard/ios/ios_device_start_prebuilt_test.dart
+14
-16
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+21
-26
xcode_test.dart
...es/flutter_tools/test/general.shard/macos/xcode_test.dart
+4
-10
fakes.dart
packages/flutter_tools/test/src/fakes.dart
+20
-0
No files found.
packages/flutter_tools/lib/src/android/gradle_utils.dart
View file @
becaf491
...
@@ -109,9 +109,11 @@ class GradleUtils {
...
@@ -109,9 +109,11 @@ class GradleUtils {
},
},
);
);
// Add the `gradle-wrapper.properties` file if it doesn't exist.
// Add the `gradle-wrapper.properties` file if it doesn't exist.
final
File
propertiesFile
=
directory
.
childFile
(
final
Directory
propertiesDirectory
=
directory
.
childDirectory
(
globals
.
fs
.
path
.
join
(
'gradle'
,
'wrapper'
,
'gradle-wrapper.properties'
));
globals
.
fs
.
path
.
join
(
'gradle'
,
'wrapper'
));
final
File
propertiesFile
=
propertiesDirectory
.
childFile
(
'gradle-wrapper.properties'
);
if
(!
propertiesFile
.
existsSync
())
{
if
(!
propertiesFile
.
existsSync
())
{
propertiesDirectory
.
createSync
(
recursive:
true
);
final
String
gradleVersion
=
getGradleVersionForAndroidPlugin
(
directory
);
final
String
gradleVersion
=
getGradleVersionForAndroidPlugin
(
directory
);
propertiesFile
.
writeAsStringSync
(
'''
propertiesFile
.
writeAsStringSync
(
'''
distributionBase=GRADLE_USER_HOME
distributionBase=GRADLE_USER_HOME
...
...
packages/flutter_tools/lib/src/cache.dart
View file @
becaf491
...
@@ -3,8 +3,10 @@
...
@@ -3,8 +3,10 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:archive/archive.dart'
;
import
'package:archive/archive.dart'
;
import
'package:file/memory.dart'
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'package:package_config/package_config.dart'
;
import
'package:package_config/package_config.dart'
;
import
'package:process/process.dart'
;
import
'android/gradle_utils.dart'
;
import
'android/gradle_utils.dart'
;
import
'base/common.dart'
;
import
'base/common.dart'
;
...
@@ -92,8 +94,8 @@ class Cache {
...
@@ -92,8 +94,8 @@ class Cache {
/// [rootOverride] is configurable for testing.
/// [rootOverride] is configurable for testing.
/// [artifacts] is configurable for testing.
/// [artifacts] is configurable for testing.
Cache
({
Cache
({
Directory
rootOverride
,
@protected
Directory
rootOverride
,
List
<
ArtifactSet
>
artifacts
,
@protected
List
<
ArtifactSet
>
artifacts
,
// TODO(jonahwilliams): make required once migrated to context-free.
// TODO(jonahwilliams): make required once migrated to context-free.
Logger
logger
,
Logger
logger
,
FileSystem
fileSystem
,
FileSystem
fileSystem
,
...
@@ -143,6 +145,38 @@ class Cache {
...
@@ -143,6 +145,38 @@ class Cache {
}
}
}
}
/// Create a [Cache] for testing.
///
/// Defaults to a memory file system, fake platform,
/// buffer logger, and no accessible artifacts.
/// By default, the root cache directory path is "cache".
@visibleForTesting
factory
Cache
.
test
({
Directory
rootOverride
,
List
<
ArtifactSet
>
artifacts
,
Logger
logger
,
FileSystem
fileSystem
,
Platform
platform
,
ProcessManager
processManager
,
})
{
fileSystem
??=
rootOverride
?.
fileSystem
??
MemoryFileSystem
.
test
();
platform
??=
FakePlatform
(
environment:
<
String
,
String
>{});
logger
??=
BufferLogger
.
test
();
return
Cache
(
rootOverride:
rootOverride
??=
fileSystem
.
directory
(
'cache'
),
artifacts:
artifacts
??
<
ArtifactSet
>[],
logger:
logger
,
fileSystem:
fileSystem
,
platform:
platform
,
osUtils:
OperatingSystemUtils
(
fileSystem:
fileSystem
,
logger:
logger
,
platform:
platform
,
processManager:
processManager
,
),
);
}
final
Logger
_logger
;
final
Logger
_logger
;
final
Platform
_platform
;
final
Platform
_platform
;
final
FileSystem
_fileSystem
;
final
FileSystem
_fileSystem
;
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_ios_framework_test.dart
View file @
becaf491
...
@@ -23,7 +23,6 @@ void main() {
...
@@ -23,7 +23,6 @@ void main() {
MemoryFileSystem
memoryFileSystem
;
MemoryFileSystem
memoryFileSystem
;
MockFlutterVersion
mockFlutterVersion
;
MockFlutterVersion
mockFlutterVersion
;
MockGitTagVersion
mockGitTagVersion
;
MockGitTagVersion
mockGitTagVersion
;
MockCache
mockCache
;
Directory
outputDirectory
;
Directory
outputDirectory
;
FakePlatform
fakePlatform
;
FakePlatform
fakePlatform
;
...
@@ -31,12 +30,17 @@ void main() {
...
@@ -31,12 +30,17 @@ void main() {
Cache
.
disableLocking
();
Cache
.
disableLocking
();
});
});
const
String
storageBaseUrl
=
'https://fake.googleapis.com'
;
setUp
(()
{
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
.
test
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
mockFlutterVersion
=
MockFlutterVersion
();
mockFlutterVersion
=
MockFlutterVersion
();
mockGitTagVersion
=
MockGitTagVersion
();
mockGitTagVersion
=
MockGitTagVersion
();
mockCache
=
MockCache
();
fakePlatform
=
FakePlatform
(
fakePlatform
=
FakePlatform
()..
operatingSystem
=
'macos'
;
operatingSystem:
'macos'
,
environment:
<
String
,
String
>{
'FLUTTER_STORAGE_BASE_URL'
:
storageBaseUrl
,
},
);
when
(
mockFlutterVersion
.
gitTagVersion
).
thenReturn
(
mockGitTagVersion
);
when
(
mockFlutterVersion
.
gitTagVersion
).
thenReturn
(
mockGitTagVersion
);
outputDirectory
=
globals
.
fs
.
systemTempDirectory
outputDirectory
=
globals
.
fs
.
systemTempDirectory
...
@@ -46,16 +50,20 @@ void main() {
...
@@ -46,16 +50,20 @@ void main() {
});
});
group
(
'podspec'
,
()
{
group
(
'podspec'
,
()
{
const
String
storageBaseUrl
=
'https://fake.googleapis.com'
;
const
String
engineRevision
=
'0123456789abcdef'
;
const
String
engineRevision
=
'0123456789abcdef'
;
File
licenseFil
e
;
Cache
cach
e
;
setUp
(()
{
setUp
(()
{
final
Directory
rootOverride
=
memoryFileSystem
.
directory
(
'cache'
);
cache
=
Cache
.
test
(
rootOverride:
rootOverride
,
platform:
fakePlatform
,
fileSystem:
memoryFileSystem
,
);
rootOverride
.
childDirectory
(
'bin'
).
childDirectory
(
'internal'
).
childFile
(
'engine.version'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
engineRevision
);
when
(
mockFlutterVersion
.
gitTagVersion
).
thenReturn
(
mockGitTagVersion
);
when
(
mockFlutterVersion
.
gitTagVersion
).
thenReturn
(
mockGitTagVersion
);
when
(
mockCache
.
storageBaseUrl
).
thenReturn
(
storageBaseUrl
);
when
(
mockCache
.
engineRevision
).
thenReturn
(
engineRevision
);
licenseFile
=
memoryFileSystem
.
file
(
'LICENSE'
);
when
(
mockCache
.
getLicenseFile
()).
thenReturn
(
licenseFile
);
});
});
testUsingContext
(
'version unknown'
,
()
async
{
testUsingContext
(
'version unknown'
,
()
async
{
...
@@ -66,7 +74,7 @@ void main() {
...
@@ -66,7 +74,7 @@ void main() {
buildSystem:
MockBuildSystem
(),
buildSystem:
MockBuildSystem
(),
platform:
fakePlatform
,
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
flutterVersion:
mockFlutterVersion
,
cache:
mockC
ache
,
cache:
c
ache
,
verboseHelp:
false
,
verboseHelp:
false
,
);
);
...
@@ -91,7 +99,7 @@ void main() {
...
@@ -91,7 +99,7 @@ void main() {
buildSystem:
MockBuildSystem
(),
buildSystem:
MockBuildSystem
(),
platform:
fakePlatform
,
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
flutterVersion:
mockFlutterVersion
,
cache:
mockC
ache
,
cache:
c
ache
,
verboseHelp:
false
,
verboseHelp:
false
,
);
);
...
@@ -113,7 +121,7 @@ void main() {
...
@@ -113,7 +121,7 @@ void main() {
buildSystem:
MockBuildSystem
(),
buildSystem:
MockBuildSystem
(),
platform:
fakePlatform
,
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
flutterVersion:
mockFlutterVersion
,
cache:
mockC
ache
,
cache:
c
ache
,
verboseHelp:
false
,
verboseHelp:
false
,
);
);
...
@@ -136,7 +144,7 @@ void main() {
...
@@ -136,7 +144,7 @@ void main() {
when
(
mockFlutterVersion
.
frameworkVersion
).
thenReturn
(
frameworkVersion
);
when
(
mockFlutterVersion
.
frameworkVersion
).
thenReturn
(
frameworkVersion
);
licenseFile
cache
.
getLicenseFile
()
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
licenseText
);
..
writeAsStringSync
(
licenseText
);
});
});
...
@@ -151,7 +159,7 @@ void main() {
...
@@ -151,7 +159,7 @@ void main() {
buildSystem:
MockBuildSystem
(),
buildSystem:
MockBuildSystem
(),
platform:
fakePlatform
,
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
flutterVersion:
mockFlutterVersion
,
cache:
mockC
ache
,
cache:
c
ache
,
verboseHelp:
false
,
verboseHelp:
false
,
);
);
command
.
produceFlutterPodspec
(
BuildMode
.
debug
,
outputDirectory
,
force:
true
);
command
.
produceFlutterPodspec
(
BuildMode
.
debug
,
outputDirectory
,
force:
true
);
...
@@ -174,7 +182,7 @@ void main() {
...
@@ -174,7 +182,7 @@ void main() {
buildSystem:
MockBuildSystem
(),
buildSystem:
MockBuildSystem
(),
platform:
fakePlatform
,
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
flutterVersion:
mockFlutterVersion
,
cache:
mockC
ache
,
cache:
c
ache
,
verboseHelp:
false
,
verboseHelp:
false
,
);
);
command
.
produceFlutterPodspec
(
BuildMode
.
debug
,
outputDirectory
);
command
.
produceFlutterPodspec
(
BuildMode
.
debug
,
outputDirectory
);
...
@@ -194,7 +202,7 @@ void main() {
...
@@ -194,7 +202,7 @@ void main() {
buildSystem:
MockBuildSystem
(),
buildSystem:
MockBuildSystem
(),
platform:
fakePlatform
,
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
flutterVersion:
mockFlutterVersion
,
cache:
mockC
ache
,
cache:
c
ache
,
verboseHelp:
false
,
verboseHelp:
false
,
);
);
command
.
produceFlutterPodspec
(
BuildMode
.
debug
,
outputDirectory
);
command
.
produceFlutterPodspec
(
BuildMode
.
debug
,
outputDirectory
);
...
@@ -212,7 +220,7 @@ void main() {
...
@@ -212,7 +220,7 @@ void main() {
buildSystem:
MockBuildSystem
(),
buildSystem:
MockBuildSystem
(),
platform:
fakePlatform
,
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
flutterVersion:
mockFlutterVersion
,
cache:
mockC
ache
,
cache:
c
ache
,
verboseHelp:
false
,
verboseHelp:
false
,
);
);
command
.
produceFlutterPodspec
(
BuildMode
.
profile
,
outputDirectory
);
command
.
produceFlutterPodspec
(
BuildMode
.
profile
,
outputDirectory
);
...
@@ -230,7 +238,7 @@ void main() {
...
@@ -230,7 +238,7 @@ void main() {
buildSystem:
MockBuildSystem
(),
buildSystem:
MockBuildSystem
(),
platform:
fakePlatform
,
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
flutterVersion:
mockFlutterVersion
,
cache:
mockC
ache
,
cache:
c
ache
,
verboseHelp:
false
,
verboseHelp:
false
,
);
);
command
.
produceFlutterPodspec
(
BuildMode
.
release
,
outputDirectory
);
command
.
produceFlutterPodspec
(
BuildMode
.
release
,
outputDirectory
);
...
@@ -250,5 +258,4 @@ void main() {
...
@@ -250,5 +258,4 @@ void main() {
class
MockFlutterVersion
extends
Mock
implements
FlutterVersion
{}
class
MockFlutterVersion
extends
Mock
implements
FlutterVersion
{}
class
MockGitTagVersion
extends
Mock
implements
GitTagVersion
{}
class
MockGitTagVersion
extends
Mock
implements
GitTagVersion
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockBuildSystem
extends
Mock
implements
BuildSystem
{}
class
MockBuildSystem
extends
Mock
implements
BuildSystem
{}
packages/flutter_tools/test/commands.shard/hermetic/devices_test.dart
View file @
becaf491
...
@@ -24,11 +24,10 @@ void main() {
...
@@ -24,11 +24,10 @@ void main() {
Cache
.
disableLocking
();
Cache
.
disableLocking
();
});
});
Mock
Cache
cache
;
Cache
cache
;
setUp
(()
{
setUp
(()
{
cache
=
MockCache
();
cache
=
Cache
.
test
();
when
(
cache
.
dyLdLibEntry
).
thenReturn
(
const
MapEntry
<
String
,
String
>(
'foo'
,
'bar'
));
});
});
testUsingContext
(
'returns 0 when called'
,
()
async
{
testUsingContext
(
'returns 0 when called'
,
()
async
{
...
@@ -192,5 +191,3 @@ class NoDevicesManager extends DeviceManager {
...
@@ -192,5 +191,3 @@ class NoDevicesManager extends DeviceManager {
@override
@override
List
<
DeviceDiscovery
>
get
deviceDiscoverers
=>
<
DeviceDiscovery
>[];
List
<
DeviceDiscovery
>
get
deviceDiscoverers
=>
<
DeviceDiscovery
>[];
}
}
class
MockCache
extends
Mock
implements
Cache
{}
packages/flutter_tools/test/commands.shard/hermetic/install_test.dart
View file @
becaf491
...
@@ -29,7 +29,7 @@ void main() {
...
@@ -29,7 +29,7 @@ void main() {
await
createTestCommandRunner
(
command
).
run
(<
String
>[
'install'
]);
await
createTestCommandRunner
(
command
).
run
(<
String
>[
'install'
]);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
MockCache
(),
Cache:
()
=>
Cache
.
test
(),
});
});
testUsingContext
(
'returns 1 when targeted device is not Android with --device-user'
,
()
async
{
testUsingContext
(
'returns 1 when targeted device is not Android with --device-user'
,
()
async
{
...
@@ -46,7 +46,7 @@ void main() {
...
@@ -46,7 +46,7 @@ void main() {
expect
(()
async
=>
await
createTestCommandRunner
(
command
).
run
(<
String
>[
'install'
,
'--device-user'
,
'10'
]),
expect
(()
async
=>
await
createTestCommandRunner
(
command
).
run
(<
String
>[
'install'
,
'--device-user'
,
'10'
]),
throwsToolExit
(
message:
'--device-user is only supported for Android'
));
throwsToolExit
(
message:
'--device-user is only supported for Android'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
MockCache
(),
Cache:
()
=>
Cache
.
test
(),
});
});
testUsingContext
(
'returns 0 when iOS is connected and ready for an install'
,
()
async
{
testUsingContext
(
'returns 0 when iOS is connected and ready for an install'
,
()
async
{
...
@@ -60,9 +60,7 @@ void main() {
...
@@ -60,9 +60,7 @@ void main() {
await
createTestCommandRunner
(
command
).
run
(<
String
>[
'install'
]);
await
createTestCommandRunner
(
command
).
run
(<
String
>[
'install'
]);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
MockCache
(),
Cache:
()
=>
Cache
.
test
(),
});
});
});
});
}
}
class
MockCache
extends
Mock
implements
Cache
{}
packages/flutter_tools/test/general.shard/application_package_test.dart
View file @
becaf491
...
@@ -39,20 +39,22 @@ void main() {
...
@@ -39,20 +39,22 @@ void main() {
AndroidSdk
sdk
;
AndroidSdk
sdk
;
ProcessManager
mockProcessManager
;
ProcessManager
mockProcessManager
;
MemoryFileSystem
fs
;
MemoryFileSystem
fs
;
Cache
mockC
ache
;
Cache
c
ache
;
File
gradle
;
File
gradle
;
final
Map
<
Type
,
Generator
>
overrides
=
<
Type
,
Generator
>{
final
Map
<
Type
,
Generator
>
overrides
=
<
Type
,
Generator
>{
AndroidSdk:
()
=>
sdk
,
AndroidSdk:
()
=>
sdk
,
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
FileSystem:
()
=>
fs
,
FileSystem:
()
=>
fs
,
Cache:
()
=>
mockC
ache
,
Cache:
()
=>
c
ache
,
};
};
setUp
(()
async
{
setUp
(()
async
{
sdk
=
MockitoAndroidSdk
();
sdk
=
MockitoAndroidSdk
();
mockProcessManager
=
MockitoProcessManager
();
mockProcessManager
=
MockitoProcessManager
();
fs
=
MemoryFileSystem
.
test
();
fs
=
MemoryFileSystem
.
test
();
mockCache
=
MockCache
();
cache
=
Cache
.
test
(
processManager:
FakeProcessManager
.
any
()
);
Cache
.
flutterRoot
=
'../..'
;
Cache
.
flutterRoot
=
'../..'
;
when
(
sdk
.
licensesAvailable
).
thenReturn
(
true
);
when
(
sdk
.
licensesAvailable
).
thenReturn
(
true
);
when
(
mockProcessManager
.
canRun
(
any
)).
thenReturn
(
true
);
when
(
mockProcessManager
.
canRun
(
any
)).
thenReturn
(
true
);
...
@@ -108,13 +110,12 @@ void main() {
...
@@ -108,13 +110,12 @@ void main() {
.
childFile
(
'gradle.properties'
)
.
childFile
(
'gradle.properties'
)
.
writeAsStringSync
(
'irrelevant'
);
.
writeAsStringSync
(
'irrelevant'
);
final
Directory
gradleWrapperDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_application_package_test_gradle_wrapper.'
);
final
Directory
gradleWrapperDir
=
cache
.
getArtifactDirectory
(
'gradle_wrapper'
);
when
(
mockCache
.
getArtifactDirectory
(
'gradle_wrapper'
)).
thenReturn
(
gradleWrapperDir
);
g
lobals
.
fs
.
directory
(
gradleWrapperDir
.
childDirectory
(
'gradle'
).
childDirectory
(
'wrapper'
))
g
radleWrapperDir
.
fileSystem
.
directory
(
gradleWrapperDir
.
childDirectory
(
'gradle'
).
childDirectory
(
'wrapper'
))
.
createSync
(
recursive:
true
);
.
createSync
(
recursive:
true
);
g
lobals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
gradleWrapperDir
.
path
,
'gradlew'
)
).
writeAsStringSync
(
'irrelevant'
);
g
radleWrapperDir
.
childFile
(
'gradlew'
).
writeAsStringSync
(
'irrelevant'
);
g
lobals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
gradleWrapperDir
.
path
,
'gradlew.bat'
)
).
writeAsStringSync
(
'irrelevant'
);
g
radleWrapperDir
.
childFile
(
'gradlew.bat'
).
writeAsStringSync
(
'irrelevant'
);
await
ApplicationPackageFactory
.
instance
.
getPackageForPlatform
(
await
ApplicationPackageFactory
.
instance
.
getPackageForPlatform
(
TargetPlatform
.
android_arm
,
TargetPlatform
.
android_arm
,
...
@@ -691,5 +692,4 @@ const String plistData = '''
...
@@ -691,5 +692,4 @@ const String plistData = '''
{"CFBundleIdentifier": "fooBundleId"}
{"CFBundleIdentifier": "fooBundleId"}
'''
;
'''
;
class
MockCache
extends
Mock
implements
Cache
{}
class
MockOperatingSystemUtils
extends
Mock
implements
OperatingSystemUtils
{
}
class
MockOperatingSystemUtils
extends
Mock
implements
OperatingSystemUtils
{
}
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
becaf491
...
@@ -85,10 +85,17 @@ void main() {
...
@@ -85,10 +85,17 @@ void main() {
group
(
'Cache'
,
()
{
group
(
'Cache'
,
()
{
MockCache
mockCache
;
MockCache
mockCache
;
Cache
cache
;
MemoryFileSystem
memoryFileSystem
;
MemoryFileSystem
memoryFileSystem
;
ProcessManager
fakeProcessManager
;
setUp
(()
{
setUp
(()
{
fakeProcessManager
=
FakeProcessManager
.
any
();
mockCache
=
MockCache
();
mockCache
=
MockCache
();
cache
=
Cache
.
test
(
fileSystem:
memoryFileSystem
,
processManager:
fakeProcessManager
,
);
memoryFileSystem
=
MemoryFileSystem
.
test
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
});
});
...
@@ -110,30 +117,27 @@ void main() {
...
@@ -110,30 +117,27 @@ void main() {
});
});
testUsingContext
(
'Gradle wrapper should not be up to date, if some cached artifact is not available'
,
()
{
testUsingContext
(
'Gradle wrapper should not be up to date, if some cached artifact is not available'
,
()
{
final
GradleWrapper
gradleWrapper
=
GradleWrapper
(
mockCache
);
final
GradleWrapper
gradleWrapper
=
GradleWrapper
(
cache
);
final
Directory
directory
=
globals
.
fs
.
directory
(
'/Applications/flutter/bin/cache'
);
final
Directory
directory
=
cache
.
getCacheDir
(
globals
.
fs
.
path
.
join
(
'artifacts'
,
'gradle_wrapper'
));
directory
.
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
directory
.
path
,
'gradle'
,
'wrapper'
,
'gradle-wrapper.jar'
)).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
directory
.
path
,
'artifacts'
,
'gradle_wrapper'
,
'gradle'
,
'wrapper'
,
'gradle-wrapper.jar'
)).
createSync
(
recursive:
true
);
when
(
mockCache
.
getCacheDir
(
globals
.
fs
.
path
.
join
(
'artifacts'
,
'gradle_wrapper'
))).
thenReturn
(
globals
.
fs
.
directory
(
globals
.
fs
.
path
.
join
(
directory
.
path
,
'artifacts'
,
'gradle_wrapper'
)));
expect
(
gradleWrapper
.
isUpToDateInner
(),
false
);
expect
(
gradleWrapper
.
isUpToDateInner
(),
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockC
ache
,
Cache:
()
=>
c
ache
,
FileSystem:
()
=>
memoryFileSystem
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'Gradle wrapper should be up to date, only if all cached artifact are available'
,
()
{
testUsingContext
(
'Gradle wrapper should be up to date, only if all cached artifact are available'
,
()
{
final
GradleWrapper
gradleWrapper
=
GradleWrapper
(
mockCache
);
final
GradleWrapper
gradleWrapper
=
GradleWrapper
(
cache
);
final
Directory
directory
=
globals
.
fs
.
directory
(
'/Applications/flutter/bin/cache'
);
final
Directory
directory
=
cache
.
getCacheDir
(
globals
.
fs
.
path
.
join
(
'artifacts'
,
'gradle_wrapper'
));
directory
.
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
directory
.
path
,
'gradle'
,
'wrapper'
,
'gradle-wrapper.jar'
)).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
directory
.
path
,
'artifacts'
,
'gradle_wrapper'
,
'gradle'
,
'wrapper'
,
'gradle-wrapper.jar'
)).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
directory
.
path
,
'gradlew'
)).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
directory
.
path
,
'artifacts'
,
'gradle_wrapper'
,
'gradlew'
)).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
directory
.
path
,
'gradlew.bat'
)).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
directory
.
path
,
'artifacts'
,
'gradle_wrapper'
,
'gradlew.bat'
)).
createSync
(
recursive:
true
);
when
(
mockCache
.
getCacheDir
(
globals
.
fs
.
path
.
join
(
'artifacts'
,
'gradle_wrapper'
))).
thenReturn
(
globals
.
fs
.
directory
(
globals
.
fs
.
path
.
join
(
directory
.
path
,
'artifacts'
,
'gradle_wrapper'
)));
expect
(
gradleWrapper
.
isUpToDateInner
(),
true
);
expect
(
gradleWrapper
.
isUpToDateInner
(),
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockC
ache
,
Cache:
()
=>
c
ache
,
FileSystem:
()
=>
memoryFileSystem
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
...
@@ -201,9 +205,8 @@ void main() {
...
@@ -201,9 +205,8 @@ void main() {
cache
.
dyLdLibEntry
.
value
,
cache
.
dyLdLibEntry
.
value
,
'/path/to/alpha:/path/to/beta:/path/to/gamma:/path/to/delta:/path/to/epsilon'
,
'/path/to/alpha:/path/to/beta:/path/to/gamma:/path/to/delta:/path/to/epsilon'
,
);
);
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockCache
,
});
});
testUsingContext
(
'failed storage.googleapis.com download shows China warning'
,
()
async
{
testUsingContext
(
'failed storage.googleapis.com download shows China warning'
,
()
async
{
final
CachedArtifact
artifact1
=
MockCachedArtifact
();
final
CachedArtifact
artifact1
=
MockCachedArtifact
();
final
CachedArtifact
artifact2
=
MockCachedArtifact
();
final
CachedArtifact
artifact2
=
MockCachedArtifact
();
...
@@ -300,33 +303,29 @@ void main() {
...
@@ -300,33 +303,29 @@ void main() {
group
(
'AndroidMavenArtifacts'
,
()
{
group
(
'AndroidMavenArtifacts'
,
()
{
MemoryFileSystem
memoryFileSystem
;
MemoryFileSystem
memoryFileSystem
;
MockProcessManager
processManager
;
MockProcessManager
processManager
;
MockCache
mockC
ache
;
Cache
c
ache
;
setUp
(()
{
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
.
test
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
processManager
=
MockProcessManager
();
processManager
=
MockProcessManager
();
mockCache
=
MockCache
();
cache
=
Cache
.
test
(
fileSystem:
memoryFileSystem
,
processManager:
FakeProcessManager
.
any
(),
);
});
});
test
(
'development artifact'
,
()
async
{
test
(
'development artifact'
,
()
async
{
final
AndroidMavenArtifacts
mavenArtifacts
=
AndroidMavenArtifacts
(
mockC
ache
);
final
AndroidMavenArtifacts
mavenArtifacts
=
AndroidMavenArtifacts
(
c
ache
);
expect
(
mavenArtifacts
.
developmentArtifact
,
DevelopmentArtifact
.
androidMaven
);
expect
(
mavenArtifacts
.
developmentArtifact
,
DevelopmentArtifact
.
androidMaven
);
});
});
testUsingContext
(
'update'
,
()
async
{
testUsingContext
(
'update'
,
()
async
{
final
Directory
cacheRoot
=
globals
.
fs
.
directory
(
'/bin/cache'
)
final
AndroidMavenArtifacts
mavenArtifacts
=
AndroidMavenArtifacts
(
cache
);
..
createSync
(
recursive:
true
);
when
(
mockCache
.
getRoot
()).
thenReturn
(
cacheRoot
);
final
AndroidMavenArtifacts
mavenArtifacts
=
AndroidMavenArtifacts
(
mockCache
);
expect
(
await
mavenArtifacts
.
isUpToDate
(),
isFalse
);
expect
(
await
mavenArtifacts
.
isUpToDate
(),
isFalse
);
final
Directory
gradleWrapperDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_cache_test_gradle_wrapper.'
);
final
Directory
gradleWrapperDir
=
cache
.
getArtifactDirectory
(
'gradle_wrapper'
)..
createSync
(
recursive:
true
);
when
(
mockCache
.
getArtifactDirectory
(
'gradle_wrapper'
)).
thenReturn
(
gradleWrapperDir
);
gradleWrapperDir
.
childFile
(
'gradlew'
).
writeAsStringSync
(
'irrelevant'
);
gradleWrapperDir
.
childFile
(
'gradlew.bat'
).
writeAsStringSync
(
'irrelevant'
);
globals
.
fs
.
directory
(
gradleWrapperDir
.
childDirectory
(
'gradle'
).
childDirectory
(
'wrapper'
))
.
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
gradleWrapperDir
.
path
,
'gradlew'
)).
writeAsStringSync
(
'irrelevant'
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
gradleWrapperDir
.
path
,
'gradlew.bat'
)).
writeAsStringSync
(
'irrelevant'
);
when
(
globals
.
processManager
.
run
(
any
,
environment:
captureAnyNamed
(
'environment'
)))
when
(
globals
.
processManager
.
run
(
any
,
environment:
captureAnyNamed
(
'environment'
)))
.
thenAnswer
((
Invocation
invocation
)
{
.
thenAnswer
((
Invocation
invocation
)
{
...
@@ -343,22 +342,23 @@ void main() {
...
@@ -343,22 +342,23 @@ void main() {
expect
(
await
mavenArtifacts
.
isUpToDate
(),
isFalse
);
expect
(
await
mavenArtifacts
.
isUpToDate
(),
isFalse
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockC
ache
,
Cache:
()
=>
c
ache
,
FileSystem:
()
=>
memoryFileSystem
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
});
});
});
});
group
(
'macOS artifacts'
,
()
{
group
(
'macOS artifacts'
,
()
{
MockCache
mockC
ache
;
Cache
c
ache
;
setUp
(()
{
setUp
(()
{
mockCache
=
MockCache
();
cache
=
Cache
.
test
(
processManager:
FakeProcessManager
.
any
(),
);
});
});
testUsingContext
(
'verifies executables for libimobiledevice in isUpToDateInner'
,
()
async
{
testUsingContext
(
'verifies executables for libimobiledevice in isUpToDateInner'
,
()
async
{
final
IosUsbArtifacts
iosUsbArtifacts
=
IosUsbArtifacts
(
'libimobiledevice'
,
mockCache
);
final
IosUsbArtifacts
iosUsbArtifacts
=
IosUsbArtifacts
(
'libimobiledevice'
,
cache
);
when
(
mockCache
.
getArtifactDirectory
(
any
)).
thenReturn
(
globals
.
fs
.
currentDirectory
);
iosUsbArtifacts
.
location
.
createSync
();
iosUsbArtifacts
.
location
.
createSync
();
final
File
ideviceScreenshotFile
=
iosUsbArtifacts
.
location
.
childFile
(
'idevicescreenshot'
)
final
File
ideviceScreenshotFile
=
iosUsbArtifacts
.
location
.
childFile
(
'idevicescreenshot'
)
..
createSync
();
..
createSync
();
...
@@ -371,14 +371,13 @@ void main() {
...
@@ -371,14 +371,13 @@ void main() {
expect
(
iosUsbArtifacts
.
isUpToDateInner
(),
false
);
expect
(
iosUsbArtifacts
.
isUpToDateInner
(),
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockC
ache
,
Cache:
()
=>
c
ache
,
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'verifies iproxy for usbmuxd in isUpToDateInner'
,
()
async
{
testUsingContext
(
'verifies iproxy for usbmuxd in isUpToDateInner'
,
()
async
{
final
IosUsbArtifacts
iosUsbArtifacts
=
IosUsbArtifacts
(
'usbmuxd'
,
mockCache
);
final
IosUsbArtifacts
iosUsbArtifacts
=
IosUsbArtifacts
(
'usbmuxd'
,
cache
);
when
(
mockCache
.
getArtifactDirectory
(
any
)).
thenReturn
(
globals
.
fs
.
currentDirectory
);
iosUsbArtifacts
.
location
.
createSync
();
iosUsbArtifacts
.
location
.
createSync
();
final
File
iproxy
=
iosUsbArtifacts
.
location
.
childFile
(
'iproxy'
)
final
File
iproxy
=
iosUsbArtifacts
.
location
.
childFile
(
'iproxy'
)
..
createSync
();
..
createSync
();
...
@@ -389,47 +388,48 @@ void main() {
...
@@ -389,47 +388,48 @@ void main() {
expect
(
iosUsbArtifacts
.
isUpToDateInner
(),
false
);
expect
(
iosUsbArtifacts
.
isUpToDateInner
(),
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockC
ache
,
Cache:
()
=>
c
ache
,
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'Does not verify executables for openssl in isUpToDateInner'
,
()
async
{
testUsingContext
(
'Does not verify executables for openssl in isUpToDateInner'
,
()
async
{
final
IosUsbArtifacts
iosUsbArtifacts
=
IosUsbArtifacts
(
'openssl'
,
mockCache
);
final
IosUsbArtifacts
iosUsbArtifacts
=
IosUsbArtifacts
(
'openssl'
,
cache
);
when
(
mockCache
.
getArtifactDirectory
(
any
)).
thenReturn
(
globals
.
fs
.
currentDirectory
);
iosUsbArtifacts
.
location
.
createSync
();
iosUsbArtifacts
.
location
.
createSync
();
expect
(
iosUsbArtifacts
.
isUpToDateInner
(),
true
);
expect
(
iosUsbArtifacts
.
isUpToDateInner
(),
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockC
ache
,
Cache:
()
=>
c
ache
,
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'use unsigned when specified'
,
()
async
{
testUsingContext
(
'use unsigned when specified'
,
()
async
{
when
(
mockCache
.
useUnsignedMacBinaries
).
thenReturn
(
true
)
;
cache
.
useUnsignedMacBinaries
=
true
;
final
IosUsbArtifacts
iosUsbArtifacts
=
IosUsbArtifacts
(
'name'
,
mockC
ache
);
final
IosUsbArtifacts
iosUsbArtifacts
=
IosUsbArtifacts
(
'name'
,
c
ache
);
expect
(
iosUsbArtifacts
.
archiveUri
.
toString
(),
contains
(
'/unsigned/'
));
expect
(
iosUsbArtifacts
.
archiveUri
.
toString
(),
contains
(
'/unsigned/'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockC
ache
,
Cache:
()
=>
c
ache
,
});
});
testUsingContext
(
'not use unsigned when not specified'
,
()
async
{
testUsingContext
(
'not use unsigned when not specified'
,
()
async
{
when
(
mockCache
.
useUnsignedMacBinaries
).
thenReturn
(
false
)
;
cache
.
useUnsignedMacBinaries
=
false
;
final
IosUsbArtifacts
iosUsbArtifacts
=
IosUsbArtifacts
(
'name'
,
mockC
ache
);
final
IosUsbArtifacts
iosUsbArtifacts
=
IosUsbArtifacts
(
'name'
,
c
ache
);
expect
(
iosUsbArtifacts
.
archiveUri
.
toString
(),
isNot
(
contains
(
'/unsigned/'
)));
expect
(
iosUsbArtifacts
.
archiveUri
.
toString
(),
isNot
(
contains
(
'/unsigned/'
)));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockC
ache
,
Cache:
()
=>
c
ache
,
});
});
});
});
testWithoutContext
(
'Downloads Flutter runner debug symbols'
,
()
async
{
testWithoutContext
(
'Downloads Flutter runner debug symbols'
,
()
async
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
(
processManager:
FakeProcessManager
.
any
(),
);
final
MockVersionedPackageResolver
mockPackageResolver
=
MockVersionedPackageResolver
();
final
MockVersionedPackageResolver
mockPackageResolver
=
MockVersionedPackageResolver
();
final
FlutterRunnerDebugSymbols
flutterRunnerDebugSymbols
=
FlutterRunnerDebugSymbols
(
final
FlutterRunnerDebugSymbols
flutterRunnerDebugSymbols
=
FlutterRunnerDebugSymbols
(
mockC
ache
,
c
ache
,
packageResolver:
mockPackageResolver
,
packageResolver:
mockPackageResolver
,
platform:
FakePlatform
(
operatingSystem:
'linux'
),
platform:
FakePlatform
(
operatingSystem:
'linux'
),
);
);
...
@@ -444,51 +444,51 @@ void main() {
...
@@ -444,51 +444,51 @@ void main() {
});
});
testUsingContext
(
'FontSubset in univeral artifacts'
,
()
{
testUsingContext
(
'FontSubset in univeral artifacts'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
();
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockC
ache
);
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
c
ache
);
expect
(
artifacts
.
developmentArtifact
,
DevelopmentArtifact
.
universal
);
expect
(
artifacts
.
developmentArtifact
,
DevelopmentArtifact
.
universal
);
});
});
testUsingContext
(
'FontSubset artifacts on linux'
,
()
{
testUsingContext
(
'FontSubset artifacts on linux'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
();
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockC
ache
);
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
c
ache
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
false
)
;
cache
.
includeAllPlatforms
=
false
;
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'linux-x64'
,
'linux-x64/font-subset.zip'
]]);
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'linux-x64'
,
'linux-x64/font-subset.zip'
]]);
},
overrides:
<
Type
,
Generator
>
{
},
overrides:
<
Type
,
Generator
>
{
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
});
});
testUsingContext
(
'FontSubset artifacts on windows'
,
()
{
testUsingContext
(
'FontSubset artifacts on windows'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
();
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockC
ache
);
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
c
ache
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
false
)
;
cache
.
includeAllPlatforms
=
false
;
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'windows-x64'
,
'windows-x64/font-subset.zip'
]]);
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'windows-x64'
,
'windows-x64/font-subset.zip'
]]);
},
overrides:
<
Type
,
Generator
>
{
},
overrides:
<
Type
,
Generator
>
{
Platform:
()
=>
FakePlatform
(
operatingSystem:
'windows'
),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'windows'
),
});
});
testUsingContext
(
'FontSubset artifacts on macos'
,
()
{
testUsingContext
(
'FontSubset artifacts on macos'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
();
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockC
ache
);
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
c
ache
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
false
)
;
cache
.
includeAllPlatforms
=
false
;
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'darwin-x64'
,
'darwin-x64/font-subset.zip'
]]);
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'darwin-x64'
,
'darwin-x64/font-subset.zip'
]]);
},
overrides:
<
Type
,
Generator
>
{
},
overrides:
<
Type
,
Generator
>
{
Platform:
()
=>
FakePlatform
(
operatingSystem:
'macos'
),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'macos'
),
});
});
testUsingContext
(
'FontSubset artifacts on fuchsia'
,
()
{
testUsingContext
(
'FontSubset artifacts on fuchsia'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
();
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockC
ache
);
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
c
ache
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
false
)
;
cache
.
includeAllPlatforms
=
false
;
expect
(
artifacts
.
getBinaryDirs
,
throwsToolExit
(
message:
'Unsupported operating system:
${globals.platform.operatingSystem}
'
));
expect
(
artifacts
.
getBinaryDirs
,
throwsToolExit
(
message:
'Unsupported operating system:
${globals.platform.operatingSystem}
'
));
},
overrides:
<
Type
,
Generator
>
{
},
overrides:
<
Type
,
Generator
>
{
Platform:
()
=>
FakePlatform
(
operatingSystem:
'fuchsia'
),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'fuchsia'
),
});
});
testUsingContext
(
'FontSubset artifacts for all platforms'
,
()
{
testUsingContext
(
'FontSubset artifacts for all platforms'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
();
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockC
ache
);
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
c
ache
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
true
)
;
cache
.
includeAllPlatforms
=
true
;
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[
<
String
>[
'darwin-x64'
,
'darwin-x64/font-subset.zip'
],
<
String
>[
'darwin-x64'
,
'darwin-x64/font-subset.zip'
],
<
String
>[
'linux-x64'
,
'linux-x64/font-subset.zip'
],
<
String
>[
'linux-x64'
,
'linux-x64/font-subset.zip'
],
...
@@ -499,10 +499,10 @@ void main() {
...
@@ -499,10 +499,10 @@ void main() {
});
});
testUsingContext
(
'macOS desktop artifacts ignore filtering when requested'
,
()
{
testUsingContext
(
'macOS desktop artifacts ignore filtering when requested'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
();
final
MacOSEngineArtifacts
artifacts
=
MacOSEngineArtifacts
(
mockC
ache
);
final
MacOSEngineArtifacts
artifacts
=
MacOSEngineArtifacts
(
c
ache
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
false
)
;
cache
.
includeAllPlatforms
=
false
;
when
(
mockCache
.
platformOverrideArtifacts
).
thenReturn
(<
String
>{
'macos'
})
;
cache
.
platformOverrideArtifacts
=
<
String
>{
'macos'
}
;
expect
(
artifacts
.
getBinaryDirs
(),
isNotEmpty
);
expect
(
artifacts
.
getBinaryDirs
(),
isNotEmpty
);
},
overrides:
<
Type
,
Generator
>
{
},
overrides:
<
Type
,
Generator
>
{
...
@@ -510,21 +510,21 @@ void main() {
...
@@ -510,21 +510,21 @@ void main() {
});
});
testWithoutContext
(
'Windows desktop artifacts ignore filtering when requested'
,
()
{
testWithoutContext
(
'Windows desktop artifacts ignore filtering when requested'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
();
final
WindowsEngineArtifacts
artifacts
=
WindowsEngineArtifacts
(
final
WindowsEngineArtifacts
artifacts
=
WindowsEngineArtifacts
(
mockC
ache
,
c
ache
,
platform:
FakePlatform
(
operatingSystem:
'linux'
),
platform:
FakePlatform
(
operatingSystem:
'linux'
),
);
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
false
)
;
cache
.
includeAllPlatforms
=
false
;
when
(
mockCache
.
platformOverrideArtifacts
).
thenReturn
(<
String
>{
'windows'
})
;
cache
.
platformOverrideArtifacts
=
<
String
>{
'windows'
}
;
expect
(
artifacts
.
getBinaryDirs
(),
isNotEmpty
);
expect
(
artifacts
.
getBinaryDirs
(),
isNotEmpty
);
});
});
testWithoutContext
(
'Windows desktop artifacts include profile and release artifacts'
,
()
{
testWithoutContext
(
'Windows desktop artifacts include profile and release artifacts'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
();
final
WindowsEngineArtifacts
artifacts
=
WindowsEngineArtifacts
(
final
WindowsEngineArtifacts
artifacts
=
WindowsEngineArtifacts
(
mockC
ache
,
c
ache
,
platform:
FakePlatform
(
operatingSystem:
'windows'
),
platform:
FakePlatform
(
operatingSystem:
'windows'
),
);
);
...
@@ -535,21 +535,21 @@ void main() {
...
@@ -535,21 +535,21 @@ void main() {
});
});
testWithoutContext
(
'Linux desktop artifacts ignore filtering when requested'
,
()
{
testWithoutContext
(
'Linux desktop artifacts ignore filtering when requested'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
();
final
LinuxEngineArtifacts
artifacts
=
LinuxEngineArtifacts
(
final
LinuxEngineArtifacts
artifacts
=
LinuxEngineArtifacts
(
mockC
ache
,
c
ache
,
platform:
FakePlatform
(
operatingSystem:
'macos'
),
platform:
FakePlatform
(
operatingSystem:
'macos'
),
);
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
false
)
;
cache
.
includeAllPlatforms
=
false
;
when
(
mockCache
.
platformOverrideArtifacts
).
thenReturn
(<
String
>{
'linux'
})
;
cache
.
platformOverrideArtifacts
=
<
String
>{
'linux'
}
;
expect
(
artifacts
.
getBinaryDirs
(),
isNotEmpty
);
expect
(
artifacts
.
getBinaryDirs
(),
isNotEmpty
);
});
});
testWithoutContext
(
'Linux desktop artifacts include profile and release artifacts'
,
()
{
testWithoutContext
(
'Linux desktop artifacts include profile and release artifacts'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
();
final
LinuxEngineArtifacts
artifacts
=
LinuxEngineArtifacts
(
final
LinuxEngineArtifacts
artifacts
=
LinuxEngineArtifacts
(
mockC
ache
,
c
ache
,
platform:
FakePlatform
(
operatingSystem:
'linux'
),
platform:
FakePlatform
(
operatingSystem:
'linux'
),
);
);
...
...
packages/flutter_tools/test/general.shard/device_test.dart
View file @
becaf491
...
@@ -21,13 +21,12 @@ import '../src/fake_devices.dart';
...
@@ -21,13 +21,12 @@ import '../src/fake_devices.dart';
import
'../src/mocks.dart'
;
import
'../src/mocks.dart'
;
void
main
(
)
{
void
main
(
)
{
Mock
Cache
cache
;
Cache
cache
;
BufferLogger
logger
;
BufferLogger
logger
;
setUp
(()
{
setUp
(()
{
cache
=
MockCache
();
cache
=
Cache
.
test
();
logger
=
BufferLogger
.
test
();
logger
=
BufferLogger
.
test
();
when
(
cache
.
dyLdLibEntry
).
thenReturn
(
const
MapEntry
<
String
,
String
>(
'foo'
,
'bar'
));
});
});
group
(
'DeviceManager'
,
()
{
group
(
'DeviceManager'
,
()
{
...
@@ -550,5 +549,4 @@ class TestDeviceManager extends DeviceManager {
...
@@ -550,5 +549,4 @@ class TestDeviceManager extends DeviceManager {
class
MockProcess
extends
Mock
implements
Process
{}
class
MockProcess
extends
Mock
implements
Process
{}
class
MockTerminal
extends
Mock
implements
AnsiTerminal
{}
class
MockTerminal
extends
Mock
implements
AnsiTerminal
{}
class
MockStdio
extends
Mock
implements
Stdio
{}
class
MockStdio
extends
Mock
implements
Stdio
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockDeviceDiscovery
extends
Mock
implements
DeviceDiscovery
{}
class
MockDeviceDiscovery
extends
Mock
implements
DeviceDiscovery
{}
packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart
View file @
becaf491
...
@@ -827,9 +827,10 @@ void main() {
...
@@ -827,9 +827,10 @@ void main() {
});
});
testUsingContext
(
'Correct flutter runner'
,
()
async
{
testUsingContext
(
'Correct flutter runner'
,
()
async
{
final
MockCache
cache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
(
processManager:
FakeProcessManager
.
any
(),
);
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
when
(
cache
.
getArtifactDirectory
(
'flutter_runner'
)).
thenReturn
(
fileSystem
.
directory
(
'fuchsia'
));
final
CachedArtifacts
artifacts
=
CachedArtifacts
(
final
CachedArtifacts
artifacts
=
CachedArtifacts
(
cache:
cache
,
cache:
cache
,
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
...
@@ -1591,4 +1592,3 @@ class MockFuchsiaSdk extends Mock implements FuchsiaSdk {
...
@@ -1591,4 +1592,3 @@ class MockFuchsiaSdk extends Mock implements FuchsiaSdk {
class
MockDartDevelopmentService
extends
Mock
implements
DartDevelopmentService
{}
class
MockDartDevelopmentService
extends
Mock
implements
DartDevelopmentService
{}
class
MockFuchsiaWorkflow
extends
Mock
implements
FuchsiaWorkflow
{}
class
MockFuchsiaWorkflow
extends
Mock
implements
FuchsiaWorkflow
{}
class
MockCache
extends
Mock
implements
Cache
{}
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
becaf491
...
@@ -37,7 +37,7 @@ void main() {
...
@@ -37,7 +37,7 @@ void main() {
group
(
'IOSDevice'
,
()
{
group
(
'IOSDevice'
,
()
{
final
List
<
Platform
>
unsupportedPlatforms
=
<
Platform
>[
linuxPlatform
,
windowsPlatform
];
final
List
<
Platform
>
unsupportedPlatforms
=
<
Platform
>[
linuxPlatform
,
windowsPlatform
];
Artifacts
mockArtifacts
;
Artifacts
mockArtifacts
;
MockCache
mockC
ache
;
Cache
c
ache
;
MockVmService
mockVmService
;
MockVmService
mockVmService
;
Logger
logger
;
Logger
logger
;
IOSDeploy
iosDeploy
;
IOSDeploy
iosDeploy
;
...
@@ -46,21 +46,19 @@ void main() {
...
@@ -46,21 +46,19 @@ void main() {
setUp
(()
{
setUp
(()
{
mockArtifacts
=
MockArtifacts
();
mockArtifacts
=
MockArtifacts
();
mockCache
=
MockCache
();
cache
=
Cache
.
test
();
mockVmService
=
MockVmService
();
mockVmService
=
MockVmService
();
const
MapEntry
<
String
,
String
>
dyLdLibEntry
=
MapEntry
<
String
,
String
>(
'DYLD_LIBRARY_PATH'
,
'/path/to/libs'
);
when
(
mockCache
.
dyLdLibEntry
).
thenReturn
(
dyLdLibEntry
);
logger
=
BufferLogger
.
test
();
logger
=
BufferLogger
.
test
();
iosDeploy
=
IOSDeploy
(
iosDeploy
=
IOSDeploy
(
artifacts:
mockArtifacts
,
artifacts:
mockArtifacts
,
cache:
mockC
ache
,
cache:
c
ache
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
);
);
iMobileDevice
=
IMobileDevice
(
iMobileDevice
=
IMobileDevice
(
artifacts:
mockArtifacts
,
artifacts:
mockArtifacts
,
cache:
mockC
ache
,
cache:
c
ache
,
logger:
logger
,
logger:
logger
,
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
);
);
...
@@ -214,7 +212,7 @@ void main() {
...
@@ -214,7 +212,7 @@ void main() {
IOSDevicePortForwarder
portForwarder
;
IOSDevicePortForwarder
portForwarder
;
ForwardedPort
forwardedPort
;
ForwardedPort
forwardedPort
;
Artifacts
mockArtifacts
;
Artifacts
mockArtifacts
;
MockCache
mockC
ache
;
Cache
c
ache
;
Logger
logger
;
Logger
logger
;
IOSDeploy
iosDeploy
;
IOSDeploy
iosDeploy
;
FileSystem
nullFileSystem
;
FileSystem
nullFileSystem
;
...
@@ -262,10 +260,10 @@ void main() {
...
@@ -262,10 +260,10 @@ void main() {
mockProcess3
=
MockProcess
();
mockProcess3
=
MockProcess
();
forwardedPort
=
ForwardedPort
.
withContext
(
123
,
456
,
mockProcess3
);
forwardedPort
=
ForwardedPort
.
withContext
(
123
,
456
,
mockProcess3
);
mockArtifacts
=
MockArtifacts
();
mockArtifacts
=
MockArtifacts
();
mockCache
=
MockCache
();
cache
=
Cache
.
test
();
iosDeploy
=
IOSDeploy
(
iosDeploy
=
IOSDeploy
(
artifacts:
mockArtifacts
,
artifacts:
mockArtifacts
,
cache:
mockC
ache
,
cache:
c
ache
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
...
@@ -306,7 +304,7 @@ void main() {
...
@@ -306,7 +304,7 @@ void main() {
group
(
'polling'
,
()
{
group
(
'polling'
,
()
{
MockXcdevice
mockXcdevice
;
MockXcdevice
mockXcdevice
;
MockArtifacts
mockArtifacts
;
MockArtifacts
mockArtifacts
;
MockCache
mockC
ache
;
Cache
c
ache
;
MockVmService
mockVmService1
;
MockVmService
mockVmService1
;
MockVmService
mockVmService2
;
MockVmService
mockVmService2
;
FakeProcessManager
fakeProcessManager
;
FakeProcessManager
fakeProcessManager
;
...
@@ -320,7 +318,7 @@ void main() {
...
@@ -320,7 +318,7 @@ void main() {
setUp
(()
{
setUp
(()
{
mockXcdevice
=
MockXcdevice
();
mockXcdevice
=
MockXcdevice
();
mockArtifacts
=
MockArtifacts
();
mockArtifacts
=
MockArtifacts
();
mockCache
=
MockCache
();
cache
=
Cache
.
test
();
mockVmService1
=
MockVmService
();
mockVmService1
=
MockVmService
();
mockVmService2
=
MockVmService
();
mockVmService2
=
MockVmService
();
logger
=
BufferLogger
.
test
();
logger
=
BufferLogger
.
test
();
...
@@ -328,14 +326,14 @@ void main() {
...
@@ -328,14 +326,14 @@ void main() {
fakeProcessManager
=
FakeProcessManager
.
any
();
fakeProcessManager
=
FakeProcessManager
.
any
();
iosDeploy
=
IOSDeploy
(
iosDeploy
=
IOSDeploy
(
artifacts:
mockArtifacts
,
artifacts:
mockArtifacts
,
cache:
mockC
ache
,
cache:
c
ache
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
processManager:
fakeProcessManager
,
processManager:
fakeProcessManager
,
);
);
iMobileDevice
=
IMobileDevice
(
iMobileDevice
=
IMobileDevice
(
artifacts:
mockArtifacts
,
artifacts:
mockArtifacts
,
cache:
mockC
ache
,
cache:
c
ache
,
processManager:
fakeProcessManager
,
processManager:
fakeProcessManager
,
logger:
logger
,
logger:
logger
,
);
);
...
@@ -605,7 +603,6 @@ void main() {
...
@@ -605,7 +603,6 @@ void main() {
class
MockIOSApp
extends
Mock
implements
IOSApp
{}
class
MockIOSApp
extends
Mock
implements
IOSApp
{}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockIMobileDevice
extends
Mock
implements
IMobileDevice
{}
class
MockIMobileDevice
extends
Mock
implements
IMobileDevice
{}
class
MockIOSDeploy
extends
Mock
implements
IOSDeploy
{}
class
MockIOSDeploy
extends
Mock
implements
IOSDeploy
{}
class
MockIOSWorkflow
extends
Mock
implements
IOSWorkflow
{}
class
MockIOSWorkflow
extends
Mock
implements
IOSWorkflow
{}
...
...
packages/flutter_tools/test/general.shard/ios/ios_deploy_test.dart
View file @
becaf491
...
@@ -9,16 +9,25 @@ import 'package:flutter_tools/src/artifacts.dart';
...
@@ -9,16 +9,25 @@ import 'package:flutter_tools/src/artifacts.dart';
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/ios/devices.dart'
;
import
'package:flutter_tools/src/ios/devices.dart'
;
import
'package:flutter_tools/src/ios/ios_deploy.dart'
;
import
'package:flutter_tools/src/ios/ios_deploy.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:process/process.dart'
;
import
'package:process/process.dart'
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fakes.dart'
;
void
main
(
)
{
void
main
(
)
{
Artifacts
artifacts
;
String
iosDeployPath
;
setUp
(()
{
artifacts
=
Artifacts
.
test
();
iosDeployPath
=
artifacts
.
getArtifactPath
(
Artifact
.
iosDeploy
,
platform:
TargetPlatform
.
ios
);
});
testWithoutContext
(
'IOSDeploy.iosDeployEnv returns path with /usr/bin first'
,
()
{
testWithoutContext
(
'IOSDeploy.iosDeployEnv returns path with /usr/bin first'
,
()
{
final
IOSDeploy
iosDeploy
=
setUpIOSDeploy
(
FakeProcessManager
.
any
());
final
IOSDeploy
iosDeploy
=
setUpIOSDeploy
(
FakeProcessManager
.
any
());
final
Map
<
String
,
String
>
environment
=
iosDeploy
.
iosDeployEnv
;
final
Map
<
String
,
String
>
environment
=
iosDeploy
.
iosDeployEnv
;
...
@@ -35,7 +44,7 @@ void main () {
...
@@ -35,7 +44,7 @@ void main () {
'-t'
,
'-t'
,
'0'
,
'0'
,
'/dev/null'
,
'/dev/null'
,
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'123'
,
'123'
,
'--bundle'
,
'--bundle'
,
...
@@ -47,12 +56,12 @@ void main () {
...
@@ -47,12 +56,12 @@ void main () {
].
join
(
' '
),
].
join
(
' '
),
],
environment:
const
<
String
,
String
>{
],
environment:
const
<
String
,
String
>{
'PATH'
:
'/usr/bin:/usr/local/bin:/usr/bin'
,
'PATH'
:
'/usr/bin:/usr/local/bin:/usr/bin'
,
'DYLD_LIBRARY_PATH'
:
'/path/to/libs'
,
'DYLD_LIBRARY_PATH'
:
'/path/to/lib
rarie
s'
,
},
},
stdout:
'(lldb) run
\n
success
\n
Did finish launching.'
,
stdout:
'(lldb) run
\n
success
\n
Did finish launching.'
,
),
),
]);
]);
final
IOSDeploy
iosDeploy
=
setUpIOSDeploy
(
processManager
);
final
IOSDeploy
iosDeploy
=
setUpIOSDeploy
(
processManager
,
artifacts:
artifacts
);
final
IOSDeployDebugger
iosDeployDebugger
=
iosDeploy
.
prepareDebuggerForLaunch
(
final
IOSDeployDebugger
iosDeployDebugger
=
iosDeploy
.
prepareDebuggerForLaunch
(
deviceId:
'123'
,
deviceId:
'123'
,
bundlePath:
'/'
,
bundlePath:
'/'
,
...
@@ -229,8 +238,8 @@ void main () {
...
@@ -229,8 +238,8 @@ void main () {
const
String
deviceId
=
'123'
;
const
String
deviceId
=
'123'
;
const
String
bundleId
=
'com.example.app'
;
const
String
bundleId
=
'com.example.app'
;
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
deviceId
,
deviceId
,
'--uninstall_only'
,
'--uninstall_only'
,
...
@@ -238,7 +247,7 @@ void main () {
...
@@ -238,7 +247,7 @@ void main () {
bundleId
,
bundleId
,
])
])
]);
]);
final
IOSDeploy
iosDeploy
=
setUpIOSDeploy
(
processManager
);
final
IOSDeploy
iosDeploy
=
setUpIOSDeploy
(
processManager
,
artifacts:
artifacts
);
final
int
exitCode
=
await
iosDeploy
.
uninstallApp
(
final
int
exitCode
=
await
iosDeploy
.
uninstallApp
(
deviceId:
deviceId
,
deviceId:
deviceId
,
bundleId:
bundleId
,
bundleId:
bundleId
,
...
@@ -252,8 +261,8 @@ void main () {
...
@@ -252,8 +261,8 @@ void main () {
const
String
deviceId
=
'123'
;
const
String
deviceId
=
'123'
;
const
String
bundleId
=
'com.example.app'
;
const
String
bundleId
=
'com.example.app'
;
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
deviceId
,
deviceId
,
'--uninstall_only'
,
'--uninstall_only'
,
...
@@ -261,7 +270,7 @@ void main () {
...
@@ -261,7 +270,7 @@ void main () {
bundleId
,
bundleId
,
],
exitCode:
1
)
],
exitCode:
1
)
]);
]);
final
IOSDeploy
iosDeploy
=
setUpIOSDeploy
(
processManager
);
final
IOSDeploy
iosDeploy
=
setUpIOSDeploy
(
processManager
,
artifacts:
artifacts
);
final
int
exitCode
=
await
iosDeploy
.
uninstallApp
(
final
int
exitCode
=
await
iosDeploy
.
uninstallApp
(
deviceId:
deviceId
,
deviceId:
deviceId
,
bundleId:
bundleId
,
bundleId:
bundleId
,
...
@@ -273,30 +282,27 @@ void main () {
...
@@ -273,30 +282,27 @@ void main () {
});
});
}
}
IOSDeploy
setUpIOSDeploy
(
ProcessManager
processManager
)
{
IOSDeploy
setUpIOSDeploy
(
ProcessManager
processManager
,
{
const
MapEntry
<
String
,
String
>
kDyLdLibEntry
=
MapEntry
<
String
,
String
>(
Artifacts
artifacts
,
'DYLD_LIBRARY_PATH'
,
'/path/to/libs'
,
})
{
);
final
FakePlatform
macPlatform
=
FakePlatform
(
final
FakePlatform
macPlatform
=
FakePlatform
(
operatingSystem:
'macos'
,
operatingSystem:
'macos'
,
environment:
<
String
,
String
>{
environment:
<
String
,
String
>{
'PATH'
:
'/usr/local/bin:/usr/bin'
'PATH'
:
'/usr/local/bin:/usr/bin'
}
}
);
);
final
MockArtifacts
artifacts
=
MockArtifacts
();
final
Cache
cache
=
Cache
.
test
(
final
MockCache
cache
=
MockCache
();
platform:
macPlatform
,
artifacts:
<
ArtifactSet
>[
FakeDyldEnvironmentArtifact
(),
],
);
when
(
cache
.
dyLdLibEntry
).
thenReturn
(
kDyLdLibEntry
);
when
(
artifacts
.
getArtifactPath
(
Artifact
.
iosDeploy
,
platform:
anyNamed
(
'platform'
)))
.
thenReturn
(
'ios-deploy'
);
return
IOSDeploy
(
return
IOSDeploy
(
logger:
BufferLogger
.
test
(),
logger:
BufferLogger
.
test
(),
platform:
macPlatform
,
platform:
macPlatform
,
processManager:
processManager
,
processManager:
processManager
,
artifacts:
artifacts
,
artifacts:
artifacts
??
Artifacts
.
test
()
,
cache:
cache
,
cache:
cache
,
);
);
}
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockCache
extends
Mock
implements
Cache
{}
packages/flutter_tools/test/general.shard/ios/ios_device_install_test.dart
View file @
becaf491
...
@@ -21,12 +21,21 @@ import 'package:vm_service/vm_service.dart';
...
@@ -21,12 +21,21 @@ import 'package:vm_service/vm_service.dart';
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fakes.dart'
;
const
Map
<
String
,
String
>
kDyLdLibEntry
=
<
String
,
String
>{
const
Map
<
String
,
String
>
kDyLdLibEntry
=
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
'/path/to/libs'
,
'DYLD_LIBRARY_PATH'
:
'/path/to/lib
rarie
s'
,
};
};
void
main
(
)
{
void
main
(
)
{
Artifacts
artifacts
;
String
iosDeployPath
;
setUp
(()
{
artifacts
=
Artifacts
.
test
();
iosDeployPath
=
artifacts
.
getArtifactPath
(
Artifact
.
iosDeploy
,
platform:
TargetPlatform
.
ios
);
});
testWithoutContext
(
'IOSDevice.installApp calls ios-deploy correctly with USB'
,
()
async
{
testWithoutContext
(
'IOSDevice.installApp calls ios-deploy correctly with USB'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
...
@@ -34,14 +43,14 @@ void main() {
...
@@ -34,14 +43,14 @@ void main() {
bundleDir:
fileSystem
.
currentDirectory
,
bundleDir:
fileSystem
.
currentDirectory
,
);
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'1234'
,
'1234'
,
'--bundle'
,
'--bundle'
,
'/'
,
'/'
,
'--no-wifi'
,
'--no-wifi'
,
],
environment:
<
String
,
String
>{
],
environment:
const
<
String
,
String
>{
'PATH'
:
'/usr/bin:null'
,
'PATH'
:
'/usr/bin:null'
,
...
kDyLdLibEntry
,
...
kDyLdLibEntry
,
})
})
...
@@ -50,6 +59,7 @@ void main() {
...
@@ -50,6 +59,7 @@ void main() {
processManager:
processManager
,
processManager:
processManager
,
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
interfaceType:
IOSDeviceInterface
.
usb
,
interfaceType:
IOSDeviceInterface
.
usb
,
artifacts:
artifacts
,
);
);
final
bool
wasInstalled
=
await
device
.
installApp
(
iosApp
);
final
bool
wasInstalled
=
await
device
.
installApp
(
iosApp
);
...
@@ -64,13 +74,13 @@ void main() {
...
@@ -64,13 +74,13 @@ void main() {
bundleDir:
fileSystem
.
currentDirectory
,
bundleDir:
fileSystem
.
currentDirectory
,
);
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'1234'
,
'1234'
,
'--bundle'
,
'--bundle'
,
'/'
,
'/'
,
],
environment:
<
String
,
String
>{
],
environment:
const
<
String
,
String
>{
'PATH'
:
'/usr/bin:null'
,
'PATH'
:
'/usr/bin:null'
,
...
kDyLdLibEntry
,
...
kDyLdLibEntry
,
})
})
...
@@ -79,6 +89,7 @@ void main() {
...
@@ -79,6 +89,7 @@ void main() {
processManager:
processManager
,
processManager:
processManager
,
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
interfaceType:
IOSDeviceInterface
.
network
,
interfaceType:
IOSDeviceInterface
.
network
,
artifacts:
artifacts
,
);
);
final
bool
wasInstalled
=
await
device
.
installApp
(
iosApp
);
final
bool
wasInstalled
=
await
device
.
installApp
(
iosApp
);
...
@@ -89,19 +100,19 @@ void main() {
...
@@ -89,19 +100,19 @@ void main() {
testWithoutContext
(
'IOSDevice.uninstallApp calls ios-deploy correctly'
,
()
async
{
testWithoutContext
(
'IOSDevice.uninstallApp calls ios-deploy correctly'
,
()
async
{
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'1234'
,
'1234'
,
'--uninstall_only'
,
'--uninstall_only'
,
'--bundle_id'
,
'--bundle_id'
,
'app'
,
'app'
,
],
environment:
<
String
,
String
>{
],
environment:
const
<
String
,
String
>{
'PATH'
:
'/usr/bin:null'
,
'PATH'
:
'/usr/bin:null'
,
...
kDyLdLibEntry
,
...
kDyLdLibEntry
,
})
})
]);
]);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
,
artifacts:
artifacts
);
final
bool
wasUninstalled
=
await
device
.
uninstallApp
(
iosApp
);
final
bool
wasUninstalled
=
await
device
.
uninstallApp
(
iosApp
);
expect
(
wasUninstalled
,
true
);
expect
(
wasUninstalled
,
true
);
...
@@ -112,8 +123,8 @@ void main() {
...
@@ -112,8 +123,8 @@ void main() {
testWithoutContext
(
'catches ProcessException from ios-deploy'
,
()
async
{
testWithoutContext
(
'catches ProcessException from ios-deploy'
,
()
async
{
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
const
<
String
>[
FakeCommand
(
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'1234'
,
'1234'
,
'--exists'
,
'--exists'
,
...
@@ -128,7 +139,7 @@ void main() {
...
@@ -128,7 +139,7 @@ void main() {
throw
const
ProcessException
(
'ios-deploy'
,
<
String
>[]);
throw
const
ProcessException
(
'ios-deploy'
,
<
String
>[]);
})
})
]);
]);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
,
artifacts:
artifacts
);
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
expect
(
isAppInstalled
,
false
);
expect
(
isAppInstalled
,
false
);
...
@@ -138,8 +149,8 @@ void main() {
...
@@ -138,8 +149,8 @@ void main() {
testWithoutContext
(
'returns true when app is installed'
,
()
async
{
testWithoutContext
(
'returns true when app is installed'
,
()
async
{
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'1234'
,
'1234'
,
'--exists'
,
'--exists'
,
...
@@ -147,12 +158,12 @@ void main() {
...
@@ -147,12 +158,12 @@ void main() {
'10'
,
'10'
,
'--bundle_id'
,
'--bundle_id'
,
'app'
,
'app'
,
],
environment:
<
String
,
String
>{
],
environment:
const
<
String
,
String
>{
'PATH'
:
'/usr/bin:null'
,
'PATH'
:
'/usr/bin:null'
,
...
kDyLdLibEntry
,
...
kDyLdLibEntry
,
},
exitCode:
0
)
},
exitCode:
0
)
]);
]);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
,
artifacts:
artifacts
);
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
expect
(
isAppInstalled
,
isTrue
);
expect
(
isAppInstalled
,
isTrue
);
...
@@ -162,8 +173,8 @@ void main() {
...
@@ -162,8 +173,8 @@ void main() {
testWithoutContext
(
'returns false when app is not installed'
,
()
async
{
testWithoutContext
(
'returns false when app is not installed'
,
()
async
{
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'1234'
,
'1234'
,
'--exists'
,
'--exists'
,
...
@@ -171,13 +182,13 @@ void main() {
...
@@ -171,13 +182,13 @@ void main() {
'10'
,
'10'
,
'--bundle_id'
,
'--bundle_id'
,
'app'
,
'app'
,
],
environment:
<
String
,
String
>{
],
environment:
const
<
String
,
String
>{
'PATH'
:
'/usr/bin:null'
,
'PATH'
:
'/usr/bin:null'
,
...
kDyLdLibEntry
,
...
kDyLdLibEntry
,
},
exitCode:
255
)
},
exitCode:
255
)
]);
]);
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
,
logger:
logger
);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
,
logger:
logger
,
artifacts:
artifacts
);
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
expect
(
isAppInstalled
,
isFalse
);
expect
(
isAppInstalled
,
isFalse
);
...
@@ -189,8 +200,8 @@ void main() {
...
@@ -189,8 +200,8 @@ void main() {
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
const
String
stderr
=
'2020-03-26 17:48:43.484 ios-deploy[21518:5501783] [ !! ] Timed out waiting for device'
;
const
String
stderr
=
'2020-03-26 17:48:43.484 ios-deploy[21518:5501783] [ !! ] Timed out waiting for device'
;
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'1234'
,
'1234'
,
'--exists'
,
'--exists'
,
...
@@ -198,14 +209,14 @@ void main() {
...
@@ -198,14 +209,14 @@ void main() {
'10'
,
'10'
,
'--bundle_id'
,
'--bundle_id'
,
'app'
,
'app'
,
],
environment:
<
String
,
String
>{
],
environment:
const
<
String
,
String
>{
'PATH'
:
'/usr/bin:null'
,
'PATH'
:
'/usr/bin:null'
,
...
kDyLdLibEntry
,
...
kDyLdLibEntry
,
},
stderr:
stderr
,
},
stderr:
stderr
,
exitCode:
253
)
exitCode:
253
)
]);
]);
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
,
logger:
logger
);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
,
logger:
logger
,
artifacts:
artifacts
);
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
final
bool
isAppInstalled
=
await
device
.
isAppInstalled
(
iosApp
);
expect
(
isAppInstalled
,
isFalse
);
expect
(
isAppInstalled
,
isFalse
);
...
@@ -221,8 +232,8 @@ void main() {
...
@@ -221,8 +232,8 @@ void main() {
bundleDir:
fileSystem
.
currentDirectory
,
bundleDir:
fileSystem
.
currentDirectory
,
);
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
const
<
String
>[
FakeCommand
(
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'1234'
,
'1234'
,
'--bundle'
,
'--bundle'
,
...
@@ -235,7 +246,7 @@ void main() {
...
@@ -235,7 +246,7 @@ void main() {
throw
const
ProcessException
(
'ios-deploy'
,
<
String
>[]);
throw
const
ProcessException
(
'ios-deploy'
,
<
String
>[]);
})
})
]);
]);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
,
artifacts:
artifacts
);
final
bool
wasAppInstalled
=
await
device
.
installApp
(
iosApp
);
final
bool
wasAppInstalled
=
await
device
.
installApp
(
iosApp
);
expect
(
wasAppInstalled
,
false
);
expect
(
wasAppInstalled
,
false
);
...
@@ -244,8 +255,8 @@ void main() {
...
@@ -244,8 +255,8 @@ void main() {
testWithoutContext
(
'IOSDevice.uninstallApp catches ProcessException from ios-deploy'
,
()
async
{
testWithoutContext
(
'IOSDevice.uninstallApp catches ProcessException from ios-deploy'
,
()
async
{
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
const
<
String
>[
FakeCommand
(
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'1234'
,
'1234'
,
'--uninstall_only'
,
'--uninstall_only'
,
...
@@ -258,7 +269,7 @@ void main() {
...
@@ -258,7 +269,7 @@ void main() {
throw
const
ProcessException
(
'ios-deploy'
,
<
String
>[]);
throw
const
ProcessException
(
'ios-deploy'
,
<
String
>[]);
})
})
]);
]);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
);
final
IOSDevice
device
=
setUpIOSDevice
(
processManager:
processManager
,
artifacts:
artifacts
);
final
bool
wasAppUninstalled
=
await
device
.
uninstallApp
(
iosApp
);
final
bool
wasAppUninstalled
=
await
device
.
uninstallApp
(
iosApp
);
expect
(
wasAppUninstalled
,
false
);
expect
(
wasAppUninstalled
,
false
);
...
@@ -270,17 +281,20 @@ IOSDevice setUpIOSDevice({
...
@@ -270,17 +281,20 @@ IOSDevice setUpIOSDevice({
FileSystem
fileSystem
,
FileSystem
fileSystem
,
Logger
logger
,
Logger
logger
,
IOSDeviceInterface
interfaceType
,
IOSDeviceInterface
interfaceType
,
Artifacts
artifacts
,
})
{
})
{
logger
??=
BufferLogger
.
test
();
logger
??=
BufferLogger
.
test
();
final
FakePlatform
platform
=
FakePlatform
(
final
FakePlatform
platform
=
FakePlatform
(
operatingSystem:
'macos'
,
operatingSystem:
'macos'
,
environment:
<
String
,
String
>{},
environment:
<
String
,
String
>{},
);
);
final
MockArtifacts
artifacts
=
MockArtifacts
();
artifacts
??=
Artifacts
.
test
();
final
MockCache
cache
=
MockCache
();
final
Cache
cache
=
Cache
.
test
(
when
(
cache
.
dyLdLibEntry
).
thenReturn
(
kDyLdLibEntry
.
entries
.
first
);
platform:
platform
,
when
(
artifacts
.
getArtifactPath
(
Artifact
.
iosDeploy
,
platform:
anyNamed
(
'platform'
)))
artifacts:
<
ArtifactSet
>[
.
thenReturn
(
'ios-deploy'
);
FakeDyldEnvironmentArtifact
(),
],
);
return
IOSDevice
(
return
IOSDevice
(
'1234'
,
'1234'
,
name:
'iPhone 1'
,
name:
'iPhone 1'
,
...
@@ -308,6 +322,4 @@ IOSDevice setUpIOSDevice({
...
@@ -308,6 +322,4 @@ IOSDevice setUpIOSDevice({
);
);
}
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockVmService
extends
Mock
implements
VmService
{}
class
MockVmService
extends
Mock
implements
VmService
{}
packages/flutter_tools/test/general.shard/ios/ios_device_start_nonprebuilt_test.dart
View file @
becaf491
...
@@ -25,6 +25,7 @@ import 'package:vm_service/vm_service.dart';
...
@@ -25,6 +25,7 @@ import 'package:vm_service/vm_service.dart';
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
List
<
String
>
_xattrArgs
(
FlutterProject
flutterProject
)
{
List
<
String
>
_xattrArgs
(
FlutterProject
flutterProject
)
{
return
<
String
>[
return
<
String
>[
...
@@ -68,6 +69,14 @@ final FakePlatform macPlatform = FakePlatform(
...
@@ -68,6 +69,14 @@ final FakePlatform macPlatform = FakePlatform(
);
);
void
main
(
)
{
void
main
(
)
{
Artifacts
artifacts
;
String
iosDeployPath
;
setUp
(()
{
artifacts
=
Artifacts
.
test
();
iosDeployPath
=
artifacts
.
getArtifactPath
(
Artifact
.
iosDeploy
,
platform:
TargetPlatform
.
ios
);
});
group
(
'IOSDevice.startApp succeeds in release mode'
,
()
{
group
(
'IOSDevice.startApp succeeds in release mode'
,
()
{
FileSystem
fileSystem
;
FileSystem
fileSystem
;
FakeProcessManager
processManager
;
FakeProcessManager
processManager
;
...
@@ -104,6 +113,7 @@ void main() {
...
@@ -104,6 +113,7 @@ void main() {
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
processManager:
processManager
,
processManager:
processManager
,
logger:
logger
,
logger:
logger
,
artifacts:
artifacts
,
);
);
setUpIOSProject
(
fileSystem
);
setUpIOSProject
(
fileSystem
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
...
@@ -114,7 +124,7 @@ void main() {
...
@@ -114,7 +124,7 @@ void main() {
processManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[...
kRunReleaseArgs
,
'-showBuildSettings'
]));
processManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[...
kRunReleaseArgs
,
'-showBuildSettings'
]));
processManager
.
addCommand
(
FakeCommand
(
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'123'
,
'123'
,
'--bundle'
,
'--bundle'
,
...
@@ -155,6 +165,7 @@ void main() {
...
@@ -155,6 +165,7 @@ void main() {
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
processManager:
processManager
,
processManager:
processManager
,
logger:
logger
,
logger:
logger
,
artifacts:
artifacts
,
);
);
setUpIOSProject
(
fileSystem
);
setUpIOSProject
(
fileSystem
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
...
@@ -176,7 +187,7 @@ void main() {
...
@@ -176,7 +187,7 @@ void main() {
));
));
processManager
.
addCommand
(
FakeCommand
(
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'123'
,
'123'
,
'--bundle'
,
'--bundle'
,
...
@@ -228,6 +239,7 @@ void main() {
...
@@ -228,6 +239,7 @@ void main() {
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
processManager:
processManager
,
processManager:
processManager
,
logger:
logger
,
logger:
logger
,
artifacts:
artifacts
,
);
);
setUpIOSProject
(
fileSystem
);
setUpIOSProject
(
fileSystem
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
...
@@ -250,7 +262,7 @@ void main() {
...
@@ -250,7 +262,7 @@ void main() {
));
));
processManager
.
addCommand
(
FakeCommand
(
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
command:
<
String
>[
'ios-deploy'
,
iosDeployPath
,
'--id'
,
'--id'
,
'123'
,
'123'
,
'--bundle'
,
'--bundle'
,
...
@@ -306,17 +318,16 @@ IOSDevice setUpIOSDevice({
...
@@ -306,17 +318,16 @@ IOSDevice setUpIOSDevice({
FileSystem
fileSystem
,
FileSystem
fileSystem
,
Logger
logger
,
Logger
logger
,
ProcessManager
processManager
,
ProcessManager
processManager
,
Artifacts
artifacts
,
})
{
})
{
const
MapEntry
<
String
,
String
>
dyldLibraryEntry
=
MapEntry
<
String
,
String
>(
artifacts
??=
Artifacts
.
test
();
'DYLD_LIBRARY_PATH'
,
final
Cache
cache
=
Cache
.
test
(
'/path/to/libraries'
,
artifacts:
<
ArtifactSet
>[
FakeDyldEnvironmentArtifact
(),
],
);
);
final
MockCache
cache
=
MockCache
();
final
MockArtifacts
artifacts
=
MockArtifacts
();
logger
??=
BufferLogger
.
test
();
logger
??=
BufferLogger
.
test
();
when
(
cache
.
dyLdLibEntry
).
thenReturn
(
dyldLibraryEntry
);
when
(
artifacts
.
getArtifactPath
(
Artifact
.
iosDeploy
,
platform:
anyNamed
(
'platform'
)))
.
thenReturn
(
'ios-deploy'
);
return
IOSDevice
(
'123'
,
return
IOSDevice
(
'123'
,
name:
'iPhone 1'
,
name:
'iPhone 1'
,
sdkVersion:
sdkVersion
,
sdkVersion:
sdkVersion
,
...
@@ -343,8 +354,6 @@ IOSDevice setUpIOSDevice({
...
@@ -343,8 +354,6 @@ IOSDevice setUpIOSDevice({
);
);
}
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockXcode
extends
Mock
implements
Xcode
{}
class
MockXcode
extends
Mock
implements
Xcode
{}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
class
MockVmService
extends
Mock
implements
VmService
{}
class
MockVmService
extends
Mock
implements
VmService
{}
packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart
View file @
becaf491
...
@@ -32,7 +32,7 @@ import '../../src/fakes.dart';
...
@@ -32,7 +32,7 @@ import '../../src/fakes.dart';
const
FakeCommand
kDeployCommand
=
FakeCommand
(
const
FakeCommand
kDeployCommand
=
FakeCommand
(
command:
<
String
>[
command:
<
String
>[
'
ios-deploy
'
,
'
Artifact.iosDeploy.TargetPlatform.ios
'
,
'--id'
,
'--id'
,
'123'
,
'123'
,
'--bundle'
,
'--bundle'
,
...
@@ -48,7 +48,7 @@ const FakeCommand kDeployCommand = FakeCommand(
...
@@ -48,7 +48,7 @@ const FakeCommand kDeployCommand = FakeCommand(
// The command used to actually launch the app with args in release/profile.
// The command used to actually launch the app with args in release/profile.
const
FakeCommand
kLaunchReleaseCommand
=
FakeCommand
(
const
FakeCommand
kLaunchReleaseCommand
=
FakeCommand
(
command:
<
String
>[
command:
<
String
>[
'
ios-deploy
'
,
'
Artifact.iosDeploy.TargetPlatform.ios
'
,
'--id'
,
'--id'
,
'123'
,
'123'
,
'--bundle'
,
'--bundle'
,
...
@@ -67,7 +67,7 @@ const FakeCommand kLaunchReleaseCommand = FakeCommand(
...
@@ -67,7 +67,7 @@ const FakeCommand kLaunchReleaseCommand = FakeCommand(
// The command used to just launch the app with args in debug.
// The command used to just launch the app with args in debug.
const
FakeCommand
kLaunchDebugCommand
=
FakeCommand
(
command:
<
String
>[
const
FakeCommand
kLaunchDebugCommand
=
FakeCommand
(
command:
<
String
>[
'
ios-deploy
'
,
'
Artifact.iosDeploy.TargetPlatform.ios
'
,
'--id'
,
'--id'
,
'123'
,
'123'
,
'--bundle'
,
'--bundle'
,
...
@@ -87,7 +87,7 @@ const FakeCommand kAttachDebuggerCommand = FakeCommand(command: <String>[
...
@@ -87,7 +87,7 @@ const FakeCommand kAttachDebuggerCommand = FakeCommand(command: <String>[
'-t'
,
'-t'
,
'0'
,
'0'
,
'/dev/null'
,
'/dev/null'
,
'
ios-deploy
'
,
'
Artifact.iosDeploy.TargetPlatform.ios
'
,
'--id'
,
'--id'
,
'123'
,
'123'
,
'--bundle'
,
'--bundle'
,
...
@@ -382,7 +382,7 @@ void main() {
...
@@ -382,7 +382,7 @@ void main() {
'-t'
,
'-t'
,
'0'
,
'0'
,
'/dev/null'
,
'/dev/null'
,
'
ios-deploy
'
,
'
Artifact.iosDeploy.TargetPlatform.ios
'
,
'--id'
,
'--id'
,
'123'
,
'123'
,
'--bundle'
,
'--bundle'
,
...
@@ -482,20 +482,20 @@ IOSDevice setUpIOSDevice({
...
@@ -482,20 +482,20 @@ IOSDevice setUpIOSDevice({
ProcessManager
processManager
,
ProcessManager
processManager
,
VmServiceConnector
vmServiceConnector
,
VmServiceConnector
vmServiceConnector
,
})
{
})
{
const
MapEntry
<
String
,
String
>
dyldLibraryEntry
=
MapEntry
<
String
,
String
>(
final
Artifacts
artifacts
=
Artifacts
.
test
();
'DYLD_LIBRARY_PATH'
,
'/path/to/libraries'
,
);
final
MockCache
cache
=
MockCache
();
final
MockArtifacts
artifacts
=
MockArtifacts
();
final
FakePlatform
macPlatform
=
FakePlatform
(
final
FakePlatform
macPlatform
=
FakePlatform
(
operatingSystem:
'macos'
,
operatingSystem:
'macos'
,
environment:
<
String
,
String
>{},
environment:
<
String
,
String
>{},
);
);
final
Cache
cache
=
Cache
.
test
(
platform:
macPlatform
,
artifacts:
<
ArtifactSet
>[
FakeDyldEnvironmentArtifact
(),
],
);
vmServiceConnector
??=
(
String
uri
,
{
Log
log
})
async
=>
MockVmService
();
vmServiceConnector
??=
(
String
uri
,
{
Log
log
})
async
=>
MockVmService
();
when
(
cache
.
dyLdLibEntry
).
thenReturn
(
dyldLibraryEntry
);
when
(
artifacts
.
getArtifactPath
(
Artifact
.
iosDeploy
,
platform:
anyNamed
(
'platform'
)))
.
thenReturn
(
'ios-deploy'
);
return
IOSDevice
(
'123'
,
return
IOSDevice
(
'123'
,
name:
'iPhone 1'
,
name:
'iPhone 1'
,
sdkVersion:
sdkVersion
,
sdkVersion:
sdkVersion
,
...
@@ -526,7 +526,5 @@ class MockDevicePortForwarder extends Mock implements DevicePortForwarder {}
...
@@ -526,7 +526,5 @@ class MockDevicePortForwarder extends Mock implements DevicePortForwarder {}
class
MockDeviceLogReader
extends
Mock
implements
DeviceLogReader
{}
class
MockDeviceLogReader
extends
Mock
implements
DeviceLogReader
{}
class
MockUsage
extends
Mock
implements
Usage
{}
class
MockUsage
extends
Mock
implements
Usage
{}
class
MockMDnsObservatoryDiscovery
extends
Mock
implements
MDnsObservatoryDiscovery
{}
class
MockMDnsObservatoryDiscovery
extends
Mock
implements
MDnsObservatoryDiscovery
{}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockVmService
extends
Mock
implements
VmService
{}
class
MockVmService
extends
Mock
implements
VmService
{}
class
MockDartDevelopmentService
extends
Mock
implements
DartDevelopmentService
{}
class
MockDartDevelopmentService
extends
Mock
implements
DartDevelopmentService
{}
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
becaf491
...
@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/logger.dart';
...
@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/logger.dart';
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/process.dart'
;
import
'package:flutter_tools/src/base/process.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/ios/devices.dart'
;
import
'package:flutter_tools/src/ios/devices.dart'
;
import
'package:flutter_tools/src/ios/mac.dart'
;
import
'package:flutter_tools/src/ios/mac.dart'
;
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
...
@@ -22,14 +21,13 @@ import 'package:process/process.dart';
...
@@ -22,14 +21,13 @@ import 'package:process/process.dart';
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fakes.dart'
;
final
Generator
_kNoColorTerminalPlatform
=
()
=>
FakePlatform
(
stdoutSupportsAnsi:
false
);
final
Generator
_kNoColorTerminalPlatform
=
()
=>
FakePlatform
(
stdoutSupportsAnsi:
false
);
final
Map
<
Type
,
Generator
>
noColorTerminalOverride
=
<
Type
,
Generator
>{
final
Map
<
Type
,
Generator
>
noColorTerminalOverride
=
<
Type
,
Generator
>{
Platform:
_kNoColorTerminalPlatform
,
Platform:
_kNoColorTerminalPlatform
,
};
};
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
class
MockIosProject
extends
Mock
implements
IosProject
{}
class
MockIosProject
extends
Mock
implements
IosProject
{}
...
@@ -42,18 +40,15 @@ void main() {
...
@@ -42,18 +40,15 @@ void main() {
});
});
group
(
'IMobileDevice'
,
()
{
group
(
'IMobileDevice'
,
()
{
final
String
libimobiledevicePath
=
globals
.
fs
.
path
.
join
(
'bin'
,
'cache'
,
'artifacts'
,
'libimobiledevice'
);
Artifacts
artifacts
;
final
String
idevicescreenshotPath
=
globals
.
fs
.
path
.
join
(
libimobiledevicePath
,
'idevicescreenshot'
);
Cache
cache
;
MockArtifacts
mockArtifacts
;
MockCache
mockCache
;
setUp
(()
{
setUp
(()
{
mockCache
=
MockCache
();
artifacts
=
Artifacts
.
test
();
mockArtifacts
=
MockArtifacts
();
cache
=
Cache
.
test
(
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
idevicescreenshot
,
platform:
anyNamed
(
'platform'
))).
thenReturn
(
idevicescreenshotPath
);
artifacts:
<
ArtifactSet
>[
when
(
mockCache
.
dyLdLibEntry
).
thenReturn
(
FakeDyldEnvironmentArtifact
(),
MapEntry
<
String
,
String
>(
'DYLD_LIBRARY_PATH'
,
libimobiledevicePath
)
]);
);
});
});
group
(
'screenshot'
,
()
{
group
(
'screenshot'
,
()
{
...
@@ -63,19 +58,19 @@ void main() {
...
@@ -63,19 +58,19 @@ void main() {
setUp
(()
{
setUp
(()
{
mockProcessManager
=
MockProcessManager
();
mockProcessManager
=
MockProcessManager
();
outputFile
=
MemoryFileSystem
.
test
().
file
(
'image.png'
);
outputFile
=
MemoryFileSystem
.
test
().
file
(
'image.png'
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
idevicescreenshot
,
platform:
anyNamed
(
'platform'
))).
thenReturn
(
idevicescreenshotPath
);
//
when(mockArtifacts.getArtifactPath(Artifact.idevicescreenshot, platform: anyNamed('platform'))).thenReturn(idevicescreenshotPath);
});
});
testWithoutContext
(
'error if idevicescreenshot is not installed'
,
()
async
{
testWithoutContext
(
'error if idevicescreenshot is not installed'
,
()
async
{
// Let `idevicescreenshot` fail with exit code 1.
// Let `idevicescreenshot` fail with exit code 1.
when
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
outputFile
.
path
],
when
(
mockProcessManager
.
run
(<
String
>[
'Artifact.idevicescreenshot.TargetPlatform.ios'
,
outputFile
.
path
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
'Artifact.idevicescreenshot.TargetPlatform.ios'
},
workingDirectory:
null
,
workingDirectory:
null
,
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
1
,
''
,
''
)));
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
1
,
''
,
''
)));
final
IMobileDevice
iMobileDevice
=
IMobileDevice
(
final
IMobileDevice
iMobileDevice
=
IMobileDevice
(
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
cache:
mockC
ache
,
cache:
c
ache
,
processManager:
mockProcessManager
,
processManager:
mockProcessManager
,
logger:
logger
,
logger:
logger
,
);
);
...
@@ -92,8 +87,8 @@ void main() {
...
@@ -92,8 +87,8 @@ void main() {
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
final
IMobileDevice
iMobileDevice
=
IMobileDevice
(
final
IMobileDevice
iMobileDevice
=
IMobileDevice
(
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
cache:
mockC
ache
,
cache:
c
ache
,
processManager:
mockProcessManager
,
processManager:
mockProcessManager
,
logger:
logger
,
logger:
logger
,
);
);
...
@@ -103,8 +98,8 @@ void main() {
...
@@ -103,8 +98,8 @@ void main() {
'1234'
,
'1234'
,
IOSDeviceInterface
.
usb
,
IOSDeviceInterface
.
usb
,
);
);
verify
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
outputFile
.
path
,
'--udid'
,
'1234'
],
verify
(
mockProcessManager
.
run
(<
String
>[
'Artifact.idevicescreenshot.TargetPlatform.ios'
,
outputFile
.
path
,
'--udid'
,
'1234'
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
'/path/to/libraries'
},
workingDirectory:
null
,
workingDirectory:
null
,
));
));
});
});
...
@@ -114,8 +109,8 @@ void main() {
...
@@ -114,8 +109,8 @@ void main() {
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
final
IMobileDevice
iMobileDevice
=
IMobileDevice
(
final
IMobileDevice
iMobileDevice
=
IMobileDevice
(
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
cache:
mockC
ache
,
cache:
c
ache
,
processManager:
mockProcessManager
,
processManager:
mockProcessManager
,
logger:
logger
,
logger:
logger
,
);
);
...
@@ -125,8 +120,8 @@ void main() {
...
@@ -125,8 +120,8 @@ void main() {
'1234'
,
'1234'
,
IOSDeviceInterface
.
network
,
IOSDeviceInterface
.
network
,
);
);
verify
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
outputFile
.
path
,
'--udid'
,
'1234'
,
'--network'
],
verify
(
mockProcessManager
.
run
(<
String
>[
'Artifact.idevicescreenshot.TargetPlatform.ios'
,
outputFile
.
path
,
'--udid'
,
'1234'
,
'--network'
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
'/path/to/libraries'
},
workingDirectory:
null
,
workingDirectory:
null
,
));
));
});
});
...
...
packages/flutter_tools/test/general.shard/macos/xcode_test.dart
View file @
becaf491
...
@@ -79,8 +79,8 @@ void main() {
...
@@ -79,8 +79,8 @@ void main() {
logger:
logger
,
logger:
logger
,
xcode:
mockXcode
,
xcode:
mockXcode
,
platform:
null
,
platform:
null
,
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
cache:
MockCache
(),
cache:
Cache
.
test
(),
iproxy:
IProxy
.
test
(
logger:
logger
,
processManager:
processManager
),
iproxy:
IProxy
.
test
(
logger:
logger
,
processManager:
processManager
),
);
);
});
});
...
@@ -338,20 +338,16 @@ void main() {
...
@@ -338,20 +338,16 @@ void main() {
group
(
'xcdevice'
,
()
{
group
(
'xcdevice'
,
()
{
XCDevice
xcdevice
;
XCDevice
xcdevice
;
MockXcode
mockXcode
;
MockXcode
mockXcode
;
MockArtifacts
mockArtifacts
;
MockCache
mockCache
;
setUp
(()
{
setUp
(()
{
mockXcode
=
MockXcode
();
mockXcode
=
MockXcode
();
mockArtifacts
=
MockArtifacts
();
mockCache
=
MockCache
();
xcdevice
=
XCDevice
(
xcdevice
=
XCDevice
(
processManager:
fakeProcessManager
,
processManager:
fakeProcessManager
,
logger:
logger
,
logger:
logger
,
xcode:
mockXcode
,
xcode:
mockXcode
,
platform:
null
,
platform:
null
,
artifacts:
mockArtifacts
,
artifacts:
Artifacts
.
test
()
,
cache:
mockCache
,
cache:
Cache
.
test
()
,
iproxy:
IProxy
.
test
(
logger:
logger
,
processManager:
fakeProcessManager
),
iproxy:
IProxy
.
test
(
logger:
logger
,
processManager:
fakeProcessManager
),
);
);
});
});
...
@@ -843,5 +839,3 @@ class MockXcode extends Mock implements Xcode {}
...
@@ -843,5 +839,3 @@ class MockXcode extends Mock implements Xcode {}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
class
MockPlatform
extends
Mock
implements
Platform
{}
class
MockPlatform
extends
Mock
implements
Platform
{}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockCache
extends
Mock
implements
Cache
{}
packages/flutter_tools/test/src/fakes.dart
View file @
becaf491
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/device.dart'
;
/// A fake implementation of the [DeviceLogReader].
/// A fake implementation of the [DeviceLogReader].
...
@@ -40,3 +41,22 @@ class FakeDeviceLogReader extends DeviceLogReader {
...
@@ -40,3 +41,22 @@ class FakeDeviceLogReader extends DeviceLogReader {
await
_linesController
.
close
();
await
_linesController
.
close
();
}
}
}
}
/// Environment with DYLD_LIBRARY_PATH=/path/to/libraries
class
FakeDyldEnvironmentArtifact
extends
ArtifactSet
{
FakeDyldEnvironmentArtifact
()
:
super
(
DevelopmentArtifact
.
iOS
);
@override
Map
<
String
,
String
>
get
environment
=>
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
'/path/to/libraries'
};
@override
Future
<
bool
>
isUpToDate
()
=>
Future
<
bool
>.
value
(
true
);
@override
String
get
name
=>
'fake'
;
@override
Future
<
void
>
update
(
ArtifactUpdater
artifactUpdater
)
async
{
}
}
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