| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 base64 | 5 import base64 |
| 6 import logging | 6 import logging |
| 7 import urlparse | 7 import urlparse |
| 8 | 8 |
| 9 from metrics import chrome_proxy | 9 from metrics import chrome_proxy |
| 10 from metrics import loading | 10 from metrics import loading |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 logging.warning('Navigation timeout on page %s', | 89 logging.warning('Navigation timeout on page %s', |
| 90 page.name if page.name else page.url) | 90 page.name if page.name else page.url) |
| 91 else: | 91 else: |
| 92 raise e | 92 raise e |
| 93 | 93 |
| 94 | 94 |
| 95 class ChromeProxyHeaders(ChromeProxyValidation): | 95 class ChromeProxyHeaders(ChromeProxyValidation): |
| 96 """Correctness measurement for response headers.""" | 96 """Correctness measurement for response headers.""" |
| 97 | 97 |
| 98 def __init__(self): | 98 def __init__(self): |
| 99 super(ChromeProxyHeaders, self).__init__() | 99 super(ChromeProxyHeaders, self).__init__(restart_after_each_page=True) |
| 100 | 100 |
| 101 def AddResults(self, tab, results): | 101 def AddResults(self, tab, results): |
| 102 self._metrics.AddResultsForHeaderValidation(tab, results) | 102 self._metrics.AddResultsForHeaderValidation(tab, results) |
| 103 | 103 |
| 104 | 104 |
| 105 class ChromeProxyBypass(ChromeProxyValidation): | 105 class ChromeProxyBypass(ChromeProxyValidation): |
| 106 """Correctness measurement for bypass responses.""" | 106 """Correctness measurement for bypass responses.""" |
| 107 | 107 |
| 108 def __init__(self): | 108 def __init__(self): |
| 109 super(ChromeProxyBypass, self).__init__(restart_after_each_page=True) | 109 super(ChromeProxyBypass, self).__init__(restart_after_each_page=True) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 ], | 243 ], |
| 244 'bypass': [self._metrics.AddResultsForBypass], | 244 'bypass': [self._metrics.AddResultsForBypass], |
| 245 'safebrowsing': [self._metrics.AddResultsForSafebrowsing], | 245 'safebrowsing': [self._metrics.AddResultsForSafebrowsing], |
| 246 } | 246 } |
| 247 if not self._page.name in page_to_metrics: | 247 if not self._page.name in page_to_metrics: |
| 248 raise page_measurement.MeasurementFailure( | 248 raise page_measurement.MeasurementFailure( |
| 249 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( | 249 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( |
| 250 self._page.name, page_to_metrics.keys())) | 250 self._page.name, page_to_metrics.keys())) |
| 251 for add_result in page_to_metrics[self._page.name]: | 251 for add_result in page_to_metrics[self._page.name]: |
| 252 add_result(tab, results) | 252 add_result(tab, results) |
| OLD | NEW |