OLD | NEW |
1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 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 | 4 |
5 import logging | 5 import logging |
6 import sys | 6 import sys |
7 | 7 |
8 from py_utils import cloud_storage # pylint: disable=import-error | 8 from py_utils import cloud_storage # pylint: disable=import-error |
9 | 9 |
10 from telemetry.core import exceptions | 10 from telemetry.core import exceptions |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 @property | 96 @property |
97 def foreground_tab(self): | 97 def foreground_tab(self): |
98 for i in xrange(len(self._tabs)): | 98 for i in xrange(len(self._tabs)): |
99 # The foreground tab is the first (only) one that isn't hidden. | 99 # The foreground tab is the first (only) one that isn't hidden. |
100 # This only works through luck on Android, due to crbug.com/322544 | 100 # This only works through luck on Android, due to crbug.com/322544 |
101 # which means that tabs that have never been in the foreground return | 101 # which means that tabs that have never been in the foreground return |
102 # document.hidden as false; however in current code the Android foreground | 102 # document.hidden as false; however in current code the Android foreground |
103 # tab is always tab 0, which will be the first one that isn't hidden | 103 # tab is always tab 0, which will be the first one that isn't hidden |
104 if self._tabs[i].EvaluateJavaScript('!document.hidden'): | 104 if self._tabs[i].EvaluateJavaScript('!document.hidden'): |
105 return self._tabs[i] | 105 return self._tabs[i] |
106 raise Exception("No foreground tab found") | 106 raise exceptions.TabMissingError("No foreground tab found") |
107 | 107 |
108 @property | 108 @property |
109 @decorators.Cache | 109 @decorators.Cache |
110 def extensions(self): | 110 def extensions(self): |
111 if not self.supports_extensions: | 111 if not self.supports_extensions: |
112 raise browser_backend.ExtensionsNotSupportedException( | 112 raise browser_backend.ExtensionsNotSupportedException( |
113 'Extensions not supported') | 113 'Extensions not supported') |
114 return extension_dict.ExtensionDict(self._browser_backend.extension_backend) | 114 return extension_dict.ExtensionDict(self._browser_backend.extension_backend) |
115 | 115 |
116 def _LogBrowserInfo(self): | 116 def _LogBrowserInfo(self): |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 except Exception: # pylint: disable=broad-except | 394 except Exception: # pylint: disable=broad-except |
395 logging.exception('Failed to get browser standard output:') | 395 logging.exception('Failed to get browser standard output:') |
396 logging.info('*********** END OF BROWSER STANDARD OUTPUT ************') | 396 logging.info('*********** END OF BROWSER STANDARD OUTPUT ************') |
397 | 397 |
398 logging.info('********************* BROWSER LOG *********************') | 398 logging.info('********************* BROWSER LOG *********************') |
399 try: | 399 try: |
400 logging.info(self.GetLogFileContents()) | 400 logging.info(self.GetLogFileContents()) |
401 except Exception: # pylint: disable=broad-except | 401 except Exception: # pylint: disable=broad-except |
402 logging.exception('Failed to get browser log:') | 402 logging.exception('Failed to get browser log:') |
403 logging.info('***************** END OF BROWSER LOG ******************') | 403 logging.info('***************** END OF BROWSER LOG ******************') |
OLD | NEW |