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
73506f36
Unverified
Commit
73506f36
authored
Feb 02, 2021
by
Jenn Magder
Committed by
GitHub
Feb 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace MockConfig with TestConfig (#75044)
parent
d59359f1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
75 deletions
+60
-75
config.dart
packages/flutter_tools/lib/src/base/config.dart
+11
-5
persistent_tool_state.dart
packages/flutter_tools/lib/src/persistent_tool_state.dart
+1
-1
analytics_test.dart
...ages/flutter_tools/test/general.shard/analytics_test.dart
+8
-14
android_sdk_test.dart
...er_tools/test/general.shard/android/android_sdk_test.dart
+1
-6
android_studio_validator_test.dart
.../general.shard/android/android_studio_validator_test.dart
+1
-6
features_test.dart
packages/flutter_tools/test/general.shard/features_test.dart
+24
-22
code_signing_test.dart
...utter_tools/test/general.shard/ios/code_signing_test.dart
+11
-12
flutter_tester_test.dart
..._tools/test/general.shard/tester/flutter_tester_test.dart
+2
-8
context.dart
packages/flutter_tools/test/src/context.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/base/config.dart
View file @
73506f36
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
// @dart = 2.8
// @dart = 2.8
import
'package:file/memory.dart'
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'../convert.dart'
;
import
'../convert.dart'
;
...
@@ -38,11 +39,16 @@ class Config {
...
@@ -38,11 +39,16 @@ class Config {
/// Constructs a new [Config] object from a file called [name] in
/// Constructs a new [Config] object from a file called [name] in
/// the given [Directory].
/// the given [Directory].
factory
Config
.
test
(
///
String
name
,
{
/// Defaults to [BufferLogger], [MemoryFileSystem], and [name]=test.
@required
Directory
directory
,
factory
Config
.
test
({
@required
Logger
logger
,
String
name
=
'test'
,
})
=>
Config
.
createForTesting
(
directory
.
childFile
(
'.
${kConfigDir}
_
$name
'
),
logger
);
Directory
directory
,
Logger
logger
,
})
{
directory
??=
MemoryFileSystem
.
test
().
directory
(
'/'
);
return
Config
.
createForTesting
(
directory
.
childFile
(
'.
${kConfigDir}
_
$name
'
),
logger
??
BufferLogger
.
test
());
}
/// Test only access to the Config constructor.
/// Test only access to the Config constructor.
@visibleForTesting
@visibleForTesting
...
...
packages/flutter_tools/lib/src/persistent_tool_state.dart
View file @
73506f36
...
@@ -76,7 +76,7 @@ class _DefaultPersistentToolState implements PersistentToolState {
...
@@ -76,7 +76,7 @@ class _DefaultPersistentToolState implements PersistentToolState {
@required
Directory
directory
,
@required
Directory
directory
,
@required
Logger
logger
,
@required
Logger
logger
,
})
:
_config
=
Config
.
test
(
})
:
_config
=
Config
.
test
(
_kFileName
,
name:
_kFileName
,
directory:
directory
,
directory:
directory
,
logger:
logger
,
logger:
logger
,
);
);
...
...
packages/flutter_tools/test/general.shard/analytics_test.dart
View file @
73506f36
...
@@ -35,12 +35,12 @@ void main() {
...
@@ -35,12 +35,12 @@ void main() {
group
(
'analytics'
,
()
{
group
(
'analytics'
,
()
{
Directory
tempDir
;
Directory
tempDir
;
MockFlutterConfig
mockFlutter
Config
;
Config
test
Config
;
setUp
(()
{
setUp
(()
{
Cache
.
flutterRoot
=
'../..'
;
Cache
.
flutterRoot
=
'../..'
;
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_analytics_test.'
);
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_analytics_test.'
);
mockFlutterConfig
=
MockFlutterConfig
();
testConfig
=
Config
.
test
();
});
});
tearDown
(()
{
tearDown
(()
{
...
@@ -105,8 +105,7 @@ void main() {
...
@@ -105,8 +105,7 @@ void main() {
});
});
testUsingContext
(
'Usage records one feature in experiment setting'
,
()
async
{
testUsingContext
(
'Usage records one feature in experiment setting'
,
()
async
{
when
<
bool
>(
mockFlutterConfig
.
getValue
(
flutterWebFeature
.
configSetting
)
as
bool
)
testConfig
.
setValue
(
flutterWebFeature
.
configSetting
,
true
);
.
thenReturn
(
true
);
final
Usage
usage
=
Usage
(
runningOnBot:
true
);
final
Usage
usage
=
Usage
(
runningOnBot:
true
);
usage
.
sendCommand
(
'test'
);
usage
.
sendCommand
(
'test'
);
...
@@ -115,7 +114,7 @@ void main() {
...
@@ -115,7 +114,7 @@ void main() {
expect
(
globals
.
fs
.
file
(
'test'
).
readAsStringSync
(),
contains
(
'
$featuresKey
: enable-web'
));
expect
(
globals
.
fs
.
file
(
'test'
).
readAsStringSync
(),
contains
(
'
$featuresKey
: enable-web'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FlutterVersion:
()
=>
FlutterVersion
(
clock:
const
SystemClock
()),
FlutterVersion:
()
=>
FlutterVersion
(
clock:
const
SystemClock
()),
Config:
()
=>
mockFlutter
Config
,
Config:
()
=>
test
Config
,
Platform:
()
=>
FakePlatform
(
environment:
<
String
,
String
>{
Platform:
()
=>
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_ANALYTICS_LOG_FILE'
:
'test'
,
'FLUTTER_ANALYTICS_LOG_FILE'
:
'test'
,
}),
}),
...
@@ -124,12 +123,9 @@ void main() {
...
@@ -124,12 +123,9 @@ void main() {
});
});
testUsingContext
(
'Usage records multiple features in experiment setting'
,
()
async
{
testUsingContext
(
'Usage records multiple features in experiment setting'
,
()
async
{
when
<
bool
>(
mockFlutterConfig
.
getValue
(
flutterWebFeature
.
configSetting
)
as
bool
)
testConfig
.
setValue
(
flutterWebFeature
.
configSetting
,
true
);
.
thenReturn
(
true
);
testConfig
.
setValue
(
flutterLinuxDesktopFeature
.
configSetting
,
true
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
flutterLinuxDesktopFeature
.
configSetting
)
as
bool
)
testConfig
.
setValue
(
flutterMacOSDesktopFeature
.
configSetting
,
true
);
.
thenReturn
(
true
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
flutterMacOSDesktopFeature
.
configSetting
)
as
bool
)
.
thenReturn
(
true
);
final
Usage
usage
=
Usage
(
runningOnBot:
true
);
final
Usage
usage
=
Usage
(
runningOnBot:
true
);
usage
.
sendCommand
(
'test'
);
usage
.
sendCommand
(
'test'
);
...
@@ -141,7 +137,7 @@ void main() {
...
@@ -141,7 +137,7 @@ void main() {
);
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FlutterVersion:
()
=>
FlutterVersion
(
clock:
const
SystemClock
()),
FlutterVersion:
()
=>
FlutterVersion
(
clock:
const
SystemClock
()),
Config:
()
=>
mockFlutter
Config
,
Config:
()
=>
test
Config
,
Platform:
()
=>
FakePlatform
(
environment:
<
String
,
String
>{
Platform:
()
=>
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_ANALYTICS_LOG_FILE'
:
'test'
,
'FLUTTER_ANALYTICS_LOG_FILE'
:
'test'
,
}),
}),
...
@@ -370,8 +366,6 @@ class FakeFlutterCommand extends FlutterCommand {
...
@@ -370,8 +366,6 @@ class FakeFlutterCommand extends FlutterCommand {
class
MockDoctor
extends
Mock
implements
Doctor
{}
class
MockDoctor
extends
Mock
implements
Doctor
{}
class
MockFlutterConfig
extends
Mock
implements
Config
{}
class
FakeClock
extends
Fake
implements
SystemClock
{
class
FakeClock
extends
Fake
implements
SystemClock
{
List
<
int
>
times
=
<
int
>[];
List
<
int
>
times
=
<
int
>[];
...
...
packages/flutter_tools/test/general.shard/android/android_sdk_test.dart
View file @
73506f36
...
@@ -9,7 +9,6 @@ import 'package:flutter_tools/src/android/android_sdk.dart';
...
@@ -9,7 +9,6 @@ import 'package:flutter_tools/src/android/android_sdk.dart';
import
'package:flutter_tools/src/base/config.dart'
;
import
'package:flutter_tools/src/base/config.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/io.dart'
show
ProcessResult
;
import
'package:flutter_tools/src/base/io.dart'
show
ProcessResult
;
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:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:mockito/mockito.dart'
;
...
@@ -29,11 +28,7 @@ void main() {
...
@@ -29,11 +28,7 @@ void main() {
setUp
(()
{
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
fileSystem
=
MemoryFileSystem
.
test
();
processManager
=
MockProcessManager
();
processManager
=
MockProcessManager
();
config
=
Config
.
test
(
config
=
Config
.
test
();
'test'
,
directory:
fileSystem
.
currentDirectory
,
logger:
BufferLogger
.
test
(),
);
});
});
group
(
'android_sdk AndroidSdk'
,
()
{
group
(
'android_sdk AndroidSdk'
,
()
{
...
...
packages/flutter_tools/test/general.shard/android/android_studio_validator_test.dart
View file @
73506f36
...
@@ -9,7 +9,6 @@ import 'package:flutter_tools/src/android/android_studio_validator.dart';
...
@@ -9,7 +9,6 @@ import 'package:flutter_tools/src/android/android_studio_validator.dart';
import
'package:flutter_tools/src/base/config.dart'
;
import
'package:flutter_tools/src/base/config.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/io.dart'
;
import
'package:flutter_tools/src/base/io.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/base/user_messages.dart'
;
import
'package:flutter_tools/src/base/user_messages.dart'
;
import
'package:flutter_tools/src/doctor.dart'
;
import
'package:flutter_tools/src/doctor.dart'
;
...
@@ -36,11 +35,7 @@ void main() {
...
@@ -36,11 +35,7 @@ void main() {
});
});
testWithoutContext
(
'NoAndroidStudioValidator shows Android Studio as "not available" when not available.'
,
()
async
{
testWithoutContext
(
'NoAndroidStudioValidator shows Android Studio as "not available" when not available.'
,
()
async
{
final
Config
config
=
Config
.
test
(
final
Config
config
=
Config
.
test
();
'test'
,
directory:
fileSystem
.
currentDirectory
,
logger:
BufferLogger
.
test
(),
);
final
NoAndroidStudioValidator
validator
=
NoAndroidStudioValidator
(
final
NoAndroidStudioValidator
validator
=
NoAndroidStudioValidator
(
config:
config
,
config:
config
,
platform:
linuxPlatform
,
platform:
linuxPlatform
,
...
...
packages/flutter_tools/test/general.shard/features_test.dart
View file @
73506f36
...
@@ -15,20 +15,23 @@ import '../src/common.dart';
...
@@ -15,20 +15,23 @@ import '../src/common.dart';
void
main
(
)
{
void
main
(
)
{
group
(
'Features'
,
()
{
group
(
'Features'
,
()
{
MockFlutterVerion
mockFlutterVerion
;
MockFlutterVerion
mockFlutterVerion
;
MockFlutterConfig
mockFlutter
Config
;
Config
test
Config
;
MockPlatform
mockPlatform
;
MockPlatform
mockPlatform
;
FlutterFeatureFlags
featureFlags
;
FlutterFeatureFlags
featureFlags
;
setUp
(()
{
setUp
(()
{
mockFlutterVerion
=
MockFlutterVerion
();
mockFlutterVerion
=
MockFlutterVerion
();
mockFlutterConfig
=
MockFlutterConfig
();
testConfig
=
Config
.
test
();
mockPlatform
=
MockPlatform
();
mockPlatform
=
MockPlatform
();
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{});
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{});
when
<
bool
>(
mockFlutterConfig
.
getValue
(
any
)
as
bool
).
thenReturn
(
false
);
for
(
final
Feature
feature
in
allFeatures
)
{
testConfig
.
setValue
(
feature
.
configSetting
,
false
);
}
featureFlags
=
FlutterFeatureFlags
(
featureFlags
=
FlutterFeatureFlags
(
flutterVersion:
mockFlutterVerion
,
flutterVersion:
mockFlutterVerion
,
config:
mockFlutter
Config
,
config:
test
Config
,
platform:
mockPlatform
,
platform:
mockPlatform
,
);
);
});
});
...
@@ -129,7 +132,7 @@ void main() {
...
@@ -129,7 +132,7 @@ void main() {
testWithoutContext
(
'flutter web enabled with config on master'
,
()
{
testWithoutContext
(
'flutter web enabled with config on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-web'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-web'
,
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
});
});
...
@@ -149,7 +152,7 @@ void main() {
...
@@ -149,7 +152,7 @@ void main() {
testWithoutContext
(
'flutter web enabled with config on dev'
,
()
{
testWithoutContext
(
'flutter web enabled with config on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-web'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-web'
,
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
});
});
...
@@ -169,7 +172,7 @@ void main() {
...
@@ -169,7 +172,7 @@ void main() {
testWithoutContext
(
'flutter web enabled with config on beta'
,
()
{
testWithoutContext
(
'flutter web enabled with config on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-web'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-web'
,
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
});
});
...
@@ -183,14 +186,14 @@ void main() {
...
@@ -183,14 +186,14 @@ void main() {
testWithoutContext
(
'flutter web on by default on stable'
,
()
{
testWithoutContext
(
'flutter web on by default on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
any
)
as
bool
).
thenReturn
(
null
);
testConfig
.
removeValue
(
'enable-web'
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
});
});
testWithoutContext
(
'flutter web enabled with config on stable'
,
()
{
testWithoutContext
(
'flutter web enabled with config on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-web'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-web'
,
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
});
});
...
@@ -212,7 +215,7 @@ void main() {
...
@@ -212,7 +215,7 @@ void main() {
testWithoutContext
(
'flutter macos desktop enabled with config on master'
,
()
{
testWithoutContext
(
'flutter macos desktop enabled with config on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-macos-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-macos-desktop'
,
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
});
});
...
@@ -232,7 +235,7 @@ void main() {
...
@@ -232,7 +235,7 @@ void main() {
testWithoutContext
(
'flutter macos desktop enabled with config on dev'
,
()
{
testWithoutContext
(
'flutter macos desktop enabled with config on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-macos-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-macos-desktop'
,
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
});
});
...
@@ -252,7 +255,7 @@ void main() {
...
@@ -252,7 +255,7 @@ void main() {
testWithoutContext
(
'flutter macos desktop enabled with config on beta'
,
()
{
testWithoutContext
(
'flutter macos desktop enabled with config on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-macos-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-macos-desktop'
,
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
});
});
...
@@ -272,7 +275,7 @@ void main() {
...
@@ -272,7 +275,7 @@ void main() {
testWithoutContext
(
'flutter macos desktop enabled with config on stable'
,
()
{
testWithoutContext
(
'flutter macos desktop enabled with config on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-macos-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-macos-desktop'
,
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
});
});
...
@@ -293,7 +296,7 @@ void main() {
...
@@ -293,7 +296,7 @@ void main() {
testWithoutContext
(
'flutter linux desktop enabled with config on master'
,
()
{
testWithoutContext
(
'flutter linux desktop enabled with config on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-linux-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-linux-desktop'
,
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
});
});
...
@@ -313,7 +316,7 @@ void main() {
...
@@ -313,7 +316,7 @@ void main() {
testWithoutContext
(
'flutter linux desktop enabled with config on dev'
,
()
{
testWithoutContext
(
'flutter linux desktop enabled with config on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-linux-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-linux-desktop'
,
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
});
});
...
@@ -333,7 +336,7 @@ void main() {
...
@@ -333,7 +336,7 @@ void main() {
testWithoutContext
(
'flutter linux desktop enabled with config on beta'
,
()
{
testWithoutContext
(
'flutter linux desktop enabled with config on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-linux-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-linux-desktop'
,
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
});
});
...
@@ -353,7 +356,7 @@ void main() {
...
@@ -353,7 +356,7 @@ void main() {
testWithoutContext
(
'flutter linux desktop enabled with config on stable'
,
()
{
testWithoutContext
(
'flutter linux desktop enabled with config on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-linux-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-linux-desktop'
,
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
});
});
...
@@ -374,7 +377,7 @@ void main() {
...
@@ -374,7 +377,7 @@ void main() {
testWithoutContext
(
'flutter windows desktop enabled with config on master'
,
()
{
testWithoutContext
(
'flutter windows desktop enabled with config on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-windows-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-windows-desktop'
,
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
});
});
...
@@ -394,7 +397,7 @@ void main() {
...
@@ -394,7 +397,7 @@ void main() {
testWithoutContext
(
'flutter windows desktop enabled with config on dev'
,
()
{
testWithoutContext
(
'flutter windows desktop enabled with config on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-windows-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-windows-desktop'
,
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
});
});
...
@@ -414,7 +417,7 @@ void main() {
...
@@ -414,7 +417,7 @@ void main() {
testWithoutContext
(
'flutter windows desktop enabled with config on beta'
,
()
{
testWithoutContext
(
'flutter windows desktop enabled with config on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-windows-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-windows-desktop'
,
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
});
});
...
@@ -434,7 +437,7 @@ void main() {
...
@@ -434,7 +437,7 @@ void main() {
testWithoutContext
(
'flutter windows desktop enabled with config on stable'
,
()
{
testWithoutContext
(
'flutter windows desktop enabled with config on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-windows-desktop'
)
as
bool
).
thenReturn
(
true
);
testConfig
.
setValue
(
'enable-windows-desktop'
,
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
});
});
...
@@ -449,7 +452,6 @@ void main() {
...
@@ -449,7 +452,6 @@ void main() {
}
}
class
MockFlutterVerion
extends
Mock
implements
FlutterVersion
{}
class
MockFlutterVerion
extends
Mock
implements
FlutterVersion
{}
class
MockFlutterConfig
extends
Mock
implements
Config
{}
class
MockPlatform
extends
Mock
implements
Platform
{}
class
MockPlatform
extends
Mock
implements
Platform
{}
T
nonconst
<
T
>(
T
item
)
=>
item
;
T
nonconst
<
T
>(
T
item
)
=>
item
;
packages/flutter_tools/test/general.shard/ios/code_signing_test.dart
View file @
73506f36
...
@@ -25,7 +25,7 @@ import '../../src/mocks.dart';
...
@@ -25,7 +25,7 @@ import '../../src/mocks.dart';
void
main
(
)
{
void
main
(
)
{
group
(
'Auto signing'
,
()
{
group
(
'Auto signing'
,
()
{
ProcessManager
mockProcessManager
;
ProcessManager
mockProcessManager
;
Config
mock
Config
;
Config
test
Config
;
IosProject
mockIosProject
;
IosProject
mockIosProject
;
BuildableIOSApp
app
;
BuildableIOSApp
app
;
AnsiTerminal
testTerminal
;
AnsiTerminal
testTerminal
;
...
@@ -36,7 +36,7 @@ void main() {
...
@@ -36,7 +36,7 @@ void main() {
mockProcessManager
=
MockProcessManager
();
mockProcessManager
=
MockProcessManager
();
// Assume all binaries exist and are executable
// Assume all binaries exist and are executable
when
(
mockProcessManager
.
canRun
(
any
)).
thenReturn
(
true
);
when
(
mockProcessManager
.
canRun
(
any
)).
thenReturn
(
true
);
mockConfig
=
MockConfig
();
testConfig
=
Config
.
test
();
mockIosProject
=
MockIosProject
();
mockIosProject
=
MockIosProject
();
when
(
mockIosProject
.
buildSettingsForBuildInfo
(
any
)).
thenAnswer
((
_
)
{
when
(
mockIosProject
.
buildSettingsForBuildInfo
(
any
)).
thenAnswer
((
_
)
{
return
Future
<
Map
<
String
,
String
>>.
value
(<
String
,
String
>{
return
Future
<
Map
<
String
,
String
>>.
value
(<
String
,
String
>{
...
@@ -343,10 +343,10 @@ void main() {
...
@@ -343,10 +343,10 @@ void main() {
verify
(
mockOpenSslStdIn
.
write
(
'This is a mock certificate'
));
verify
(
mockOpenSslStdIn
.
write
(
'This is a mock certificate'
));
expect
(
signingConfigs
,
<
String
,
String
>{
'DEVELOPMENT_TEAM'
:
'4444DDDD44'
});
expect
(
signingConfigs
,
<
String
,
String
>{
'DEVELOPMENT_TEAM'
:
'4444DDDD44'
});
verify
(
globals
.
config
.
setValue
(
'ios-signing-cert'
,
'iPhone Developer: Profile 3 (3333CCCC33)'
)
);
expect
(
testConfig
.
getValue
(
'ios-signing-cert'
),
'iPhone Developer: Profile 3 (3333CCCC33)'
);
},
},
overrides:
<
Type
,
Generator
>{
overrides:
<
Type
,
Generator
>{
Config:
()
=>
mock
Config
,
Config:
()
=>
test
Config
,
AnsiTerminal:
()
=>
testTerminal
,
AnsiTerminal:
()
=>
testTerminal
,
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
});
});
...
@@ -426,7 +426,7 @@ void main() {
...
@@ -426,7 +426,7 @@ void main() {
expect
(
signingConfigs
,
<
String
,
String
>{
'DEVELOPMENT_TEAM'
:
'5555EEEE55'
});
expect
(
signingConfigs
,
<
String
,
String
>{
'DEVELOPMENT_TEAM'
:
'5555EEEE55'
});
},
},
overrides:
<
Type
,
Generator
>{
overrides:
<
Type
,
Generator
>{
Config:
()
=>
mock
Config
,
Config:
()
=>
test
Config
,
AnsiTerminal:
()
=>
testTerminal
,
AnsiTerminal:
()
=>
testTerminal
,
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
});
});
...
@@ -486,7 +486,7 @@ void main() {
...
@@ -486,7 +486,7 @@ void main() {
));
));
when
(
mockOpenSslProcess
.
stderr
).
thenAnswer
((
Invocation
invocation
)
=>
mockOpenSslStdErr
);
when
(
mockOpenSslProcess
.
stderr
).
thenAnswer
((
Invocation
invocation
)
=>
mockOpenSslStdErr
);
when
(
mockOpenSslProcess
.
exitCode
).
thenAnswer
((
_
)
=>
Future
<
int
>.
value
(
0
));
when
(
mockOpenSslProcess
.
exitCode
).
thenAnswer
((
_
)
=>
Future
<
int
>.
value
(
0
));
when
<
String
>(
mockConfig
.
getValue
(
'ios-signing-cert'
)
as
String
).
thenReturn
(
'iPhone Developer: Profile 3 (3333CCCC33)'
);
testConfig
.
setValue
(
'ios-signing-cert'
,
'iPhone Developer: Profile 3 (3333CCCC33)'
);
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
iosApp:
app
,
iosApp:
app
,
...
@@ -508,7 +508,7 @@ void main() {
...
@@ -508,7 +508,7 @@ void main() {
expect
(
signingConfigs
,
<
String
,
String
>{
'DEVELOPMENT_TEAM'
:
'4444DDDD44'
});
expect
(
signingConfigs
,
<
String
,
String
>{
'DEVELOPMENT_TEAM'
:
'4444DDDD44'
});
},
},
overrides:
<
Type
,
Generator
>{
overrides:
<
Type
,
Generator
>{
Config:
()
=>
mock
Config
,
Config:
()
=>
test
Config
,
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
});
});
...
@@ -570,7 +570,7 @@ void main() {
...
@@ -570,7 +570,7 @@ void main() {
));
));
when
(
mockOpenSslProcess
.
stderr
).
thenAnswer
((
Invocation
invocation
)
=>
mockOpenSslStdErr
);
when
(
mockOpenSslProcess
.
stderr
).
thenAnswer
((
Invocation
invocation
)
=>
mockOpenSslStdErr
);
when
(
mockOpenSslProcess
.
exitCode
).
thenAnswer
((
_
)
=>
Future
<
int
>.
value
(
0
));
when
(
mockOpenSslProcess
.
exitCode
).
thenAnswer
((
_
)
=>
Future
<
int
>.
value
(
0
));
when
<
String
>(
mockConfig
.
getValue
(
'ios-signing-cert'
)
as
String
).
thenReturn
(
'iPhone Developer: Invalid Profile'
);
testConfig
.
setValue
(
'ios-signing-cert'
,
'iPhone Developer: Invalid Profile'
);
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
iosApp:
app
,
iosApp:
app
,
...
@@ -588,10 +588,10 @@ void main() {
...
@@ -588,10 +588,10 @@ void main() {
contains
(
'Certificate choice "iPhone Developer: Profile 3 (3333CCCC33)"'
),
contains
(
'Certificate choice "iPhone Developer: Profile 3 (3333CCCC33)"'
),
);
);
expect
(
signingConfigs
,
<
String
,
String
>{
'DEVELOPMENT_TEAM'
:
'4444DDDD44'
});
expect
(
signingConfigs
,
<
String
,
String
>{
'DEVELOPMENT_TEAM'
:
'4444DDDD44'
});
verify
(
globals
.
config
.
setValue
(
'ios-signing-cert'
,
'iPhone Developer: Profile 3 (3333CCCC33)'
)
);
expect
(
testConfig
.
getValue
(
'ios-signing-cert'
),
'iPhone Developer: Profile 3 (3333CCCC33)'
);
},
},
overrides:
<
Type
,
Generator
>{
overrides:
<
Type
,
Generator
>{
Config:
()
=>
mock
Config
,
Config:
()
=>
test
Config
,
AnsiTerminal:
()
=>
testTerminal
,
AnsiTerminal:
()
=>
testTerminal
,
});
});
...
@@ -667,7 +667,7 @@ void main() {
...
@@ -667,7 +667,7 @@ void main() {
expect
(
signingConfigs
,
isNull
);
expect
(
signingConfigs
,
isNull
);
},
},
overrides:
<
Type
,
Generator
>{
overrides:
<
Type
,
Generator
>{
Config:
()
=>
mock
Config
,
Config:
()
=>
test
Config
,
AnsiTerminal:
()
=>
testTerminal
,
AnsiTerminal:
()
=>
testTerminal
,
});
});
});
});
...
@@ -691,7 +691,6 @@ class MockProcessManager extends Mock implements ProcessManager {}
...
@@ -691,7 +691,6 @@ class MockProcessManager extends Mock implements ProcessManager {}
class
MockProcess
extends
Mock
implements
Process
{}
class
MockProcess
extends
Mock
implements
Process
{}
class
MockStream
extends
Mock
implements
Stream
<
List
<
int
>>
{}
class
MockStream
extends
Mock
implements
Stream
<
List
<
int
>>
{}
class
MockStdIn
extends
Mock
implements
IOSink
{}
class
MockStdIn
extends
Mock
implements
IOSink
{}
class
MockConfig
extends
Mock
implements
Config
{}
Stream
<
String
>
mockTerminalStdInStream
;
Stream
<
String
>
mockTerminalStdInStream
;
...
...
packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart
View file @
73506f36
...
@@ -174,18 +174,12 @@ Hello!
...
@@ -174,18 +174,12 @@ Hello!
}
}
FlutterTesterDevices
setUpFlutterTesterDevices
(
)
{
FlutterTesterDevices
setUpFlutterTesterDevices
(
)
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
Logger
logger
=
BufferLogger
.
test
();
return
FlutterTesterDevices
(
return
FlutterTesterDevices
(
logger:
logger
,
logger:
BufferLogger
.
test
()
,
artifacts:
Artifacts
.
test
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
MemoryFileSystem
.
test
(),
fileSystem:
MemoryFileSystem
.
test
(),
config:
Config
.
test
(
config:
Config
.
test
(),
'test'
,
directory:
fileSystem
.
currentDirectory
,
logger:
logger
,
),
flutterVersion:
MockFlutterVersion
(),
flutterVersion:
MockFlutterVersion
(),
);
);
}
}
...
...
packages/flutter_tools/test/src/context.dart
View file @
73506f36
...
@@ -87,7 +87,7 @@ void testUsingContext(
...
@@ -87,7 +87,7 @@ void testUsingContext(
'flutter_config_dir_test.'
,
'flutter_config_dir_test.'
,
);
);
return
Config
.
test
(
return
Config
.
test
(
Config
.
kFlutterSettings
,
name:
Config
.
kFlutterSettings
,
directory:
configDir
,
directory:
configDir
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
);
);
...
...
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