summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorachuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-16 20:47:36 +0000
committerachuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-16 20:47:36 +0000
commita1b1e3b100d643da05e68babaf0ba4c44fb9d0b7 (patch)
tree2b7c242f0bf245066523a7d5b17702371214ed0e /tools
parent07ecb54ec356a703dd0d977b2e2cba8b9fae1be4 (diff)
downloadchromium_src-a1b1e3b100d643da05e68babaf0ba4c44fb9d0b7.zip
chromium_src-a1b1e3b100d643da05e68babaf0ba4c44fb9d0b7.tar.gz
chromium_src-a1b1e3b100d643da05e68babaf0ba4c44fb9d0b7.tar.bz2
Better support for chrome for cros local builds.
* Use ldd to detect chrome for cros local builds. * Add browser types debug-cros and release-cros for chrome for cros on linux. * Remove browser option --cros-desktop BUG=229692 TEST=run_tests works with cros-debug going through the login flow. NOTRY=True Review URL: https://codereview.chromium.org/14102002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194441 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/telemetry/telemetry/core/browser_options.py6
-rw-r--r--tools/telemetry/telemetry/core/chrome/desktop_browser_backend.py8
-rw-r--r--tools/telemetry/telemetry/core/chrome/desktop_browser_finder.py27
3 files changed, 30 insertions, 11 deletions
diff --git a/tools/telemetry/telemetry/core/browser_options.py b/tools/telemetry/telemetry/core/browser_options.py
index 73153a3..a7f0b4a 100644
--- a/tools/telemetry/telemetry/core/browser_options.py
+++ b/tools/telemetry/telemetry/core/browser_options.py
@@ -29,7 +29,6 @@ class BrowserOptions(optparse.Values):
self.extra_wpr_args = []
self.show_stdout = False
self.extensions_to_load = []
- self.cros_desktop = False
self.cros_remote = None
self.wpr_mode = wpr_modes.WPR_OFF
@@ -103,11 +102,6 @@ class BrowserOptions(optparse.Values):
group.add_option('--show-stdout',
action='store_true',
help='When possible, will display the stdout of the process')
- # --cros-desktop is linux only.
- if sys.platform.startswith('linux'):
- group.add_option('--cros-desktop',
- action='store_true',
- help='Run ChromeOS desktop')
parser.add_option_group(group)
# Page set options
diff --git a/tools/telemetry/telemetry/core/chrome/desktop_browser_backend.py b/tools/telemetry/telemetry/core/chrome/desktop_browser_backend.py
index d8ace00..58a6307 100644
--- a/tools/telemetry/telemetry/core/chrome/desktop_browser_backend.py
+++ b/tools/telemetry/telemetry/core/chrome/desktop_browser_backend.py
@@ -16,7 +16,7 @@ class DesktopBrowserBackend(browser_backend.BrowserBackend):
"""The backend for controlling a locally-executed browser instance, on Linux,
Mac or Windows.
"""
- def __init__(self, options, executable, is_content_shell):
+ def __init__(self, options, executable, is_content_shell, use_login):
super(DesktopBrowserBackend, self).__init__(
is_content_shell=is_content_shell,
supports_extensions=not is_content_shell, options=options)
@@ -26,6 +26,8 @@ class DesktopBrowserBackend(browser_backend.BrowserBackend):
self._tmpdir = None
self._tmp_output_file = None
+ self._use_login = use_login
+
self._executable = executable
if not self._executable:
raise Exception('Cannot create browser, no executable found!')
@@ -45,7 +47,7 @@ class DesktopBrowserBackend(browser_backend.BrowserBackend):
self._supports_net_benchmarking = False
self._LaunchBrowser(options)
- if self.options.cros_desktop:
+ if self._use_login:
cros_util.NavigateLogin(self)
def _LaunchBrowser(self, options):
@@ -83,7 +85,7 @@ class DesktopBrowserBackend(browser_backend.BrowserBackend):
shutil.rmtree(self._tmpdir)
shutil.copytree(self.options.profile_dir, self._tmpdir)
args.append('--user-data-dir=%s' % self._tmpdir)
- if self.options.cros_desktop:
+ if self._use_login:
ext_path = os.path.join(os.path.dirname(__file__), 'chromeos_login_ext')
args.extend(['--login-manager', '--login-profile=user',
'--stub-cros', '--login-screen=login',
diff --git a/tools/telemetry/telemetry/core/chrome/desktop_browser_finder.py b/tools/telemetry/telemetry/core/chrome/desktop_browser_finder.py
index 1abfc1e..d7083fc 100644
--- a/tools/telemetry/telemetry/core/chrome/desktop_browser_finder.py
+++ b/tools/telemetry/telemetry/core/chrome/desktop_browser_finder.py
@@ -22,22 +22,27 @@ ALL_BROWSER_TYPES = ','.join([
'canary',
'content-shell-debug',
'content-shell-release',
+ 'debug-cros',
+ 'release-cros',
'system'])
class PossibleDesktopBrowser(possible_browser.PossibleBrowser):
"""A desktop browser that can be controlled."""
- def __init__(self, browser_type, options, executable, is_content_shell):
+ def __init__(self, browser_type, options, executable, is_content_shell,
+ use_login=False):
super(PossibleDesktopBrowser, self).__init__(browser_type, options)
self._local_executable = executable
self._is_content_shell = is_content_shell
+ self._use_login = use_login
def __repr__(self):
return 'PossibleDesktopBrowser(browser_type=%s)' % self.browser_type
def Create(self):
backend = desktop_browser_backend.DesktopBrowserBackend(
- self._options, self._local_executable, self._is_content_shell)
+ self._options, self._local_executable,
+ self._is_content_shell, self._use_login)
if sys.platform.startswith('linux'):
p = linux_platform_backend.LinuxPlatformBackend()
elif sys.platform == 'darwin':
@@ -113,6 +118,24 @@ def FindAllAvailableBrowsers(options):
AddIfFound('release', 'Release', chromium_app_name, False)
AddIfFound('content-shell-release', 'Release', content_shell_app_name, True)
+ # Add local chrome for CrOS builds.
+ def AddCrOSIfFound(browser_type, type_dir):
+ """Adds local chrome for ChromeOS builds on linux"""
+ app = os.path.join(chrome_root, 'out', type_dir, chromium_app_name)
+ ldd_path = '/usr/bin/ldd'
+ if not os.path.exists(app) or not os.path.exists(ldd_path):
+ return
+ # Look for libchromeos.so in ldd output.
+ ldd_out = subprocess.check_output([ldd_path, app])
+ if ldd_out.count('libchromeos.so'):
+ browsers.append(PossibleDesktopBrowser(browser_type, options, app,
+ is_content_shell=False,
+ use_login=True))
+
+ if sys.platform.startswith('linux'):
+ AddCrOSIfFound('debug-cros', 'Debug')
+ AddCrOSIfFound('release-cros', 'Release')
+
# Mac-specific options.
if sys.platform == 'darwin':
mac_canary = ('/Applications/Google Chrome Canary.app/'