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 10 matching lines...) Expand all Loading... | |
| 21 def WillNavigateToPage(self, page, tab): | 21 def WillNavigateToPage(self, page, tab): |
| 22 tab.ClearCache(force=True) | 22 tab.ClearCache(force=True) |
| 23 | 23 |
| 24 def ValidateAndMeasurePage(self, page, tab, results): | 24 def ValidateAndMeasurePage(self, page, tab, results): |
| 25 # Wait for the load event. | 25 # Wait for the load event. |
| 26 tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300) | 26 tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300) |
| 27 loading.LoadingMetric().AddResults(tab, results) | 27 loading.LoadingMetric().AddResults(tab, results) |
| 28 | 28 |
| 29 | 29 |
| 30 class ChromeProxyDataSaving(page_test.PageTest): | 30 class ChromeProxyDataSaving(page_test.PageTest): |
| 31 """Chrome proxy data daving measurement.""" | 31 """Chrome proxy data saving measurement.""" |
|
bengr
2015/02/27 23:38:38
:)
megjablon
2015/02/28 00:57:32
Acknowledged.
| |
| 32 def __init__(self, *args, **kwargs): | 32 def __init__(self, *args, **kwargs): |
| 33 super(ChromeProxyDataSaving, self).__init__(*args, **kwargs) | 33 super(ChromeProxyDataSaving, self).__init__(*args, **kwargs) |
| 34 self._metrics = metrics.ChromeProxyMetric() | 34 self._metrics = metrics.ChromeProxyMetric() |
| 35 | 35 |
| 36 def WillNavigateToPage(self, page, tab): | 36 def WillNavigateToPage(self, page, tab): |
| 37 tab.ClearCache(force=True) | 37 tab.ClearCache(force=True) |
| 38 self._metrics.Start(page, tab) | 38 self._metrics.Start(page, tab) |
| 39 | 39 |
| 40 def ValidateAndMeasurePage(self, page, tab, results): | 40 def ValidateAndMeasurePage(self, page, tab, results): |
| 41 # Wait for the load event. | 41 # Wait for the load event. |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 client_type = self._metrics.GetClientTypeFromRequests(tab) | 280 client_type = self._metrics.GetClientTypeFromRequests(tab) |
| 281 if client_type: | 281 if client_type: |
| 282 self._chrome_proxy_client_type = client_type | 282 self._chrome_proxy_client_type = client_type |
| 283 | 283 |
| 284 self._metrics.AddResultsForClientType(tab, | 284 self._metrics.AddResultsForClientType(tab, |
| 285 results, | 285 results, |
| 286 self._chrome_proxy_client_type, | 286 self._chrome_proxy_client_type, |
| 287 self._page.bypass_for_client_type) | 287 self._page.bypass_for_client_type) |
| 288 | 288 |
| 289 | 289 |
| 290 class ChromeProxyLoFi(ChromeProxyValidation): | |
|
bengr
2015/02/27 23:38:38
Add a CustomizeBrowserOptions() with the lofi head
megjablon
2015/02/28 00:57:32
Done.
| |
| 291 """Correctness measurement for lo-fi in Chrome-Proxy header.""" | |
| 292 | |
| 293 def __init__(self): | |
| 294 super(ChromeProxyLoFi, self).__init__(restart_after_each_page=True) | |
| 295 | |
| 296 def AddResults(self, tab, results): | |
| 297 self._metrics.AddResultsForLoFi(tab, results) | |
| 298 | |
| 299 | |
| 290 class ChromeProxyHTTPToDirectFallback(ChromeProxyValidation): | 300 class ChromeProxyHTTPToDirectFallback(ChromeProxyValidation): |
| 291 """Correctness measurement for HTTP proxy fallback to direct.""" | 301 """Correctness measurement for HTTP proxy fallback to direct.""" |
| 292 | 302 |
| 293 def __init__(self): | 303 def __init__(self): |
| 294 super(ChromeProxyHTTPToDirectFallback, self).__init__( | 304 super(ChromeProxyHTTPToDirectFallback, self).__init__( |
| 295 restart_after_each_page=True) | 305 restart_after_each_page=True) |
| 296 | 306 |
| 297 def CustomizeBrowserOptions(self, options): | 307 def CustomizeBrowserOptions(self, options): |
| 298 super(ChromeProxyHTTPToDirectFallback, | 308 super(ChromeProxyHTTPToDirectFallback, |
| 299 self).CustomizeBrowserOptions(options) | 309 self).CustomizeBrowserOptions(options) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 self._metrics.AddResultsForDataSaving, | 368 self._metrics.AddResultsForDataSaving, |
| 359 ], | 369 ], |
| 360 'bypass': [self._metrics.AddResultsForBypass], | 370 'bypass': [self._metrics.AddResultsForBypass], |
| 361 } | 371 } |
| 362 if not self._page.name in page_to_metrics: | 372 if not self._page.name in page_to_metrics: |
| 363 raise page_test.MeasurementFailure( | 373 raise page_test.MeasurementFailure( |
| 364 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( | 374 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( |
| 365 self._page.name, page_to_metrics.keys())) | 375 self._page.name, page_to_metrics.keys())) |
| 366 for add_result in page_to_metrics[self._page.name]: | 376 for add_result in page_to_metrics[self._page.name]: |
| 367 add_result(tab, results) | 377 add_result(tab, results) |
| OLD | NEW |