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
6083f158
Unverified
Commit
6083f158
authored
Mar 25, 2020
by
Angjie Li
Committed by
GitHub
Mar 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow user to specify which Chrome binary to use. (#53275)
* Allow user to specify which Chrome binary to use.
parent
ee3920c2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+13
-6
drive_test.dart
...lutter_tools/test/commands.shard/hermetic/drive_test.dart
+3
-1
No files found.
packages/flutter_tools/lib/src/commands/drive.dart
View file @
6083f158
...
...
@@ -108,7 +108,10 @@ class DriveCommand extends RunCommandBase {
..
addFlag
(
'android-emulator'
,
defaultsTo:
true
,
help:
'Whether to perform Flutter Driver testing on Android Emulator.'
'Works only if
\'
browser-name
\'
is set to
\'
android-chrome
\'
'
);
'Works only if
\'
browser-name
\'
is set to
\'
android-chrome
\'
'
)
..
addOption
(
'chrome-binary'
,
help:
'Location of Chrome binary. '
'Works only if
\'
browser-name
\'
is set to
\'
chrome
\'
'
);
}
@override
...
...
@@ -245,6 +248,7 @@ class DriveCommand extends RunCommandBase {
driverPort
,
browser
,
argResults
[
'headless'
].
toString
()
==
'true'
,
stringArg
(
'chrome-binary'
),
);
}
on
Exception
catch
(
ex
)
{
throwToolExit
(
...
...
@@ -529,17 +533,18 @@ Browser _browserNameToEnum(String browserName){
throw
UnsupportedError
(
'Browser
$browserName
not supported'
);
}
Future
<
async_io
.
WebDriver
>
_createDriver
(
String
driverPort
,
Browser
browser
,
bool
headless
)
async
{
Future
<
async_io
.
WebDriver
>
_createDriver
(
String
driverPort
,
Browser
browser
,
bool
headless
,
String
chromeBinary
)
async
{
return
async_io
.
createDriver
(
uri:
Uri
.
parse
(
'http://localhost:
$driverPort
/'
),
desired:
getDesiredCapabilities
(
browser
,
headless
),
desired:
getDesiredCapabilities
(
browser
,
headless
,
chromeBinary
),
spec:
async_io
.
WebDriverSpec
.
Auto
);
}
/// Returns desired capabilities for given [browser] and [headless].
/// Returns desired capabilities for given [browser], [headless] and
/// [chromeBinary].
@visibleForTesting
Map
<
String
,
dynamic
>
getDesiredCapabilities
(
Browser
browser
,
bool
headless
)
{
Map
<
String
,
dynamic
>
getDesiredCapabilities
(
Browser
browser
,
bool
headless
,
[
String
chromeBinary
]
)
{
switch
(
browser
)
{
case
Browser
.
chrome
:
return
<
String
,
dynamic
>{
...
...
@@ -547,6 +552,8 @@ Map<String, dynamic> getDesiredCapabilities(Browser browser, bool headless) {
'browserName'
:
'chrome'
,
'goog:loggingPrefs'
:
<
String
,
String
>{
async_io
.
LogType
.
performance
:
'ALL'
},
'chromeOptions'
:
<
String
,
dynamic
>{
if
(
chromeBinary
!=
null
)
'binary'
:
chromeBinary
,
'w3c'
:
false
,
'args'
:
<
String
>[
'--bwsi'
,
...
...
@@ -566,7 +573,7 @@ Map<String, dynamic> getDesiredCapabilities(Browser browser, bool headless) {
'v8,blink.console,benchmark,blink,'
'blink.user_timing'
}
}
}
,
};
break
;
case
Browser
.
firefox
:
...
...
packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart
View file @
6083f158
...
...
@@ -612,11 +612,13 @@ void main() {
});
test
(
'Chrome with headless off'
,
()
{
const
String
chromeBinary
=
'random-binary'
;
final
Map
<
String
,
dynamic
>
expected
=
<
String
,
dynamic
>{
'acceptInsecureCerts'
:
true
,
'browserName'
:
'chrome'
,
'goog:loggingPrefs'
:
<
String
,
String
>{
sync_io
.
LogType
.
performance
:
'ALL'
},
'chromeOptions'
:
<
String
,
dynamic
>{
'binary'
:
chromeBinary
,
'w3c'
:
false
,
'args'
:
<
String
>[
'--bwsi'
,
...
...
@@ -638,7 +640,7 @@ void main() {
}
};
expect
(
getDesiredCapabilities
(
Browser
.
chrome
,
false
),
expected
);
expect
(
getDesiredCapabilities
(
Browser
.
chrome
,
false
,
chromeBinary
),
expected
);
});
...
...
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