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 | 7 |
| 8 from common import chrome_proxy_metrics as metrics | 8 from common import chrome_proxy_metrics as metrics |
| 9 from telemetry.core import exceptions | 9 from telemetry.core import exceptions |
| 10 from telemetry.page import page_test | 10 from telemetry.page import page_test |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 needs_browser_restart_after_each_page=restart_after_each_page, | 73 needs_browser_restart_after_each_page=restart_after_each_page, |
| 74 clear_cache_before_each_run=clear_cache_before_each_run) | 74 clear_cache_before_each_run=clear_cache_before_each_run) |
| 75 self._metrics = metrics | 75 self._metrics = metrics |
| 76 self._page = None | 76 self._page = None |
| 77 | 77 |
| 78 def CustomizeBrowserOptions(self, options): | 78 def CustomizeBrowserOptions(self, options): |
| 79 # Enable the chrome proxy (data reduction proxy). | 79 # Enable the chrome proxy (data reduction proxy). |
| 80 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') | 80 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') |
| 81 self._is_chrome_proxy_enabled = True | 81 self._is_chrome_proxy_enabled = True |
| 82 | 82 |
| 83 # Disable quic option, otherwise request headers won't be visible. | |
| 84 options.AppendExtraBrowserArgs('--disable-quic') | |
|
bustamante
2016/09/21 18:50:12
I think we need this for every test, since the qui
RyanSturm
2016/09/21 18:56:24
I think he adds the command individually to the te
bustamante
2016/09/21 19:11:42
All tests can do header validation if the --extra-
tbansal1
2016/09/22 17:25:42
Looking at AddResultsForExtraViaHeader function, i
| |
| 85 | |
| 86 def DisableChromeProxy(self): | 83 def DisableChromeProxy(self): |
| 87 self.options.browser_options.extra_browser_args.discard( | 84 self.options.browser_options.extra_browser_args.discard( |
| 88 '--enable-spdy-proxy-auth') | 85 '--enable-spdy-proxy-auth') |
| 89 self._is_chrome_proxy_enabled = False | 86 self._is_chrome_proxy_enabled = False |
| 90 | 87 |
| 91 def WillNavigateToPage(self, page, tab): | 88 def WillNavigateToPage(self, page, tab): |
| 92 if self._is_chrome_proxy_enabled: | 89 if self._is_chrome_proxy_enabled: |
| 93 WaitForViaHeader(tab) | 90 WaitForViaHeader(tab) |
| 94 | 91 |
| 95 if self.clear_cache_before_each_run: | 92 if self.clear_cache_before_each_run: |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 108 tab, results, ChromeProxyValidation.extra_via_header) | 105 tab, results, ChromeProxyValidation.extra_via_header) |
| 109 self.AddResults(tab, results) | 106 self.AddResults(tab, results) |
| 110 | 107 |
| 111 def AddResults(self, tab, results): | 108 def AddResults(self, tab, results): |
| 112 raise NotImplementedError | 109 raise NotImplementedError |
| 113 | 110 |
| 114 def StopBrowserAfterPage(self, browser, page): # pylint: disable=W0613 | 111 def StopBrowserAfterPage(self, browser, page): # pylint: disable=W0613 |
| 115 if hasattr(page, 'restart_after') and page.restart_after: | 112 if hasattr(page, 'restart_after') and page.restart_after: |
| 116 return True | 113 return True |
| 117 return False | 114 return False |
| OLD | NEW |