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

Unified Diff: tools/telemetry/telemetry/core/backends/chrome/cros_browser_backend.py

Issue 23710017: Guest mode login changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tengs feedback Created 7 years, 3 months 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/telemetry/telemetry/core/backends/chrome/cros_browser_backend.py
diff --git a/tools/telemetry/telemetry/core/backends/chrome/cros_browser_backend.py b/tools/telemetry/telemetry/core/backends/chrome/cros_browser_backend.py
index 7b141f3551b49a48651fe5f9bc7a83cd6a0b1a47..364c184f7b898590875128d75caffb49fe9ce80a 100644
--- a/tools/telemetry/telemetry/core/backends/chrome/cros_browser_backend.py
+++ b/tools/telemetry/telemetry/core/backends/chrome/cros_browser_backend.py
@@ -32,18 +32,20 @@ class CrOSBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
self._SetBranchNumber(self._GetChromeVersion())
- self._login_ext_dir = os.path.join(os.path.dirname(__file__),
- 'chromeos_login_ext')
-
- # Push a dummy login extension to the device.
- # This extension automatically logs in as test@test.test
- # Note that we also perform this copy locally to ensure that
- # the owner of the extensions is set to chronos.
- logging.info('Copying dummy login extension to the device')
- cri.PushFile(self._login_ext_dir, '/tmp/')
- self._login_ext_dir = '/tmp/chromeos_login_ext'
- cri.RunCmdOnDevice(['chown', '-R', 'chronos:chronos',
- self._login_ext_dir])
+ self._login_ext_dir = None
+ if not self._use_oobe_login_for_testing:
+ self._login_ext_dir = os.path.join(os.path.dirname(__file__),
+ 'chromeos_login_ext')
+
+ # Push a dummy login extension to the device.
+ # This extension automatically logs in as test@test.test
+ # Note that we also perform this copy locally to ensure that
+ # the owner of the extensions is set to chronos.
+ logging.info('Copying dummy login extension to the device')
+ cri.PushFile(self._login_ext_dir, '/tmp/')
+ self._login_ext_dir = '/tmp/chromeos_login_ext'
+ cri.RunCmdOnDevice(['chown', '-R', 'chronos:chronos',
+ self._login_ext_dir])
# Copy extensions to temp directories on the device.
# Note that we also perform this copy locally to ensure that
@@ -94,16 +96,17 @@ class CrOSBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
'--vmodule=*/browser/automation/*=2,*/chromeos/net/*=2,' +
'*/chromeos/login/*=2'])
-
- if self.chrome_branch_number <= 1599:
+ if self._is_guest:
args.extend([
# Jump to the login screen, skipping network selection, eula, etc.
'--login-screen=login',
# Skip hwid check, for VMs and pre-MP lab devices.
- '--skip-hwid-check',])
- if not self._is_guest:
- # This extension bypasses gaia and logs us in.
- args.append('--auth-ext-path=%s' % self._login_ext_dir)
+ '--skip-hwid-check'
+ ])
+ elif not self._use_oobe_login_for_testing:
+ # This extension bypasses gaia and logs us in.
+ logging.info('Using --auth-ext-path=%s to login', self._login_ext_dir)
+ args.append('--auth-ext-path=%s' % self._login_ext_dir)
return args
@@ -172,6 +175,11 @@ class CrOSBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
def hwid(self):
return self._cri.RunCmdOnDevice(['/usr/bin/crossystem', 'hwid'])[0]
+ @property
+ def _use_oobe_login_for_testing(self):
+ """Oobe.LoginForTesting was introduced after branch 1599."""
+ return self.chrome_branch_number > 1599
+
def GetRemotePort(self, _):
return self._cri.GetRemotePort()
@@ -328,13 +336,17 @@ class CrOSBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
if startup_window_ext_id in self.extension_dict_backend
else self.tab_list_backend.Get(0, None))
- def _WaitForAccountPicker(self):
- """Waits for the oobe screen to be in the account picker state."""
+ def _WaitForSigininScreen(self):
Tim Song 2013/09/06 18:42:53 Typo here.
achuithb 2013/09/06 18:51:35 Ah sorry: https://codereview.chromium.org/23688006
+ """Waits for oobe to be on the signin or account picker screen."""
+ def OnAccountPickerScreen():
+ signin_state = self._SigninUIState()
+ # GAIA_SIGNIN or ACCOUNT_PICKER screens.
+ return signin_state == 1 or signin_state == 2
try:
- util.WaitFor(lambda: self._SigninUIState() == 2, 60)
+ util.WaitFor(OnAccountPickerScreen, 60)
except util.TimeoutException:
self._cri.TakeScreenShot('guest-screen')
- raise exceptions.LoginException('Timed out waiting for account picker, '
+ raise exceptions.LoginException('Timed out waiting for signin screen, '
'signin state %d' % self._SigninUIState())
def _ClickBrowseAsGuest(self):
@@ -359,13 +371,14 @@ class CrOSBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
def _NavigateGuestLogin(self):
"""Navigates through oobe login screen as guest"""
assert self.oobe
- self._WaitForAccountPicker()
+ self._WaitForSigininScreen()
self._ClickBrowseAsGuest()
self._WaitForGuestFsMounted()
def _NavigateLogin(self):
"""Navigates through oobe login screen"""
- if self.chrome_branch_number > 1599:
+ if self._use_oobe_login_for_testing:
+ logging.info('Invoking Oobe.loginForTesting')
util.WaitFor(lambda: self.oobe, 10)
util.WaitFor(lambda: self.oobe.EvaluateJavaScript(
'typeof Oobe !== \'undefined\''), 10)
@@ -383,10 +396,7 @@ class CrOSBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
util.WaitFor(lambda: self._IsLoggedIn(), 60) # pylint: disable=W0108
except util.TimeoutException:
self._cri.TakeScreenShot('login-screen')
- raise exceptions.LoginException(
- 'Timed out going through oobe screen. Make sure the custom auth '
- 'extension passed through --auth-ext-path is valid and belongs '
- 'to user "chronos".')
+ raise exceptions.LoginException('Timed out going through login screen')
if self.chrome_branch_number < 1500:
# Wait for the startup window, then close it. Startup window doesn't exist
« 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