# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
"""Finds CrOS browsers that can be controlled by telemetry."""
import logging
+from telemetry import decorators
from telemetry.core import browser
from telemetry.core import possible_browser
from telemetry.core.backends.chrome import cros_browser_with_oobe
'system-guest',
]
+
class PossibleCrOSBrowser(possible_browser.PossibleBrowser):
- """A launchable chromeos browser instance."""
+ """A launchable CrOS browser instance."""
def __init__(self, browser_type, finder_options, cri, is_guest):
super(PossibleCrOSBrowser, self).__init__(browser_type, 'cros',
finder_options)
'Please add %s to ALL_BROWSER_TYPES' % browser_type
self._cri = cri
self._is_guest = is_guest
+ self._platform = None
def __repr__(self):
return 'PossibleCrOSBrowser(browser_type=%s)' % self.browser_type
+ @property
+ @decorators.Cache
+ def _platform_backend(self):
+ return cros_platform_backend.CrosPlatformBackend(self._cri)
+
def Create(self):
if self.finder_options.output_profile_path:
- raise Exception("Profile generation is not currently supported on Chrome"
- " OS")
+ raise NotImplementedError(
+ 'Profile generation is not yet supported on CrOS.')
browser_options = self.finder_options.browser_options
backend = cros_browser_backend.CrOSBrowserBackend(
self.browser_type, browser_options, self._cri, self._is_guest,
extensions_to_load=self.finder_options.extensions_to_load)
- platform = cros_platform_backend.CrosPlatformBackend(self._cri)
if browser_options.create_browser_with_oobe:
- return cros_browser_with_oobe.CrOSBrowserWithOOBE(backend, platform)
- else:
- return browser.Browser(backend, platform)
+ return cros_browser_with_oobe.CrOSBrowserWithOOBE(
+ backend, self._platform_backend)
+ return browser.Browser(backend, self._platform_backend)
def SupportsOptions(self, finder_options):
if (len(finder_options.extensions_to_load) != 0) and self._is_guest:
cros_interface.HasSSH())
def FindAllAvailableBrowsers(finder_options):
- """Finds all available chromeos browsers, locally and remotely."""
+ """Finds all available CrOS browsers, locally and remotely."""
if cros_interface.IsRunningOnCrosDevice():
return [PossibleCrOSBrowser('system', finder_options,
cros_interface.CrOSInterface(),