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 pprint | 6 import pprint |
7 import shlex | 7 import shlex |
8 import sys | 8 import sys |
9 | 9 |
10 from telemetry.core import exceptions | 10 from telemetry.core import exceptions |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 self._port, | 139 self._port, |
140 self._browser_target, self) | 140 self._browser_target, self) |
141 | 141 |
142 def _WaitForBrowserToComeUp(self, remote_devtools_port=None): | 142 def _WaitForBrowserToComeUp(self, remote_devtools_port=None): |
143 """ Wait for browser to come up. | 143 """ Wait for browser to come up. |
144 | 144 |
145 Args: | 145 Args: |
146 remote_devtools_port: The remote devtools port, if | 146 remote_devtools_port: The remote devtools port, if |
147 any. Otherwise assumed to be the same as self._port. | 147 any. Otherwise assumed to be the same as self._port. |
148 """ | 148 """ |
| 149 if self._devtools_client: |
| 150 # In case we are launching a second browser instance (as is done by |
| 151 # the CrOS backend), ensure that the old devtools_client is closed, |
| 152 # otherwise re-creating it will fail. |
| 153 self._devtools_client.Close() |
| 154 self._devtools_client = None |
149 try: | 155 try: |
150 timeout = self.browser_options.browser_startup_timeout | 156 timeout = self.browser_options.browser_startup_timeout |
151 py_utils.WaitFor(self.HasBrowserFinishedLaunching, timeout=timeout) | 157 py_utils.WaitFor(self.HasBrowserFinishedLaunching, timeout=timeout) |
152 except (py_utils.TimeoutException, exceptions.ProcessGoneException) as e: | 158 except (py_utils.TimeoutException, exceptions.ProcessGoneException) as e: |
153 if not self.IsBrowserRunning(): | 159 if not self.IsBrowserRunning(): |
154 raise exceptions.BrowserGoneException(self.browser, e) | 160 raise exceptions.BrowserGoneException(self.browser, e) |
155 raise exceptions.BrowserConnectionGoneException(self.browser, e) | 161 raise exceptions.BrowserConnectionGoneException(self.browser, e) |
156 self._devtools_client = devtools_client_backend.DevToolsClientBackend( | 162 self._devtools_client = devtools_client_backend.DevToolsClientBackend( |
157 self._port, self._browser_target, | 163 self._port, self._browser_target, |
158 remote_devtools_port or self._port, self) | 164 remote_devtools_port or self._port, self) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 def supports_cpu_metrics(self): | 304 def supports_cpu_metrics(self): |
299 return True | 305 return True |
300 | 306 |
301 @property | 307 @property |
302 def supports_memory_metrics(self): | 308 def supports_memory_metrics(self): |
303 return True | 309 return True |
304 | 310 |
305 @property | 311 @property |
306 def supports_power_metrics(self): | 312 def supports_power_metrics(self): |
307 return True | 313 return True |
OLD | NEW |