Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: tools/chrome_proxy/webdriver/common.py

Issue 2555833003: Add functionality for Android. (Closed)
Patch Set: Prettier logic Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/chrome_proxy/webdriver/common.py
diff --git a/tools/chrome_proxy/webdriver/common.py b/tools/chrome_proxy/webdriver/common.py
index 84248c606c2c7bf6a6d6d124ad1a3a8335b0a296..f6798c9d3a70d99e5cd0c65870b8ac3e76bc9635 100644
--- a/tools/chrome_proxy/webdriver/common.py
+++ b/tools/chrome_proxy/webdriver/common.py
@@ -32,6 +32,10 @@ def ParseFlags():
parser.add_argument('--via_header_value', metavar='via_header', nargs=1,
default='1.1 Chrome-Compression-Proxy', help='What the via should match to '
'be considered valid')
+ parser.add_argument('--android', help='If given, attempts to run the test on '
+ 'Android via adb. Ignores usage of --chrome_exec', action='store_true')
+ parser.add_argument('--android_package', nargs=1,
+ default='com.android.chrome', help='Set the android package for Chrome')
parser.add_argument('--chrome_exec', nargs=1, type=str, help='The path to '
'the Chrome or Chromium executable')
parser.add_argument('chrome_driver', nargs=1, type=str, help='The path to '
@@ -110,16 +114,24 @@ class TestDriver:
def _StartDriver(self):
"""Parses the flags to pass to Chromium, then starts the ChromeDriver.
+
+ If running Android, the Android package name is passed to ChromeDriver here.
"""
self._OverrideChromeArgs()
- options = Options()
- for arg in self._chrome_args:
- options.add_argument(arg)
- capabilities = {'loggingPrefs': {'performance': 'INFO'}}
- if self._flags.chrome_exec:
+ capabilities = {
+ 'loggingPrefs': {'performance': 'INFO'},
+ 'chromeOptions': {
+ 'args': list(self._chrome_args)
+ }
+ }
+ if self._flags.android:
+ capabilities['chromeOptions'].update({
+ 'androidPackage': self._flags.android_package,
+ })
+ elif self._flags.chrome_exec:
capabilities['chrome.binary'] = self._flags.chrome_exec
driver = webdriver.Chrome(executable_path=self._flags.chrome_driver[0],
- chrome_options=options, desired_capabilities=capabilities)
+ desired_capabilities=capabilities)
driver.command_executor._commands.update({
'getAvailableLogTypes': ('GET', '/session/$sessionId/log/types'),
'getLog': ('POST', '/session/$sessionId/log')})
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698