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
9618788e
Unverified
Commit
9618788e
authored
Nov 16, 2020
by
Jonah Williams
Committed by
GitHub
Nov 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove globals from features (#70515)
parent
148ae7bf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
138 additions
and
123 deletions
+138
-123
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+5
-1
features.dart
packages/flutter_tools/lib/src/features.dart
+17
-5
features_test.dart
packages/flutter_tools/test/general.shard/features_test.dart
+116
-117
No files found.
packages/flutter_tools/lib/src/context_runner.dart
View file @
9618788e
...
...
@@ -185,7 +185,11 @@ Future<T> runInContext<T>(
fileSystem:
globals
.
fs
,
androidWorkflow:
androidWorkflow
,
),
FeatureFlags:
()
=>
const
FlutterFeatureFlags
(),
FeatureFlags:
()
=>
FlutterFeatureFlags
(
flutterVersion:
globals
.
flutterVersion
,
config:
globals
.
config
,
platform:
globals
.
platform
,
),
FlutterVersion:
()
=>
FlutterVersion
(
clock:
const
SystemClock
()),
FuchsiaArtifacts:
()
=>
FuchsiaArtifacts
.
find
(),
FuchsiaDeviceTools:
()
=>
FuchsiaDeviceTools
(),
...
...
packages/flutter_tools/lib/src/features.dart
View file @
9618788e
...
...
@@ -4,8 +4,10 @@
import
'package:meta/meta.dart'
;
import
'base/config.dart'
;
import
'base/context.dart'
;
import
'globals.dart'
as
globals
;
import
'base/platform.dart'
;
import
'version.dart'
;
/// The current [FeatureFlags] implementation.
///
...
...
@@ -54,7 +56,17 @@ abstract class FeatureFlags {
}
class
FlutterFeatureFlags
implements
FeatureFlags
{
const
FlutterFeatureFlags
();
FlutterFeatureFlags
({
@required
FlutterVersion
flutterVersion
,
@required
Config
config
,
@required
Platform
platform
,
})
:
_flutterVersion
=
flutterVersion
,
_config
=
config
,
_platform
=
platform
;
final
FlutterVersion
_flutterVersion
;
final
Config
_config
;
final
Platform
_platform
;
@override
bool
get
isLinuxEnabled
=>
isEnabled
(
flutterLinuxDesktopFeature
);
...
...
@@ -82,20 +94,20 @@ class FlutterFeatureFlags implements FeatureFlags {
@override
bool
isEnabled
(
Feature
feature
)
{
final
String
currentChannel
=
globals
.
flutterVersion
.
channel
;
final
String
currentChannel
=
_
flutterVersion
.
channel
;
final
FeatureChannelSetting
featureSetting
=
feature
.
getSettingForChannel
(
currentChannel
);
if
(!
featureSetting
.
available
)
{
return
false
;
}
bool
isEnabled
=
featureSetting
.
enabledByDefault
;
if
(
feature
.
configSetting
!=
null
)
{
final
bool
configOverride
=
globals
.
config
.
getValue
(
feature
.
configSetting
)
as
bool
;
final
bool
configOverride
=
_
config
.
getValue
(
feature
.
configSetting
)
as
bool
;
if
(
configOverride
!=
null
)
{
isEnabled
=
configOverride
;
}
}
if
(
feature
.
environmentOverride
!=
null
)
{
if
(
globals
.
platform
.
environment
[
feature
.
environmentOverride
]?.
toLowerCase
()
==
'true'
)
{
if
(
_
platform
.
environment
[
feature
.
environmentOverride
]?.
toLowerCase
()
==
'true'
)
{
isEnabled
=
true
;
}
}
...
...
packages/flutter_tools/test/general.shard/features_test.dart
View file @
9618788e
...
...
@@ -9,37 +9,36 @@ import 'package:flutter_tools/src/version.dart';
import
'package:mockito/mockito.dart'
;
import
'../src/common.dart'
;
import
'../src/testbed.dart'
;
void
main
(
)
{
group
(
'Features'
,
()
{
MockFlutterVerion
mockFlutterVerion
;
MockFlutterConfig
mockFlutterConfig
;
MockPlatform
mockPlatform
;
Testbed
testbed
;
FlutterFeatureFlags
featureFlags
;
setUp
(()
{
mockFlutterVerion
=
MockFlutterVerion
();
mockFlutterConfig
=
MockFlutterConfig
();
mockPlatform
=
MockPlatform
();
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{});
when
<
bool
>(
mockFlutterConfig
.
getValue
(
any
)
as
bool
).
thenReturn
(
false
);
when
(
mockPlatform
.
environment
).
thenReturn
(
const
<
String
,
String
>{});
testbed
=
Testbed
(
overrides:
<
Type
,
Generator
>{
FlutterVersion:
()
=>
mockFlutterVerion
,
FeatureFlags:
()
=>
const
FlutterFeatureFlags
(),
Config:
()
=>
mockFlutterConfig
,
Platform:
()
=>
mockPlatform
,
});
featureFlags
=
FlutterFeatureFlags
(
flutterVersion:
mockFlutterVerion
,
config:
mockFlutterConfig
,
platform:
mockPlatform
,
);
});
test
(
'setting has safe defaults'
,
()
{
test
WithoutContext
(
'setting has safe defaults'
,
()
{
const
FeatureChannelSetting
featureSetting
=
FeatureChannelSetting
();
expect
(
featureSetting
.
available
,
false
);
expect
(
featureSetting
.
enabledByDefault
,
false
);
});
test
(
'has safe defaults'
,
()
{
test
WithoutContext
(
'has safe defaults'
,
()
{
const
Feature
feature
=
Feature
(
name:
'example'
);
expect
(
feature
.
name
,
'example'
);
...
...
@@ -47,7 +46,7 @@ void main() {
expect
(
feature
.
configSetting
,
null
);
});
test
(
'retrieves the correct setting for each branch'
,
()
{
test
WithoutContext
(
'retrieves the correct setting for each branch'
,
()
{
final
FeatureChannelSetting
masterSetting
=
FeatureChannelSetting
(
available:
nonconst
(
true
));
final
FeatureChannelSetting
devSetting
=
FeatureChannelSetting
(
available:
nonconst
(
true
));
final
FeatureChannelSetting
betaSetting
=
FeatureChannelSetting
(
available:
nonconst
(
true
));
...
...
@@ -67,7 +66,7 @@ void main() {
expect
(
feature
.
getSettingForChannel
(
'unknown'
),
masterSetting
);
});
test
(
'env variables are only enabled with "true" string'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'env variables are only enabled with "true" string'
,
()
{
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_WEB'
:
'hello'
});
expect
(
featureFlags
.
isWebEnabled
,
false
);
...
...
@@ -75,34 +74,34 @@ void main() {
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_WEB'
:
'true'
});
expect
(
featureFlags
.
isWebEnabled
,
true
);
})
)
;
});
test
(
'flutter web help string'
,
()
{
test
WithoutContext
(
'flutter web help string'
,
()
{
expect
(
flutterWebFeature
.
generateHelpMessage
(),
'Enable or disable Flutter for web. '
'This setting will take effect on the master, dev, and beta channels.'
);
});
test
(
'flutter macOS desktop help string'
,
()
{
test
WithoutContext
(
'flutter macOS desktop help string'
,
()
{
expect
(
flutterMacOSDesktopFeature
.
generateHelpMessage
(),
'Enable or disable Flutter for desktop on macOS. '
'This setting will take effect on the master and dev channels.'
);
});
test
(
'flutter Linux desktop help string'
,
()
{
test
WithoutContext
(
'flutter Linux desktop help string'
,
()
{
expect
(
flutterLinuxDesktopFeature
.
generateHelpMessage
(),
'Enable or disable Flutter for desktop on Linux. '
'This setting will take effect on the master and dev channels.'
);
});
test
(
'flutter Windows desktop help string'
,
()
{
test
WithoutContext
(
'flutter Windows desktop help string'
,
()
{
expect
(
flutterWindowsDesktopFeature
.
generateHelpMessage
(),
'Enable or disable Flutter for desktop on Windows. '
'This setting will take effect on the master and dev channels.'
);
});
test
(
'help string on multiple channels'
,
()
{
const
Feature
testFeature
=
Feature
(
test
WithoutContext
(
'help string on multiple channels'
,
()
{
const
Feature
test
WithoutContext
Feature
=
Feature
(
name:
'example'
,
master:
FeatureChannelSetting
(
available:
true
),
dev:
FeatureChannelSetting
(
available:
true
),
...
...
@@ -111,335 +110,335 @@ void main() {
configSetting:
'foo'
,
);
expect
(
testFeature
.
generateHelpMessage
(),
'Enable or disable example. '
expect
(
test
WithoutContext
Feature
.
generateHelpMessage
(),
'Enable or disable example. '
'This setting will take effect on the master, dev, beta, and stable channels.'
);
});
/// Flutter Web
test
(
'flutter web off by default on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web off by default on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
expect
(
featureFlags
.
isWebEnabled
,
false
);
})
)
;
});
test
(
'flutter web enabled with config on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web enabled with config on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-web'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
})
)
;
});
test
(
'flutter web enabled with environment variable on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web enabled with environment variable on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_WEB'
:
'true'
});
expect
(
featureFlags
.
isWebEnabled
,
true
);
})
)
;
});
test
(
'flutter web off by default on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web off by default on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
expect
(
featureFlags
.
isWebEnabled
,
false
);
})
)
;
});
test
(
'flutter web enabled with config on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web enabled with config on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-web'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
})
)
;
});
test
(
'flutter web enabled with environment variable on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web enabled with environment variable on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_WEB'
:
'true'
});
expect
(
featureFlags
.
isWebEnabled
,
true
);
})
)
;
});
test
(
'flutter web off by default on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web off by default on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
expect
(
featureFlags
.
isWebEnabled
,
false
);
})
)
;
});
test
(
'flutter web enabled with config on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web enabled with config on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-web'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isWebEnabled
,
true
);
})
)
;
});
test
(
'flutter web not enabled with environment variable on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web not enabled with environment variable on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_WEB'
:
'true'
});
expect
(
featureFlags
.
isWebEnabled
,
true
);
})
)
;
});
test
(
'flutter web off by default on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web off by default on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
expect
(
featureFlags
.
isWebEnabled
,
false
);
})
)
;
});
test
(
'flutter web not enabled with config on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web not enabled with config on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-web'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isWebEnabled
,
false
);
})
)
;
});
test
(
'flutter web not enabled with environment variable on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter web not enabled with environment variable on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_WEB'
:
'enabled'
});
expect
(
featureFlags
.
isWebEnabled
,
false
);
})
)
;
});
/// Flutter macOS desktop.
test
(
'flutter macos desktop off by default on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter macos desktop off by default on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
expect
(
featureFlags
.
isMacOSEnabled
,
false
);
})
)
;
});
test
(
'flutter macos desktop enabled with config on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter macos desktop enabled with config on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-macos-desktop'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
})
)
;
});
test
(
'flutter macos desktop enabled with environment variable on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter macos desktop enabled with environment variable on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_MACOS'
:
'true'
});
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
})
)
;
});
test
(
'flutter macos desktop off by default on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter macos desktop off by default on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
expect
(
featureFlags
.
isMacOSEnabled
,
false
);
})
)
;
});
test
(
'flutter macos desktop enabled with config on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter macos desktop enabled with config on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-macos-desktop'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
})
)
;
});
test
(
'flutter macos desktop enabled with environment variable on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter macos desktop enabled with environment variable on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_MACOS'
:
'true'
});
expect
(
featureFlags
.
isMacOSEnabled
,
true
);
})
)
;
});
test
(
'flutter macos desktop off by default on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter macos desktop off by default on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
expect
(
featureFlags
.
isMacOSEnabled
,
false
);
})
)
;
});
test
(
'fflutter macos desktop not enabled with config on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'fflutter macos desktop not enabled with config on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'flutter-desktop-macos'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
false
);
})
)
;
});
test
(
'flutter macos desktop not enabled with environment variable on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter macos desktop not enabled with environment variable on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_MACOS'
:
'true'
});
expect
(
featureFlags
.
isMacOSEnabled
,
false
);
})
)
;
});
test
(
'flutter macos desktop off by default on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter macos desktop off by default on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
expect
(
featureFlags
.
isMacOSEnabled
,
false
);
})
)
;
});
test
(
'flutter macos desktop not enabled with config on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter macos desktop not enabled with config on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'flutter-desktop-macos'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isMacOSEnabled
,
false
);
})
)
;
});
test
(
'flutter macos desktop not enabled with environment variable on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter macos desktop not enabled with environment variable on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_MACOS'
:
'true'
});
expect
(
featureFlags
.
isMacOSEnabled
,
false
);
})
)
;
});
/// Flutter Linux Desktop
test
(
'flutter linux desktop off by default on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter linux desktop off by default on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
expect
(
featureFlags
.
isLinuxEnabled
,
false
);
})
)
;
});
test
(
'flutter linux desktop enabled with config on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter linux desktop enabled with config on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-linux-desktop'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
})
)
;
});
test
(
'flutter linux desktop enabled with environment variable on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter linux desktop enabled with environment variable on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_LINUX'
:
'true'
});
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
})
)
;
});
test
(
'flutter linux desktop off by default on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter linux desktop off by default on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
expect
(
featureFlags
.
isLinuxEnabled
,
false
);
})
)
;
});
test
(
'flutter linux desktop enabled with config on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter linux desktop enabled with config on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-linux-desktop'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
})
)
;
});
test
(
'flutter linux desktop enabled with environment variable on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter linux desktop enabled with environment variable on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_LINUX'
:
'true'
});
expect
(
featureFlags
.
isLinuxEnabled
,
true
);
})
)
;
});
test
(
'flutter linux desktop off by default on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter linux desktop off by default on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
expect
(
featureFlags
.
isLinuxEnabled
,
false
);
})
)
;
});
test
(
'fflutter linux desktop not enabled with config on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'fflutter linux desktop not enabled with config on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-linux-desktop'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
false
);
})
)
;
});
test
(
'flutter linux desktop not enabled with environment variable on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter linux desktop not enabled with environment variable on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_LINUX'
:
'true'
});
expect
(
featureFlags
.
isLinuxEnabled
,
false
);
})
)
;
});
test
(
'flutter linux desktop off by default on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter linux desktop off by default on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
expect
(
featureFlags
.
isLinuxEnabled
,
false
);
})
)
;
});
test
(
'flutter linux desktop not enabled with config on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter linux desktop not enabled with config on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-linux-desktop'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isLinuxEnabled
,
false
);
})
)
;
});
test
(
'flutter linux desktop not enabled with environment variable on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter linux desktop not enabled with environment variable on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_LINUX'
:
'true'
});
expect
(
featureFlags
.
isLinuxEnabled
,
false
);
})
)
;
});
/// Flutter Windows desktop.
test
(
'flutter windows desktop off by default on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter windows desktop off by default on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
expect
(
featureFlags
.
isWindowsEnabled
,
false
);
})
)
;
});
test
(
'flutter windows desktop enabled with config on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter windows desktop enabled with config on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-windows-desktop'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
})
)
;
});
test
(
'flutter windows desktop enabled with environment variable on master'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter windows desktop enabled with environment variable on master'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'master'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_WINDOWS'
:
'true'
});
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
})
)
;
});
test
(
'flutter windows desktop off by default on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter windows desktop off by default on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
expect
(
featureFlags
.
isWindowsEnabled
,
false
);
})
)
;
});
test
(
'flutter windows desktop enabled with config on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter windows desktop enabled with config on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-windows-desktop'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
})
)
;
});
test
(
'flutter windows desktop not enabled with environment variable on dev'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter windows desktop not enabled with environment variable on dev'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'dev'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_WINDOWS'
:
'true'
});
expect
(
featureFlags
.
isWindowsEnabled
,
true
);
})
)
;
});
test
(
'flutter windows desktop off by default on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter windows desktop off by default on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
expect
(
featureFlags
.
isWindowsEnabled
,
false
);
})
)
;
});
test
(
'fflutter windows desktop not enabled with config on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'fflutter windows desktop not enabled with config on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-windows-desktop'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
false
);
})
)
;
});
test
(
'flutter windows desktop not enabled with environment variable on beta'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter windows desktop not enabled with environment variable on beta'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'beta'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_WINDOWS'
:
'true'
});
expect
(
featureFlags
.
isWindowsEnabled
,
false
);
})
)
;
});
test
(
'flutter windows desktop off by default on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter windows desktop off by default on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
expect
(
featureFlags
.
isWindowsEnabled
,
false
);
})
)
;
});
test
(
'flutter windows desktop not enabled with config on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter windows desktop not enabled with config on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
<
bool
>(
mockFlutterConfig
.
getValue
(
'enable-windows-desktop'
)
as
bool
).
thenReturn
(
true
);
expect
(
featureFlags
.
isWindowsEnabled
,
false
);
})
)
;
});
test
(
'flutter windows desktop not enabled with environment variable on stable'
,
()
=>
testbed
.
run
(
()
{
test
WithoutContext
(
'flutter windows desktop not enabled with environment variable on stable'
,
()
{
when
(
mockFlutterVerion
.
channel
).
thenReturn
(
'stable'
);
when
(
mockPlatform
.
environment
).
thenReturn
(<
String
,
String
>{
'FLUTTER_WINDOWS'
:
'true'
});
expect
(
featureFlags
.
isWindowsEnabled
,
false
);
})
)
;
});
});
}
...
...
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