Chromium Code Reviews| 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 integration_tests import chrome_proxy_metrics as metrics | 9 from integration_tests import chrome_proxy_metrics as metrics |
| 10 from metrics import loading | 10 from metrics import loading |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 class ChromeProxyBlockOnce(ChromeProxyValidation): | 132 class ChromeProxyBlockOnce(ChromeProxyValidation): |
| 133 """Correctness measurement for block-once responses.""" | 133 """Correctness measurement for block-once responses.""" |
| 134 | 134 |
| 135 def __init__(self): | 135 def __init__(self): |
| 136 super(ChromeProxyBlockOnce, self).__init__(restart_after_each_page=True) | 136 super(ChromeProxyBlockOnce, self).__init__(restart_after_each_page=True) |
| 137 | 137 |
| 138 def AddResults(self, tab, results): | 138 def AddResults(self, tab, results): |
| 139 self._metrics.AddResultsForBlockOnce(tab, results) | 139 self._metrics.AddResultsForBlockOnce(tab, results) |
| 140 | 140 |
| 141 | 141 |
| 142 class ChromeProxySafebrowsing(ChromeProxyValidation): | 142 class ChromeProxySafebrowsingMobile(ChromeProxyValidation): |
| 143 """Correctness measurement for safebrowsing.""" | 143 """Correctness measurement for safebrowsing.""" |
| 144 | 144 |
| 145 def __init__(self): | 145 def __init__(self): |
| 146 super(ChromeProxySafebrowsing, self).__init__() | 146 super(ChromeProxySafebrowsingMobile, self).__init__() |
| 147 | 147 |
| 148 def WillNavigateToPage(self, page, tab): | 148 def WillNavigateToPage(self, page, tab): |
| 149 super(ChromeProxySafebrowsing, self).WillNavigateToPage(page, tab) | 149 super(ChromeProxySafebrowsingMobile, self).WillNavigateToPage(page, tab) |
| 150 self._expect_timeout = True | 150 self._expect_timeout = True |
| 151 | 151 |
| 152 def AddResults(self, tab, results): | 152 def AddResults(self, tab, results): |
| 153 self._metrics.AddResultsForSafebrowsing(tab, results) | 153 self._metrics.AddResultsForSafebrowsingMobile(tab, results) |
| 154 | 154 |
| 155 class ChromeProxySafebrowsingDesktop(ChromeProxyValidation): | |
| 156 """Correctness measurement for safebrowsing.""" | |
| 157 | |
| 158 def __init__(self): | |
| 159 super(ChromeProxySafebrowsingDesktop, self).__init__() | |
| 160 | |
| 161 def WillNavigateToPage(self, page, tab): | |
| 162 super(ChromeProxySafebrowsingDesktop, self).WillNavigateToPage(page, tab) | |
| 163 self._expect_timeout = False | |
|
sclittle
2015/01/23 19:01:57
The default is to not expect a timeout, you could
Not at Google. Contact bengr
2015/01/23 20:02:47
Done.
| |
| 164 | |
| 165 def AddResults(self, tab, results): | |
| 166 self._metrics.AddResultsForSafebrowsingDesktop(tab, results) | |
| 155 | 167 |
| 156 _FAKE_PROXY_AUTH_VALUE = 'aabbccdd3b7579186c1b0620614fdb1f0000ffff' | 168 _FAKE_PROXY_AUTH_VALUE = 'aabbccdd3b7579186c1b0620614fdb1f0000ffff' |
| 157 _TEST_SERVER = 'chromeproxy-test.appspot.com' | 169 _TEST_SERVER = 'chromeproxy-test.appspot.com' |
| 158 _TEST_SERVER_DEFAULT_URL = 'http://' + _TEST_SERVER + '/default' | 170 _TEST_SERVER_DEFAULT_URL = 'http://' + _TEST_SERVER + '/default' |
| 159 | 171 |
| 160 | 172 |
| 161 # We rely on the chromeproxy-test server to facilitate some of the tests. | 173 # We rely on the chromeproxy-test server to facilitate some of the tests. |
| 162 # The test server code is at <TBD location> and runs at _TEST_SERVER | 174 # The test server code is at <TBD location> and runs at _TEST_SERVER |
| 163 # | 175 # |
| 164 # The test server allow request to override response status, headers, and | 176 # The test server allow request to override response status, headers, and |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 | 334 |
| 323 | 335 |
| 324 class ChromeProxySmoke(ChromeProxyValidation): | 336 class ChromeProxySmoke(ChromeProxyValidation): |
| 325 """Smoke measurement for basic chrome proxy correctness.""" | 337 """Smoke measurement for basic chrome proxy correctness.""" |
| 326 | 338 |
| 327 def __init__(self): | 339 def __init__(self): |
| 328 super(ChromeProxySmoke, self).__init__() | 340 super(ChromeProxySmoke, self).__init__() |
| 329 | 341 |
| 330 def WillNavigateToPage(self, page, tab): | 342 def WillNavigateToPage(self, page, tab): |
| 331 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab) | 343 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab) |
| 332 if page.name == 'safebrowsing': | |
| 333 self._expect_timeout = True | |
| 334 | 344 |
| 335 def AddResults(self, tab, results): | 345 def AddResults(self, tab, results): |
| 336 # Map a page name to its AddResults func. | 346 # Map a page name to its AddResults func. |
| 337 page_to_metrics = { | 347 page_to_metrics = { |
| 338 'header validation': [self._metrics.AddResultsForHeaderValidation], | 348 'header validation': [self._metrics.AddResultsForHeaderValidation], |
| 339 'compression: image': [ | 349 'compression: image': [ |
| 340 self._metrics.AddResultsForHeaderValidation, | 350 self._metrics.AddResultsForHeaderValidation, |
| 341 self._metrics.AddResultsForDataSaving, | 351 self._metrics.AddResultsForDataSaving, |
| 342 ], | 352 ], |
| 343 'compression: javascript': [ | 353 'compression: javascript': [ |
| 344 self._metrics.AddResultsForHeaderValidation, | 354 self._metrics.AddResultsForHeaderValidation, |
| 345 self._metrics.AddResultsForDataSaving, | 355 self._metrics.AddResultsForDataSaving, |
| 346 ], | 356 ], |
| 347 'compression: css': [ | 357 'compression: css': [ |
| 348 self._metrics.AddResultsForHeaderValidation, | 358 self._metrics.AddResultsForHeaderValidation, |
| 349 self._metrics.AddResultsForDataSaving, | 359 self._metrics.AddResultsForDataSaving, |
| 350 ], | 360 ], |
| 351 'bypass': [self._metrics.AddResultsForBypass], | 361 'bypass': [self._metrics.AddResultsForBypass], |
| 352 'safebrowsing': [self._metrics.AddResultsForSafebrowsing], | |
| 353 } | 362 } |
| 354 if not self._page.name in page_to_metrics: | 363 if not self._page.name in page_to_metrics: |
| 355 raise page_test.MeasurementFailure( | 364 raise page_test.MeasurementFailure( |
| 356 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( | 365 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( |
| 357 self._page.name, page_to_metrics.keys())) | 366 self._page.name, page_to_metrics.keys())) |
| 358 for add_result in page_to_metrics[self._page.name]: | 367 for add_result in page_to_metrics[self._page.name]: |
| 359 add_result(tab, results) | 368 add_result(tab, results) |
| OLD | NEW |