| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 | 7 |
| 8 from telemetry.core import exceptions | 8 from telemetry.core import exceptions |
| 9 from telemetry.core import util | 9 from telemetry.core import util |
| 10 from telemetry import decorators | 10 from telemetry import decorators |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 try: | 132 try: |
| 133 if self._is_guest: | 133 if self._is_guest: |
| 134 pid = self.pid | 134 pid = self.pid |
| 135 self.oobe.NavigateGuestLogin() | 135 self.oobe.NavigateGuestLogin() |
| 136 # Guest browsing shuts down the current browser and launches an | 136 # Guest browsing shuts down the current browser and launches an |
| 137 # incognito browser in a separate process, which we need to wait for. | 137 # incognito browser in a separate process, which we need to wait for. |
| 138 util.WaitFor(lambda: pid != self.pid, 10) | 138 util.WaitFor(lambda: pid != self.pid, 10) |
| 139 elif self.browser_options.gaia_login: | 139 elif self.browser_options.gaia_login: |
| 140 self.oobe.NavigateGaiaLogin(self._username, self._password) | 140 self.oobe.NavigateGaiaLogin(self._username, self._password) |
| 141 else: | 141 else: |
| 142 self.oobe.NavigateFakeLogin(self._username, self._password) | 142 self.oobe.NavigateFakeLogin(self._username, self._password, |
| 143 self._gaia_id) |
| 144 |
| 143 self._WaitForLogin() | 145 self._WaitForLogin() |
| 144 except exceptions.TimeoutException: | 146 except exceptions.TimeoutException: |
| 145 raise exceptions.LoginException('Timed out going through login screen') | 147 raise exceptions.LoginException('Timed out going through login screen') |
| 146 | 148 |
| 147 logging.info('Browser is up!') | 149 logging.info('Browser is up!') |
| 148 | 150 |
| 149 def Close(self): | 151 def Close(self): |
| 150 super(CrOSBrowserBackend, self).Close() | 152 super(CrOSBrowserBackend, self).Close() |
| 151 | 153 |
| 152 if self._cri: | 154 if self._cri: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return self.misc_web_contents_backend.oobe_exists | 191 return self.misc_web_contents_backend.oobe_exists |
| 190 | 192 |
| 191 @property | 193 @property |
| 192 def _username(self): | 194 def _username(self): |
| 193 return self.browser_options.username | 195 return self.browser_options.username |
| 194 | 196 |
| 195 @property | 197 @property |
| 196 def _password(self): | 198 def _password(self): |
| 197 return self.browser_options.password | 199 return self.browser_options.password |
| 198 | 200 |
| 201 @property |
| 202 def _gaia_id(self): |
| 203 return self.browser_options.gaia_id |
| 204 |
| 199 def _IsCryptohomeMounted(self): | 205 def _IsCryptohomeMounted(self): |
| 200 username = '$guest' if self._is_guest else self._username | 206 username = '$guest' if self._is_guest else self._username |
| 201 return self._cri.IsCryptohomeMounted(username, self._is_guest) | 207 return self._cri.IsCryptohomeMounted(username, self._is_guest) |
| 202 | 208 |
| 203 def _IsLoggedIn(self): | 209 def _IsLoggedIn(self): |
| 204 """Returns True if cryptohome has mounted, the browser is | 210 """Returns True if cryptohome has mounted, the browser is |
| 205 responsive to devtools requests, and the oobe has been dismissed.""" | 211 responsive to devtools requests, and the oobe has been dismissed.""" |
| 206 return (self._IsCryptohomeMounted() and | 212 return (self._IsCryptohomeMounted() and |
| 207 self.HasBrowserFinishedLaunching() and | 213 self.HasBrowserFinishedLaunching() and |
| 208 not self.oobe_exists) | 214 not self.oobe_exists) |
| 209 | 215 |
| 210 def _WaitForLogin(self): | 216 def _WaitForLogin(self): |
| 211 # Wait for cryptohome to mount. | 217 # Wait for cryptohome to mount. |
| 212 util.WaitFor(self._IsLoggedIn, 60) | 218 util.WaitFor(self._IsLoggedIn, 60) |
| 213 | 219 |
| 214 # For incognito mode, the session manager actually relaunches chrome with | 220 # For incognito mode, the session manager actually relaunches chrome with |
| 215 # new arguments, so we have to wait for the browser to come up. | 221 # new arguments, so we have to wait for the browser to come up. |
| 216 self._WaitForBrowserToComeUp() | 222 self._WaitForBrowserToComeUp() |
| 217 | 223 |
| 218 # Wait for extensions to load. | 224 # Wait for extensions to load. |
| 219 if self._supports_extensions: | 225 if self._supports_extensions: |
| 220 self._WaitForExtensionsToLoad() | 226 self._WaitForExtensionsToLoad() |
| OLD | NEW |