Index: tools/telemetry/telemetry/core/browser_options.py |
diff --git a/tools/telemetry/telemetry/core/browser_options.py b/tools/telemetry/telemetry/core/browser_options.py |
index fca4385814aff1b087b2620bf891120253051efe..118bd90f09d1d113683a6f5b1802ef953224eb23 100644 |
--- a/tools/telemetry/telemetry/core/browser_options.py |
+++ b/tools/telemetry/telemetry/core/browser_options.py |
@@ -7,10 +7,12 @@ import logging |
import optparse |
import os |
import shlex |
+import string |
import sys |
from telemetry.core import browser_finder |
from telemetry.core import browser_finder_exceptions |
+from telemetry.core import device_finder |
from telemetry.core import platform |
from telemetry.core import profile_types |
from telemetry.core import util |
@@ -31,7 +33,7 @@ class BrowserFinderOptions(optparse.Values): |
self.browser_type = browser_type |
self.browser_executable = None |
self.chrome_root = None |
- self.android_device = None |
+ self.device = None |
self.cros_ssh_identity = None |
self.extensions_to_load = [] |
@@ -75,9 +77,8 @@ class BrowserFinderOptions(optparse.Values): |
help='Where to look for chrome builds.' |
'Defaults to searching parent dirs by default.') |
group.add_option('--device', |
- dest='android_device', |
- help='The android device ID to use' |
- 'If not specified, only 0 or 1 connected devices are supported.') |
+ dest='device', |
+ help='The target device identifier.') |
group.add_option('--target-arch', |
dest='target_arch', |
help='The target architecture of the browser. Options available are: ' |
@@ -152,16 +153,29 @@ class BrowserFinderOptions(optparse.Values): |
else: |
logging.getLogger().setLevel(logging.WARNING) |
+ if self.device == 'list': |
+ device_names = device_finder.GetAllAvailableDeviceNames(self) |
+ sys.stdout.write('Available devices:\n') |
+ sys.stdout.write(' %s\n' % '\n '.join(device_names)) |
+ sys.exit(0) |
+ |
if self.browser_executable and not self.browser_type: |
self.browser_type = 'exact' |
if self.browser_type == 'list': |
try: |
- types = browser_finder.GetAllAvailableBrowserTypes(self) |
+ browsers = browser_finder.GetAllAvailableBrowsers(self) |
nednguyen
2015/01/07 18:18:09
Ditto.
|
except browser_finder_exceptions.BrowserFinderException, ex: |
sys.stderr.write('ERROR: ' + str(ex)) |
sys.exit(1) |
sys.stdout.write('Available browsers:\n') |
- sys.stdout.write(' %s\n' % '\n '.join(types)) |
+ device_names = device_finder.GetAllAvailableDeviceNames(self) |
+ for device_name in device_names: |
+ sys.stdout.write(' %s\n' % device_name) |
+ device_id = string.replace(device_name, 'android: ', '') |
+ types = [browser.browser_type for browser in browsers |
+ if device_id == browser.device_id] |
+ types.sort() |
+ sys.stdout.write(' %s\n' % '\n '.join(types)) |
sys.exit(0) |
# Parse browser options. |