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
fc1e7642
Unverified
Commit
fc1e7642
authored
Sep 23, 2020
by
Emmanuel Garcia
Committed by
GitHub
Sep 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose enable-experiment in Flutter drive (#66311)
parent
1a9ea39a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
5 deletions
+102
-5
executable.dart
packages/flutter_tools/lib/executable.dart
+1
-1
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+16
-3
drive_test.dart
...lutter_tools/test/commands.shard/hermetic/drive_test.dart
+85
-1
No files found.
packages/flutter_tools/lib/executable.dart
View file @
fc1e7642
...
@@ -93,7 +93,7 @@ Future<void> main(List<String> args) async {
...
@@ -93,7 +93,7 @@ Future<void> main(List<String> args) async {
DevicesCommand
(),
DevicesCommand
(),
DoctorCommand
(
verbose:
verbose
),
DoctorCommand
(
verbose:
verbose
),
DowngradeCommand
(),
DowngradeCommand
(),
DriveCommand
(),
DriveCommand
(
verboseHelp:
verboseHelp
),
EmulatorsCommand
(),
EmulatorsCommand
(),
FormatCommand
(),
FormatCommand
(),
GenerateCommand
(),
GenerateCommand
(),
...
...
packages/flutter_tools/lib/src/commands/drive.dart
View file @
fc1e7642
...
@@ -50,9 +50,11 @@ import 'run.dart';
...
@@ -50,9 +50,11 @@ import 'run.dart';
/// successful the exit code will be `0`. Otherwise, you will see a non-zero
/// successful the exit code will be `0`. Otherwise, you will see a non-zero
/// exit code.
/// exit code.
class
DriveCommand
extends
RunCommandBase
{
class
DriveCommand
extends
RunCommandBase
{
DriveCommand
()
{
DriveCommand
({
bool
verboseHelp
=
false
,
})
{
requiresPubspecYaml
();
requiresPubspecYaml
();
addEnableExperimentation
(
hide:
!
verboseHelp
);
argParser
argParser
..
addFlag
(
'keep-app-running'
,
..
addFlag
(
'keep-app-running'
,
defaultsTo:
null
,
defaultsTo:
null
,
...
@@ -322,7 +324,18 @@ $ex
...
@@ -322,7 +324,18 @@ $ex
}
}
try
{
try
{
await
testRunner
(<
String
>[
testFile
],
environment
);
await
testRunner
(
<
String
>[
if
(
buildInfo
.
dartExperiments
.
isNotEmpty
)
'--enable-experiment=
${buildInfo.dartExperiments.join(',')}
'
,
if
(
buildInfo
.
nullSafetyMode
==
NullSafetyMode
.
sound
)
'--sound-null-safety'
,
if
(
buildInfo
.
nullSafetyMode
==
NullSafetyMode
.
unsound
)
'--no-sound-null-safety'
,
testFile
,
],
environment
,
);
}
on
Exception
catch
(
error
,
stackTrace
)
{
}
on
Exception
catch
(
error
,
stackTrace
)
{
if
(
error
is
ToolExit
)
{
if
(
error
is
ToolExit
)
{
rethrow
;
rethrow
;
...
...
packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart
View file @
fc1e7642
...
@@ -205,7 +205,7 @@ void main() {
...
@@ -205,7 +205,7 @@ void main() {
return
LaunchResult
.
succeeded
();
return
LaunchResult
.
succeeded
();
});
});
testRunner
=
expectAsync2
((
List
<
String
>
testArgs
,
Map
<
String
,
String
>
environment
)
async
{
testRunner
=
expectAsync2
((
List
<
String
>
testArgs
,
Map
<
String
,
String
>
environment
)
async
{
expect
(
testArgs
,
<
String
>[
testFile
]);
expect
(
testArgs
,
<
String
>[
'--no-sound-null-safety'
,
testFile
]);
// VM_SERVICE_URL is not set by drive command arguments
// VM_SERVICE_URL is not set by drive command arguments
expect
(
environment
,
<
String
,
String
>{
expect
(
environment
,
<
String
,
String
>{
'VM_SERVICE_URL'
:
'null'
,
'VM_SERVICE_URL'
:
'null'
,
...
@@ -273,6 +273,90 @@ void main() {
...
@@ -273,6 +273,90 @@ void main() {
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'enable experiment'
,
()
async
{
final
MockAndroidDevice
mockDevice
=
MockAndroidDevice
();
applyDdsMocks
(
mockDevice
);
testDeviceManager
.
addDevice
(
mockDevice
);
final
String
testApp
=
globals
.
fs
.
path
.
join
(
tempDir
.
path
,
'test'
,
'e2e.dart'
);
final
String
testFile
=
globals
.
fs
.
path
.
join
(
tempDir
.
path
,
'test_driver'
,
'e2e_test.dart'
);
appStarter
=
expectAsync2
((
DriveCommand
command
,
Uri
webUri
)
async
{
return
LaunchResult
.
succeeded
();
});
testRunner
=
expectAsync2
((
List
<
String
>
testArgs
,
Map
<
String
,
String
>
environment
)
async
{
expect
(
testArgs
,
<
String
>[
'--enable-experiment=experiment1,experiment2'
,
'--no-sound-null-safety'
,
testFile
,
]
);
});
appStopper
=
expectAsync1
((
DriveCommand
command
)
async
{
return
true
;
});
final
MemoryFileSystem
memFs
=
fs
;
await
memFs
.
file
(
testApp
).
writeAsString
(
'main() {}'
);
await
memFs
.
file
(
testFile
).
writeAsString
(
'main() {}'
);
final
List
<
String
>
args
=
<
String
>[
'drive'
,
'--target=
$testApp
'
,
'--no-pub'
,
'--enable-experiment=experiment1'
,
'--enable-experiment=experiment2'
,
];
await
createTestCommandRunner
(
command
).
run
(
args
);
expect
(
testLogger
.
errorText
,
isEmpty
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'sound null safety'
,
()
async
{
final
MockAndroidDevice
mockDevice
=
MockAndroidDevice
();
applyDdsMocks
(
mockDevice
);
testDeviceManager
.
addDevice
(
mockDevice
);
final
String
testApp
=
globals
.
fs
.
path
.
join
(
tempDir
.
path
,
'test'
,
'e2e.dart'
);
final
String
testFile
=
globals
.
fs
.
path
.
join
(
tempDir
.
path
,
'test_driver'
,
'e2e_test.dart'
);
appStarter
=
expectAsync2
((
DriveCommand
command
,
Uri
webUri
)
async
{
return
LaunchResult
.
succeeded
();
});
testRunner
=
expectAsync2
((
List
<
String
>
testArgs
,
Map
<
String
,
String
>
environment
)
async
{
expect
(
testArgs
,
<
String
>[
'--sound-null-safety'
,
testFile
,
]
);
});
appStopper
=
expectAsync1
((
DriveCommand
command
)
async
{
return
true
;
});
final
MemoryFileSystem
memFs
=
fs
;
await
memFs
.
file
(
testApp
).
writeAsString
(
'main() {}'
);
await
memFs
.
file
(
testFile
).
writeAsString
(
'main() {}'
);
final
List
<
String
>
args
=
<
String
>[
'drive'
,
'--target=
$testApp
'
,
'--no-pub'
,
'--sound-null-safety'
,
];
await
createTestCommandRunner
(
command
).
run
(
args
);
expect
(
testLogger
.
errorText
,
isEmpty
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
group
(
'findTargetDevice'
,
()
{
group
(
'findTargetDevice'
,
()
{
testUsingContext
(
'uses specified device'
,
()
async
{
testUsingContext
(
'uses specified device'
,
()
async
{
testDeviceManager
.
specifiedDeviceId
=
'123'
;
testDeviceManager
.
specifiedDeviceId
=
'123'
;
...
...
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