OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import logging | 4 import logging |
5 import os | 5 import os |
6 import subprocess | 6 import subprocess |
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.core.chrome import browser_backend | 10 from telemetry.core.chrome import browser_backend |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 # chrome_branch_number is set in _PostBrowserStartupInitialization. | 105 # chrome_branch_number is set in _PostBrowserStartupInitialization. |
106 # Without --skip-hwid-check (introduced in crrev.com/203397), devices/VMs | 106 # Without --skip-hwid-check (introduced in crrev.com/203397), devices/VMs |
107 # will be stuck on the bad hwid screen. | 107 # will be stuck on the bad hwid screen. |
108 if self.chrome_branch_number <= 1500 and not self.hwid: | 108 if self.chrome_branch_number <= 1500 and not self.hwid: |
109 raise exceptions.LoginException( | 109 raise exceptions.LoginException( |
110 'Hardware id not set on device/VM. --skip-hwid-check not supported ' | 110 'Hardware id not set on device/VM. --skip-hwid-check not supported ' |
111 'with chrome branches 1500 or earlier.') | 111 'with chrome branches 1500 or earlier.') |
112 | 112 |
113 if self._is_guest: | 113 if self._is_guest: |
| 114 pid = self.pid |
114 cros_util.NavigateGuestLogin(self, cri) | 115 cros_util.NavigateGuestLogin(self, cri) |
115 # Guest browsing shuts down the current browser and launches an incognito | 116 # Guest browsing shuts down the current browser and launches an incognito |
116 # browser, which we need to wait for. | 117 # browser in a separate process, which we need to wait for. |
| 118 util.WaitFor(lambda: pid != self.pid, 10) |
117 self._WaitForBrowserToComeUp() | 119 self._WaitForBrowserToComeUp() |
118 else: | 120 else: |
119 cros_util.NavigateLogin(self) | 121 cros_util.NavigateLogin(self) |
120 | 122 |
121 logging.info('Browser is up!') | 123 logging.info('Browser is up!') |
122 | 124 |
123 def GetBrowserStartupArgs(self): | 125 def GetBrowserStartupArgs(self): |
124 self.webpagereplay_remote_http_port = self._cri.GetRemotePort() | 126 self.webpagereplay_remote_http_port = self._cri.GetRemotePort() |
125 self.webpagereplay_remote_https_port = self._cri.GetRemotePort() | 127 self.webpagereplay_remote_https_port = self._cri.GetRemotePort() |
126 | 128 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 @property | 234 @property |
233 def url(self): | 235 def url(self): |
234 assert self._proc | 236 assert self._proc |
235 return 'http://localhost:%i' % self._host_port | 237 return 'http://localhost:%i' % self._host_port |
236 | 238 |
237 def Close(self): | 239 def Close(self): |
238 if self._proc: | 240 if self._proc: |
239 self._proc.kill() | 241 self._proc.kill() |
240 self._proc = None | 242 self._proc = None |
241 | 243 |
OLD | NEW |