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 common import chrome_proxy_measurements as measurements | 9 from common import chrome_proxy_measurements as measurements |
10 from common.chrome_proxy_measurements import ChromeProxyValidation | 10 from common.chrome_proxy_measurements import ChromeProxyValidation |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 super(ChromeProxyCacheProxyDisabled, self).WillNavigateToPage(page, tab) | 408 super(ChromeProxyCacheProxyDisabled, self).WillNavigateToPage(page, tab) |
409 if self._is_chrome_proxy_enabled: | 409 if self._is_chrome_proxy_enabled: |
410 # Clear cache for the first page to pick LoFi image from server. | 410 # Clear cache for the first page to pick LoFi image from server. |
411 tab.ClearCache(force=True) | 411 tab.ClearCache(force=True) |
412 | 412 |
413 def DidNavigateToPage(self, page, tab): | 413 def DidNavigateToPage(self, page, tab): |
414 if not self._is_chrome_proxy_enabled: | 414 if not self._is_chrome_proxy_enabled: |
415 tab.ExecuteJavaScript('window.location.reload()') | 415 tab.ExecuteJavaScript('window.location.reload()') |
416 util.WaitFor(tab.HasReachedQuiescence, 3) | 416 util.WaitFor(tab.HasReachedQuiescence, 3) |
417 | 417 |
418 class ChromeProxyLoFiPreview(ChromeProxyValidation): | 418 class ChromeProxyLitePage(ChromeProxyValidation): |
419 """Correctness measurement for Lo-Fi preview in Chrome-Proxy header.""" | 419 """Correctness measurement for lite pages in the Chrome-Proxy header.""" |
420 | 420 |
421 def __init__(self): | 421 def __init__(self): |
422 super(ChromeProxyLoFiPreview, self).__init__( | 422 super(ChromeProxyLitePage, self).__init__( |
423 restart_after_each_page=True, | 423 restart_after_each_page=True, |
424 metrics=metrics.ChromeProxyMetric()) | 424 metrics=metrics.ChromeProxyMetric()) |
425 | 425 |
426 def CustomizeBrowserOptions(self, options): | 426 def CustomizeBrowserOptions(self, options): |
427 super(ChromeProxyLoFiPreview, self).CustomizeBrowserOptions(options) | 427 super(ChromeProxyLitePage, self).CustomizeBrowserOptions(options) |
428 options.AppendExtraBrowserArgs( | 428 options.AppendExtraBrowserArgs( |
429 '--data-reduction-proxy-lo-fi=always-on') | 429 '--data-reduction-proxy-lo-fi=always-on') |
430 options.AppendExtraBrowserArgs( | 430 options.AppendExtraBrowserArgs( |
431 '--enable-data-reduction-proxy-lo-fi-preview') | 431 '--enable-data-reduction-proxy-lite-page') |
432 options.AppendExtraBrowserArgs('--disable-quic') | 432 options.AppendExtraBrowserArgs('--disable-quic') |
433 | 433 |
434 def AddResults(self, tab, results): | 434 def AddResults(self, tab, results): |
435 self._metrics.AddResultsForLoFiPreview(tab, results) | 435 self._metrics.AddResultsForLitePage(tab, results) |
436 | 436 |
437 class ChromeProxyExpDirective(ChromeProxyValidation): | 437 class ChromeProxyExpDirective(ChromeProxyValidation): |
438 """Correctness measurement for experiment directives in Chrome-Proxy header. | 438 """Correctness measurement for experiment directives in Chrome-Proxy header. |
439 | 439 |
440 This test verifies that "exp=test" in the Chrome-Proxy request header | 440 This test verifies that "exp=test" in the Chrome-Proxy request header |
441 causes a bypass on the experiment test page. | 441 causes a bypass on the experiment test page. |
442 """ | 442 """ |
443 | 443 |
444 def __init__(self): | 444 def __init__(self): |
445 super(ChromeProxyExpDirective, self).__init__( | 445 super(ChromeProxyExpDirective, self).__init__( |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 if self._enable_proxy: | 794 if self._enable_proxy: |
795 measurements.WaitForViaHeader(tab) | 795 measurements.WaitForViaHeader(tab) |
796 tab.ClearCache(force=True) | 796 tab.ClearCache(force=True) |
797 self._metrics.Start(page, tab) | 797 self._metrics.Start(page, tab) |
798 | 798 |
799 def ValidateAndMeasurePage(self, page, tab, results): | 799 def ValidateAndMeasurePage(self, page, tab, results): |
800 # Wait for the load event. | 800 # Wait for the load event. |
801 tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300) | 801 tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300) |
802 self._metrics.Stop(page, tab) | 802 self._metrics.Stop(page, tab) |
803 self._metrics.AddResultsForQuicTransaction(tab, results) | 803 self._metrics.AddResultsForQuicTransaction(tab, results) |
OLD | NEW |