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
5b956fd8
Unverified
Commit
5b956fd8
authored
Mar 19, 2020
by
Jonah Williams
Committed by
GitHub
Mar 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] split isSupportedForProject test into new file (#52911)
parent
b05210c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
107 deletions
+94
-107
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+0
-107
ios_device_project_test.dart
...tools/test/general.shard/ios/ios_device_project_test.dart
+94
-0
No files found.
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
5b956fd8
...
...
@@ -23,9 +23,7 @@ import 'package:flutter_tools/src/ios/mac.dart';
import
'package:flutter_tools/src/ios/ios_deploy.dart'
;
import
'package:flutter_tools/src/ios/ios_workflow.dart'
;
import
'package:flutter_tools/src/macos/xcode.dart'
;
import
'package:flutter_tools/src/mdns_discovery.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:meta/meta.dart'
;
...
...
@@ -787,102 +785,6 @@ Runner(libsystem_asl.dylib)[297] <Notice>: libMobileGestalt
IMobileDevice:
()
=>
mockIMobileDevice
,
});
});
group
(
'isSupportedForProject'
,
()
{
Artifacts
mockArtifacts
;
MockCache
mockCache
;
Logger
logger
;
IOSDeploy
iosDeploy
;
MemoryFileSystem
fileSystem
;
FakeProcessManager
fakeProcessManager
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
();
mockArtifacts
=
MockArtifacts
();
mockCache
=
MockCache
();
fakeProcessManager
=
FakeProcessManager
.
any
();
iosDeploy
=
IOSDeploy
(
artifacts:
mockArtifacts
,
cache:
mockCache
,
logger:
logger
,
platform:
macPlatform
,
processManager:
fakeProcessManager
,
);
});
testUsingContext
(
'is true on module project'
,
()
async
{
fileSystem
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
r''
'
name: example
flutter:
module: {}
'''
);
fileSystem
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
IOSDevice
device
=
IOSDevice
(
'test'
,
artifacts:
mockArtifacts
,
fileSystem:
fileSystem
,
iosDeploy:
iosDeploy
,
logger:
logger
,
platform:
macPlatform
,
name:
'iPhone 1'
,
sdkVersion:
'13.3'
,
cpuArchitecture:
DarwinArch
.
arm64
);
expect
(
device
.
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
fakeProcessManager
,
});
testUsingContext
(
'is true with editable host app'
,
()
async
{
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
fileSystem
.
file
(
'.packages'
).
createSync
();
fileSystem
.
directory
(
'ios'
).
createSync
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
IOSDevice
device
=
IOSDevice
(
'test'
,
artifacts:
mockArtifacts
,
fileSystem:
fileSystem
,
iosDeploy:
iosDeploy
,
logger:
logger
,
platform:
macPlatform
,
name:
'iPhone 1'
,
sdkVersion:
'13.3'
,
cpuArchitecture:
DarwinArch
.
arm64
,
);
expect
(
device
.
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
fakeProcessManager
,
});
testUsingContext
(
'is false with no host app and no module'
,
()
async
{
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
fileSystem
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
IOSDevice
device
=
IOSDevice
(
'test'
,
artifacts:
mockArtifacts
,
fileSystem:
fileSystem
,
iosDeploy:
iosDeploy
,
logger:
logger
,
platform:
macPlatform
,
name:
'iPhone 1'
,
sdkVersion:
'13.3'
,
cpuArchitecture:
DarwinArch
.
arm64
,
);
expect
(
device
.
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
ProcessManager:
()
=>
fakeProcessManager
,
});
});
}
class
AbsoluteBuildableIOSApp
extends
BuildableIOSApp
{
...
...
@@ -918,24 +820,15 @@ class FakeIosDoctorProvider implements DoctorValidatorsProvider {
}
}
class
MockIOSApp
extends
Mock
implements
IOSApp
{}
class
MockApplicationPackage
extends
Mock
implements
ApplicationPackage
{}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockDevicePortForwarder
extends
Mock
implements
DevicePortForwarder
{}
class
MockDirectory
extends
Mock
implements
Directory
{}
class
MockFile
extends
Mock
implements
File
{}
class
MockFileSystem
extends
Mock
implements
FileSystem
{}
class
MockForwardedPort
extends
Mock
implements
ForwardedPort
{}
class
MockIMobileDevice
extends
Mock
implements
IMobileDevice
{}
class
MockIOSDeploy
extends
Mock
implements
IOSDeploy
{}
class
MockIOSWorkflow
extends
Mock
implements
IOSWorkflow
{}
class
MockMDnsObservatoryDiscovery
extends
Mock
implements
MDnsObservatoryDiscovery
{}
class
MockMDnsObservatoryDiscoveryResult
extends
Mock
implements
MDnsObservatoryDiscoveryResult
{}
class
MockPlatform
extends
Mock
implements
Platform
{}
class
MockPortForwarder
extends
Mock
implements
DevicePortForwarder
{}
class
MockStatus
extends
Mock
implements
Status
{}
class
MockUsage
extends
Mock
implements
Usage
{}
class
MockXcdevice
extends
Mock
implements
XCDevice
{}
class
MockXcode
extends
Mock
implements
Xcode
{}
packages/flutter_tools/test/general.shard/ios/ios_device_project_test.dart
0 → 100644
View file @
5b956fd8
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/ios/devices.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:platform/platform.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
// FlutterProject still depends on context.
void
main
(
)
{
FileSystem
fileSystem
;
// This setup is required to inject the context.
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
});
testUsingContext
(
'IOSDevice.isSupportedForProject is true on module project'
,
()
async
{
fileSystem
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
r''
'
name: example
flutter:
module: {}
'''
);
fileSystem
.
file
(
'.packages'
).
writeAsStringSync
(
'
\n
'
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
final
IOSDevice
device
=
setUpIOSDevice
(
fileSystem
);
expect
(
device
.
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'IOSDevice.isSupportedForProject is true with editable host app'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
fileSystem
.
file
(
'.packages'
).
writeAsStringSync
(
'
\n
'
);
fileSystem
.
directory
(
'ios'
).
createSync
();
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
final
IOSDevice
device
=
setUpIOSDevice
(
fileSystem
);
expect
(
device
.
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'IOSDevice.isSupportedForProject is false with no host app and no module'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
fileSystem
.
file
(
'.packages'
).
writeAsStringSync
(
'
\n
'
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
final
IOSDevice
device
=
setUpIOSDevice
(
fileSystem
);
expect
(
device
.
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
}
IOSDevice
setUpIOSDevice
(
FileSystem
fileSystem
)
{
final
MockArtifacts
artifacts
=
MockArtifacts
();
when
(
artifacts
.
getArtifactPath
(
Artifact
.
iosDeploy
,
platform:
anyNamed
(
'platform'
)))
.
thenReturn
(
'ios-deploy'
);
return
IOSDevice
(
'test'
,
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
iosDeploy:
null
,
// not used in this test
platform:
FakePlatform
(
operatingSystem:
'macos'
),
name:
'iPhone 1'
,
sdkVersion:
'13.3'
,
cpuArchitecture:
DarwinArch
.
arm64
,
artifacts:
artifacts
,
);
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
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