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
00658736
Unverified
Commit
00658736
authored
Oct 15, 2021
by
Jenn Magder
Committed by
GitHub
Oct 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate xcdevice and ios devices to null safety (#91704)
parent
299d4849
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
286 additions
and
263 deletions
+286
-263
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+0
-2
cache.dart
packages/flutter_tools/lib/src/cache.dart
+0
-1
device.dart
packages/flutter_tools/lib/src/device.dart
+6
-6
globals.dart
packages/flutter_tools/lib/src/globals.dart
+0
-3
globals_null_migrated.dart
packages/flutter_tools/lib/src/globals_null_migrated.dart
+2
-0
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+109
-106
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+11
-1
xcdevice.dart
packages/flutter_tools/lib/src/macos/xcdevice.dart
+84
-84
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+54
-53
ios_device_project_test.dart
...tools/test/general.shard/ios/ios_device_project_test.dart
+18
-5
xcode_test.dart
...es/flutter_tools/test/general.shard/macos/xcode_test.dart
+2
-2
No files found.
packages/flutter_tools/lib/src/artifacts.dart
View file @
00658736
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:file/memory.dart'
;
import
'package:file/memory.dart'
;
import
'package:meta/meta.dart'
;
import
'package:process/process.dart'
;
import
'package:process/process.dart'
;
import
'base/common.dart'
;
import
'base/common.dart'
;
...
@@ -282,7 +281,6 @@ abstract class Artifacts {
...
@@ -282,7 +281,6 @@ abstract class Artifacts {
/// If a [fileSystem] is not provided, creates a new [MemoryFileSystem] instance.
/// If a [fileSystem] is not provided, creates a new [MemoryFileSystem] instance.
///
///
/// Creates a [LocalEngineArtifacts] if `localEngine` is non-null
/// Creates a [LocalEngineArtifacts] if `localEngine` is non-null
@visibleForTesting
factory
Artifacts
.
test
({
String
?
localEngine
,
FileSystem
?
fileSystem
})
{
factory
Artifacts
.
test
({
String
?
localEngine
,
FileSystem
?
fileSystem
})
{
fileSystem
??=
MemoryFileSystem
.
test
();
fileSystem
??=
MemoryFileSystem
.
test
();
if
(
localEngine
!=
null
)
{
if
(
localEngine
!=
null
)
{
...
...
packages/flutter_tools/lib/src/cache.dart
View file @
00658736
...
@@ -127,7 +127,6 @@ class Cache {
...
@@ -127,7 +127,6 @@ class Cache {
/// Defaults to a memory file system, fake platform,
/// Defaults to a memory file system, fake platform,
/// buffer logger, and no accessible artifacts.
/// buffer logger, and no accessible artifacts.
/// By default, the root cache directory path is "cache".
/// By default, the root cache directory path is "cache".
@visibleForTesting
factory
Cache
.
test
({
factory
Cache
.
test
({
Directory
?
rootOverride
,
Directory
?
rootOverride
,
List
<
ArtifactSet
>?
artifacts
,
List
<
ArtifactSet
>?
artifacts
,
...
...
packages/flutter_tools/lib/src/device.dart
View file @
00658736
...
@@ -468,7 +468,7 @@ abstract class Device {
...
@@ -468,7 +468,7 @@ abstract class Device {
/// The ID returned matches that in the output of `flutter emulators`. Fetching
/// The ID returned matches that in the output of `flutter emulators`. Fetching
/// this name may require connecting to the device and if an error occurs null
/// this name may require connecting to the device and if an error occurs null
/// will be returned.
/// will be returned.
Future
<
String
>
get
emulatorId
;
Future
<
String
?
>
get
emulatorId
;
/// Whether this device can run the provided [buildMode].
/// Whether this device can run the provided [buildMode].
///
///
...
@@ -550,7 +550,7 @@ abstract class Device {
...
@@ -550,7 +550,7 @@ abstract class Device {
/// reader will also include log messages from before the invocation time.
/// reader will also include log messages from before the invocation time.
/// Defaults to false.
/// Defaults to false.
FutureOr
<
DeviceLogReader
>
getLogReader
({
FutureOr
<
DeviceLogReader
>
getLogReader
({
covariant
ApplicationPackage
app
,
covariant
ApplicationPackage
?
app
,
bool
includePastLogs
=
false
,
bool
includePastLogs
=
false
,
});
});
...
@@ -572,13 +572,13 @@ abstract class Device {
...
@@ -572,13 +572,13 @@ abstract class Device {
/// start call. The build mode is not used by all platforms.
/// start call. The build mode is not used by all platforms.
Future
<
LaunchResult
>
startApp
(
Future
<
LaunchResult
>
startApp
(
covariant
ApplicationPackage
package
,
{
covariant
ApplicationPackage
package
,
{
String
mainPath
,
String
?
mainPath
,
String
route
,
String
?
route
,
DebuggingOptions
debuggingOptions
,
required
DebuggingOptions
debuggingOptions
,
Map
<
String
,
Object
?>
platformArgs
,
Map
<
String
,
Object
?>
platformArgs
,
bool
prebuiltApplication
=
false
,
bool
prebuiltApplication
=
false
,
bool
ipv6
=
false
,
bool
ipv6
=
false
,
String
userIdentifier
,
String
?
userIdentifier
,
});
});
/// Whether this device implements support for hot reload.
/// Whether this device implements support for hot reload.
...
...
packages/flutter_tools/lib/src/globals.dart
View file @
00658736
...
@@ -7,11 +7,8 @@
...
@@ -7,11 +7,8 @@
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'doctor.dart'
;
import
'doctor.dart'
;
import
'ios/simulators.dart'
;
import
'ios/simulators.dart'
;
import
'macos/xcdevice.dart'
;
export
'globals_null_migrated.dart'
;
export
'globals_null_migrated.dart'
;
Doctor
get
doctor
=>
context
.
get
<
Doctor
>();
Doctor
get
doctor
=>
context
.
get
<
Doctor
>();
IOSSimulatorUtils
get
iosSimulatorUtils
=>
context
.
get
<
IOSSimulatorUtils
>();
IOSSimulatorUtils
get
iosSimulatorUtils
=>
context
.
get
<
IOSSimulatorUtils
>();
XCDevice
get
xcdevice
=>
context
.
get
<
XCDevice
>();
packages/flutter_tools/lib/src/globals_null_migrated.dart
View file @
00658736
...
@@ -34,6 +34,7 @@ import 'ios/plist_parser.dart';
...
@@ -34,6 +34,7 @@ import 'ios/plist_parser.dart';
import
'ios/xcodeproj.dart'
;
import
'ios/xcodeproj.dart'
;
import
'macos/cocoapods.dart'
;
import
'macos/cocoapods.dart'
;
import
'macos/cocoapods_validator.dart'
;
import
'macos/cocoapods_validator.dart'
;
import
'macos/xcdevice.dart'
;
import
'macos/xcode.dart'
;
import
'macos/xcode.dart'
;
import
'persistent_tool_state.dart'
;
import
'persistent_tool_state.dart'
;
import
'project.dart'
;
import
'project.dart'
;
...
@@ -62,6 +63,7 @@ FlutterVersion get flutterVersion => context.get<FlutterVersion>()!;
...
@@ -62,6 +63,7 @@ FlutterVersion get flutterVersion => context.get<FlutterVersion>()!;
FuchsiaArtifacts
?
get
fuchsiaArtifacts
=>
context
.
get
<
FuchsiaArtifacts
>();
FuchsiaArtifacts
?
get
fuchsiaArtifacts
=>
context
.
get
<
FuchsiaArtifacts
>();
Usage
get
flutterUsage
=>
context
.
get
<
Usage
>()!;
Usage
get
flutterUsage
=>
context
.
get
<
Usage
>()!;
XcodeProjectInterpreter
?
get
xcodeProjectInterpreter
=>
context
.
get
<
XcodeProjectInterpreter
>();
XcodeProjectInterpreter
?
get
xcodeProjectInterpreter
=>
context
.
get
<
XcodeProjectInterpreter
>();
XCDevice
?
get
xcdevice
=>
context
.
get
<
XCDevice
>();
Xcode
?
get
xcode
=>
context
.
get
<
Xcode
>();
Xcode
?
get
xcode
=>
context
.
get
<
Xcode
>();
IOSWorkflow
?
get
iosWorkflow
=>
context
.
get
<
IOSWorkflow
>();
IOSWorkflow
?
get
iosWorkflow
=>
context
.
get
<
IOSWorkflow
>();
LocalEngineLocator
?
get
localEngineLocator
=>
context
.
get
<
LocalEngineLocator
>();
LocalEngineLocator
?
get
localEngineLocator
=>
context
.
get
<
LocalEngineLocator
>();
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
00658736
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/ios/mac.dart
View file @
00658736
...
@@ -45,6 +45,16 @@ class IMobileDevice {
...
@@ -45,6 +45,16 @@ class IMobileDevice {
_processUtils
=
ProcessUtils
(
logger:
logger
,
processManager:
processManager
),
_processUtils
=
ProcessUtils
(
logger:
logger
,
processManager:
processManager
),
_processManager
=
processManager
;
_processManager
=
processManager
;
/// Create an [IMobileDevice] for testing.
factory
IMobileDevice
.
test
({
required
ProcessManager
processManager
})
{
return
IMobileDevice
(
artifacts:
Artifacts
.
test
(),
cache:
Cache
.
test
(
processManager:
processManager
),
processManager:
processManager
,
logger:
BufferLogger
.
test
(),
);
}
final
String
_idevicesyslogPath
;
final
String
_idevicesyslogPath
;
final
String
_idevicescreenshotPath
;
final
String
_idevicescreenshotPath
;
final
MapEntry
<
String
,
String
>
_dyLdLibEntry
;
final
MapEntry
<
String
,
String
>
_dyLdLibEntry
;
...
@@ -93,7 +103,7 @@ class IMobileDevice {
...
@@ -93,7 +103,7 @@ class IMobileDevice {
Future
<
XcodeBuildResult
>
buildXcodeProject
({
Future
<
XcodeBuildResult
>
buildXcodeProject
({
required
BuildableIOSApp
app
,
required
BuildableIOSApp
app
,
required
BuildInfo
buildInfo
,
required
BuildInfo
buildInfo
,
required
String
targetOverride
,
String
?
targetOverride
,
EnvironmentType
environmentType
=
EnvironmentType
.
physical
,
EnvironmentType
environmentType
=
EnvironmentType
.
physical
,
DarwinArch
?
activeArch
,
DarwinArch
?
activeArch
,
bool
codesign
=
true
,
bool
codesign
=
true
,
...
...
packages/flutter_tools/lib/src/macos/xcdevice.dart
View file @
00658736
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
00658736
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'dart:async'
;
import
'dart:io'
as
io
;
import
'dart:io'
as
io
;
...
@@ -39,16 +37,17 @@ void main() {
...
@@ -39,16 +37,17 @@ void main() {
group
(
'IOSDevice'
,
()
{
group
(
'IOSDevice'
,
()
{
final
List
<
Platform
>
unsupportedPlatforms
=
<
Platform
>[
linuxPlatform
,
windowsPlatform
];
final
List
<
Platform
>
unsupportedPlatforms
=
<
Platform
>[
linuxPlatform
,
windowsPlatform
];
Cache
cache
;
late
Cache
cache
;
Logger
logger
;
late
Logger
logger
;
IOSDeploy
iosDeploy
;
late
IOSDeploy
iosDeploy
;
IMobileDevice
iMobileDevice
;
late
IMobileDevice
iMobileDevice
;
FileSystem
nullF
ileSystem
;
late
FileSystem
f
ileSystem
;
setUp
(()
{
setUp
(()
{
final
Artifacts
artifacts
=
Artifacts
.
test
();
final
Artifacts
artifacts
=
Artifacts
.
test
();
cache
=
Cache
.
test
(
processManager:
FakeProcessManager
.
any
());
cache
=
Cache
.
test
(
processManager:
FakeProcessManager
.
any
());
logger
=
BufferLogger
.
test
();
logger
=
BufferLogger
.
test
();
fileSystem
=
MemoryFileSystem
.
test
();
iosDeploy
=
IOSDeploy
(
iosDeploy
=
IOSDeploy
(
artifacts:
artifacts
,
artifacts:
artifacts
,
cache:
cache
,
cache:
cache
,
...
@@ -68,7 +67,7 @@ void main() {
...
@@ -68,7 +67,7 @@ void main() {
IOSDevice
(
IOSDevice
(
'device-123'
,
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
nullF
ileSystem
,
fileSystem:
f
ileSystem
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
iosDeploy:
iosDeploy
,
...
@@ -84,7 +83,7 @@ void main() {
...
@@ -84,7 +83,7 @@ void main() {
expect
(
IOSDevice
(
expect
(
IOSDevice
(
'device-123'
,
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
nullF
ileSystem
,
fileSystem:
f
ileSystem
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
iosDeploy:
iosDeploy
,
...
@@ -97,7 +96,7 @@ void main() {
...
@@ -97,7 +96,7 @@ void main() {
expect
(
IOSDevice
(
expect
(
IOSDevice
(
'device-123'
,
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
nullF
ileSystem
,
fileSystem:
f
ileSystem
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
iosDeploy:
iosDeploy
,
...
@@ -110,7 +109,7 @@ void main() {
...
@@ -110,7 +109,7 @@ void main() {
expect
(
IOSDevice
(
expect
(
IOSDevice
(
'device-123'
,
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
nullF
ileSystem
,
fileSystem:
f
ileSystem
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
iosDeploy:
iosDeploy
,
...
@@ -123,7 +122,7 @@ void main() {
...
@@ -123,7 +122,7 @@ void main() {
expect
(
IOSDevice
(
expect
(
IOSDevice
(
'device-123'
,
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
nullF
ileSystem
,
fileSystem:
f
ileSystem
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
iosDeploy:
iosDeploy
,
...
@@ -136,7 +135,7 @@ void main() {
...
@@ -136,7 +135,7 @@ void main() {
expect
(
IOSDevice
(
expect
(
IOSDevice
(
'device-123'
,
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
nullF
ileSystem
,
fileSystem:
f
ileSystem
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
iosDeploy:
iosDeploy
,
...
@@ -152,7 +151,7 @@ void main() {
...
@@ -152,7 +151,7 @@ void main() {
final
IOSDevice
device
=
IOSDevice
(
final
IOSDevice
device
=
IOSDevice
(
'device-123'
,
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
nullF
ileSystem
,
fileSystem:
f
ileSystem
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
iosDeploy:
iosDeploy
,
...
@@ -170,7 +169,7 @@ void main() {
...
@@ -170,7 +169,7 @@ void main() {
final
IOSDevice
device
=
IOSDevice
(
final
IOSDevice
device
=
IOSDevice
(
'device-123'
,
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
nullF
ileSystem
,
fileSystem:
f
ileSystem
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
iosDeploy:
iosDeploy
,
...
@@ -194,7 +193,7 @@ void main() {
...
@@ -194,7 +193,7 @@ void main() {
IOSDevice
(
IOSDevice
(
'device-123'
,
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
nullF
ileSystem
,
fileSystem:
f
ileSystem
,
logger:
logger
,
logger:
logger
,
platform:
platform
,
platform:
platform
,
iosDeploy:
iosDeploy
,
iosDeploy:
iosDeploy
,
...
@@ -211,21 +210,21 @@ void main() {
...
@@ -211,21 +210,21 @@ void main() {
}
}
group
(
'.dispose()'
,
()
{
group
(
'.dispose()'
,
()
{
IOSDevice
device
;
late
IOSDevice
device
;
FakeIOSApp
appPackage1
;
late
FakeIOSApp
appPackage1
;
FakeIOSApp
appPackage2
;
late
FakeIOSApp
appPackage2
;
IOSDeviceLogReader
logReader1
;
late
IOSDeviceLogReader
logReader1
;
IOSDeviceLogReader
logReader2
;
late
IOSDeviceLogReader
logReader2
;
FakeProcess
process1
;
late
FakeProcess
process1
;
FakeProcess
process2
;
late
FakeProcess
process2
;
FakeProcess
process3
;
late
FakeProcess
process3
;
IOSDevicePortForwarder
portForwarder
;
late
IOSDevicePortForwarder
portForwarder
;
ForwardedPort
forwardedPort
;
late
ForwardedPort
forwardedPort
;
Cache
cache
;
late
Cache
cache
;
Logger
logger
;
late
Logger
logger
;
IOSDeploy
iosDeploy
;
late
IOSDeploy
iosDeploy
;
FileSystem
nullF
ileSystem
;
late
FileSystem
f
ileSystem
;
IProxy
iproxy
;
late
IProxy
iproxy
;
IOSDevicePortForwarder
createPortForwarder
(
IOSDevicePortForwarder
createPortForwarder
(
ForwardedPort
forwardedPort
,
ForwardedPort
forwardedPort
,
...
@@ -235,7 +234,7 @@ void main() {
...
@@ -235,7 +234,7 @@ void main() {
id:
device
.
id
,
id:
device
.
id
,
logger:
logger
,
logger:
logger
,
operatingSystemUtils:
OperatingSystemUtils
(
operatingSystemUtils:
OperatingSystemUtils
(
fileSystem:
nullF
ileSystem
,
fileSystem:
f
ileSystem
,
logger:
logger
,
logger:
logger
,
platform:
FakePlatform
(
operatingSystem:
'macos'
),
platform:
FakePlatform
(
operatingSystem:
'macos'
),
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
...
@@ -253,7 +252,7 @@ void main() {
...
@@ -253,7 +252,7 @@ void main() {
final
IOSDeviceLogReader
logReader
=
IOSDeviceLogReader
.
create
(
final
IOSDeviceLogReader
logReader
=
IOSDeviceLogReader
.
create
(
device:
device
,
device:
device
,
app:
appPackage
,
app:
appPackage
,
iMobileDevice:
null
,
// not used by this test.
iMobileDevice:
IMobileDevice
.
test
(
processManager:
FakeProcessManager
.
any
()),
);
);
logReader
.
idevicesyslogProcess
=
process
;
logReader
.
idevicesyslogProcess
=
process
;
return
logReader
;
return
logReader
;
...
@@ -269,6 +268,8 @@ void main() {
...
@@ -269,6 +268,8 @@ void main() {
cache
=
Cache
.
test
(
cache
=
Cache
.
test
(
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
);
);
fileSystem
=
MemoryFileSystem
.
test
();
logger
=
BufferLogger
.
test
();
iosDeploy
=
IOSDeploy
(
iosDeploy
=
IOSDeploy
(
artifacts:
Artifacts
.
test
(),
artifacts:
Artifacts
.
test
(),
cache:
cache
,
cache:
cache
,
...
@@ -282,7 +283,7 @@ void main() {
...
@@ -282,7 +283,7 @@ void main() {
device
=
IOSDevice
(
device
=
IOSDevice
(
'123'
,
'123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
nullF
ileSystem
,
fileSystem:
f
ileSystem
,
logger:
logger
,
logger:
logger
,
platform:
macPlatform
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
iosDeploy:
iosDeploy
,
...
@@ -309,15 +310,15 @@ void main() {
...
@@ -309,15 +310,15 @@ void main() {
});
});
group
(
'polling'
,
()
{
group
(
'polling'
,
()
{
FakeXcdevice
xcdevice
;
late
FakeXcdevice
xcdevice
;
Cache
cache
;
late
Cache
cache
;
FakeProcessManager
fakeProcessManager
;
late
FakeProcessManager
fakeProcessManager
;
BufferLogger
logger
;
late
BufferLogger
logger
;
IOSDeploy
iosDeploy
;
late
IOSDeploy
iosDeploy
;
IMobileDevice
iMobileDevice
;
late
IMobileDevice
iMobileDevice
;
IOSWorkflow
iosWorkflow
;
late
IOSWorkflow
iosWorkflow
;
IOSDevice
device1
;
late
IOSDevice
device1
;
IOSDevice
device2
;
late
IOSDevice
device2
;
setUp
(()
{
setUp
(()
{
xcdevice
=
FakeXcdevice
();
xcdevice
=
FakeXcdevice
();
...
@@ -414,22 +415,22 @@ void main() {
...
@@ -414,22 +415,22 @@ void main() {
await
iosDevices
.
startPolling
();
await
iosDevices
.
startPolling
();
expect
(
xcdevice
.
getAvailableIOSDevicesCount
,
1
);
expect
(
xcdevice
.
getAvailableIOSDevicesCount
,
1
);
expect
(
iosDevices
.
deviceNotifier
.
items
,
isEmpty
);
expect
(
iosDevices
.
deviceNotifier
!
.
items
,
isEmpty
);
expect
(
xcdevice
.
deviceEventController
.
hasListener
,
isTrue
);
expect
(
xcdevice
.
deviceEventController
.
hasListener
,
isTrue
);
xcdevice
.
deviceEventController
.
add
(<
XCDeviceEvent
,
String
>{
xcdevice
.
deviceEventController
.
add
(<
XCDeviceEvent
,
String
>{
XCDeviceEvent
.
attach
:
'd83d5bc53967baa0ee18626ba87b6254b2ab5418'
XCDeviceEvent
.
attach
:
'd83d5bc53967baa0ee18626ba87b6254b2ab5418'
});
});
await
added
.
future
;
await
added
.
future
;
expect
(
iosDevices
.
deviceNotifier
.
items
.
length
,
2
);
expect
(
iosDevices
.
deviceNotifier
!
.
items
.
length
,
2
);
expect
(
iosDevices
.
deviceNotifier
.
items
,
contains
(
device1
));
expect
(
iosDevices
.
deviceNotifier
!
.
items
,
contains
(
device1
));
expect
(
iosDevices
.
deviceNotifier
.
items
,
contains
(
device2
));
expect
(
iosDevices
.
deviceNotifier
!
.
items
,
contains
(
device2
));
xcdevice
.
deviceEventController
.
add
(<
XCDeviceEvent
,
String
>{
xcdevice
.
deviceEventController
.
add
(<
XCDeviceEvent
,
String
>{
XCDeviceEvent
.
detach
:
'd83d5bc53967baa0ee18626ba87b6254b2ab5418'
XCDeviceEvent
.
detach
:
'd83d5bc53967baa0ee18626ba87b6254b2ab5418'
});
});
await
removed
.
future
;
await
removed
.
future
;
expect
(
iosDevices
.
deviceNotifier
.
items
,
<
Device
>[
device2
]);
expect
(
iosDevices
.
deviceNotifier
!
.
items
,
<
Device
>[
device2
]);
// Remove stream will throw over-completion if called more than once
// Remove stream will throw over-completion if called more than once
// which proves this is ignored.
// which proves this is ignored.
...
@@ -489,7 +490,7 @@ void main() {
...
@@ -489,7 +490,7 @@ void main() {
xcdevice
.
devices
.
add
(<
IOSDevice
>[]);
xcdevice
.
devices
.
add
(<
IOSDevice
>[]);
await
iosDevices
.
startPolling
();
await
iosDevices
.
startPolling
();
expect
(
iosDevices
.
deviceNotifier
.
items
,
isEmpty
);
expect
(
iosDevices
.
deviceNotifier
!
.
items
,
isEmpty
);
expect
(
xcdevice
.
deviceEventController
.
hasListener
,
isTrue
);
expect
(
xcdevice
.
deviceEventController
.
hasListener
,
isTrue
);
iosDevices
.
dispose
();
iosDevices
.
dispose
();
...
@@ -531,9 +532,9 @@ void main() {
...
@@ -531,9 +532,9 @@ void main() {
});
});
group
(
'getDiagnostics'
,
()
{
group
(
'getDiagnostics'
,
()
{
FakeXcdevice
xcdevice
;
late
FakeXcdevice
xcdevice
;
IOSWorkflow
iosWorkflow
;
late
IOSWorkflow
iosWorkflow
;
Logger
logger
;
late
Logger
logger
;
setUp
(()
{
setUp
(()
{
xcdevice
=
FakeXcdevice
();
xcdevice
=
FakeXcdevice
();
...
@@ -601,7 +602,7 @@ class FakeXcdevice extends Fake implements XCDevice {
...
@@ -601,7 +602,7 @@ class FakeXcdevice extends Fake implements XCDevice {
}
}
@override
@override
Future
<
List
<
IOSDevice
>>
getAvailableIOSDevices
({
Duration
timeout
})
async
{
Future
<
List
<
IOSDevice
>>
getAvailableIOSDevices
({
Duration
?
timeout
})
async
{
return
devices
[
getAvailableIOSDevicesCount
++];
return
devices
[
getAvailableIOSDevicesCount
++];
}
}
}
}
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_project_test.dart
View file @
00658736
...
@@ -5,12 +5,16 @@
...
@@ -5,12 +5,16 @@
// @dart = 2.8
// @dart = 2.8
import
'package:file/memory.dart'
;
import
'package:file/memory.dart'
;
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/build_info.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/iproxy.dart'
;
import
'package:flutter_tools/src/ios/iproxy.dart'
;
import
'package:flutter_tools/src/ios/mac.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
...
@@ -76,17 +80,26 @@ flutter:
...
@@ -76,17 +80,26 @@ flutter:
}
}
IOSDevice
setUpIOSDevice
(
FileSystem
fileSystem
)
{
IOSDevice
setUpIOSDevice
(
FileSystem
fileSystem
)
{
final
Platform
platform
=
FakePlatform
(
operatingSystem:
'macos'
);
final
Logger
logger
=
BufferLogger
.
test
();
final
ProcessManager
processManager
=
FakeProcessManager
.
any
();
return
IOSDevice
(
return
IOSDevice
(
'test'
,
'test'
,
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
logger:
logger
,
iosDeploy:
null
,
// not used in this test
iosDeploy:
IOSDeploy
(
iMobileDevice:
null
,
// not used in this test
platform:
platform
,
platform:
FakePlatform
(
operatingSystem:
'macos'
),
logger:
logger
,
processManager:
processManager
,
artifacts:
Artifacts
.
test
(),
cache:
Cache
.
test
(
processManager:
processManager
),
),
iMobileDevice:
IMobileDevice
.
test
(
processManager:
processManager
),
platform:
platform
,
name:
'iPhone 1'
,
name:
'iPhone 1'
,
sdkVersion:
'13.3'
,
sdkVersion:
'13.3'
,
cpuArchitecture:
DarwinArch
.
arm64
,
cpuArchitecture:
DarwinArch
.
arm64
,
iProxy:
IProxy
.
test
(
logger:
BufferLogger
.
test
(),
processManager:
FakeProcessManager
.
any
()
),
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
processManager
),
interfaceType:
IOSDeviceConnectionInterface
.
usb
,
interfaceType:
IOSDeviceConnectionInterface
.
usb
,
);
);
}
}
packages/flutter_tools/test/general.shard/macos/xcode_test.dart
View file @
00658736
...
@@ -326,7 +326,7 @@ void main() {
...
@@ -326,7 +326,7 @@ void main() {
processManager:
fakeProcessManager
,
processManager:
fakeProcessManager
,
logger:
logger
,
logger:
logger
,
xcode:
xcode
,
xcode:
xcode
,
platform:
null
,
platform:
FakePlatform
(
operatingSystem:
'macos'
)
,
artifacts:
Artifacts
.
test
(),
artifacts:
Artifacts
.
test
(),
cache:
Cache
.
test
(
processManager:
FakeProcessManager
.
any
()),
cache:
Cache
.
test
(
processManager:
FakeProcessManager
.
any
()),
iproxy:
IProxy
.
test
(
logger:
logger
,
processManager:
fakeProcessManager
),
iproxy:
IProxy
.
test
(
logger:
logger
,
processManager:
fakeProcessManager
),
...
@@ -354,7 +354,7 @@ void main() {
...
@@ -354,7 +354,7 @@ void main() {
processManager:
fakeProcessManager
,
processManager:
fakeProcessManager
,
logger:
logger
,
logger:
logger
,
xcode:
xcode
,
xcode:
xcode
,
platform:
null
,
platform:
FakePlatform
(
operatingSystem:
'macos'
)
,
artifacts:
Artifacts
.
test
(),
artifacts:
Artifacts
.
test
(),
cache:
Cache
.
test
(
processManager:
FakeProcessManager
.
any
()),
cache:
Cache
.
test
(
processManager:
FakeProcessManager
.
any
()),
iproxy:
IProxy
.
test
(
logger:
logger
,
processManager:
fakeProcessManager
),
iproxy:
IProxy
.
test
(
logger:
logger
,
processManager:
fakeProcessManager
),
...
...
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