OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from integration_tests import chrome_proxy_measurements as measurements |
| 6 from integration_tests import chrome_proxy_metrics as metrics |
| 7 from telemetry.page import page as page_module |
| 8 from telemetry.page import page_set as page_set_module |
| 9 |
| 10 |
| 11 class ExplicitBypassPage(page_module.Page): |
| 12 """A test page for the explicit bypass tests. |
| 13 |
| 14 Attributes: |
| 15 num_bypassed_proxies: The number of proxies that should be bypassed as a |
| 16 direct result of loading this test page. 1 indicates that only the |
| 17 primary data reduction proxy should be bypassed, while 2 indicates |
| 18 that both the primary and fallback data reduction proxies should be |
| 19 bypassed. |
| 20 bypass_seconds_low: The minimum number of seconds that the bypass |
| 21 triggered by loading this page should last. |
| 22 bypass_seconds_high: The maximum number of seconds that the bypass |
| 23 triggered by loading this page should last. |
| 24 """ |
| 25 |
| 26 def __init__(self, |
| 27 url, |
| 28 page_set, |
| 29 num_bypassed_proxies, |
| 30 bypass_seconds_low, |
| 31 bypass_seconds_high): |
| 32 super(ExplicitBypassPage, self).__init__(url=url, page_set=page_set) |
| 33 self.num_bypassed_proxies = num_bypassed_proxies |
| 34 self.bypass_seconds_low = bypass_seconds_low |
| 35 self.bypass_seconds_high = bypass_seconds_high |
| 36 |
| 37 |
| 38 class ExplicitBypassPageSet(page_set_module.PageSet): |
| 39 """ Chrome proxy test sites """ |
| 40 |
| 41 def __init__(self): |
| 42 super(ExplicitBypassPageSet, self).__init__() |
| 43 |
| 44 # Test page for "Chrome-Proxy: bypass=0". |
| 45 self.AddPage(ExplicitBypassPage( |
| 46 url=measurements.GetResponseOverrideURL( |
| 47 respHeader='{"Chrome-Proxy":["bypass=0"],' |
| 48 '"Via":["1.1 Chrome-Compression-Proxy"]}'), |
| 49 page_set=self, |
| 50 num_bypassed_proxies=1, |
| 51 bypass_seconds_low=metrics.DEFAULT_BYPASS_MIN_SECONDS, |
| 52 bypass_seconds_high=metrics.DEFAULT_BYPASS_MAX_SECONDS)) |
| 53 |
| 54 # Test page for "Chrome-Proxy: bypass=3600". |
| 55 self.AddPage(ExplicitBypassPage( |
| 56 url=measurements.GetResponseOverrideURL( |
| 57 respHeader='{"Chrome-Proxy":["bypass=3600"],' |
| 58 '"Via":["1.1 Chrome-Compression-Proxy"]}'), |
| 59 page_set=self, |
| 60 num_bypassed_proxies=1, |
| 61 bypass_seconds_low=3600, |
| 62 bypass_seconds_high=3600)) |
| 63 |
| 64 # Test page for "Chrome-Proxy: block=0". |
| 65 self.AddPage(ExplicitBypassPage( |
| 66 url=measurements.GetResponseOverrideURL( |
| 67 respHeader='{"Chrome-Proxy":["block=0"],' |
| 68 '"Via":["1.1 Chrome-Compression-Proxy"]}'), |
| 69 page_set=self, |
| 70 num_bypassed_proxies=2, |
| 71 bypass_seconds_low=metrics.DEFAULT_BYPASS_MIN_SECONDS, |
| 72 bypass_seconds_high=metrics.DEFAULT_BYPASS_MAX_SECONDS)) |
| 73 |
| 74 # Test page for "Chrome-Proxy: block=3600". |
| 75 self.AddPage(ExplicitBypassPage( |
| 76 url=measurements.GetResponseOverrideURL( |
| 77 respHeader='{"Chrome-Proxy":["block=3600"],' |
| 78 '"Via":["1.1 Chrome-Compression-Proxy"]}'), |
| 79 page_set=self, |
| 80 num_bypassed_proxies=2, |
| 81 bypass_seconds_low=3600, |
| 82 bypass_seconds_high=3600)) |
OLD | NEW |