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.
5 from integration_tests
import chrome_proxy_measurements
as measurements
6 from integration_tests
import chrome_proxy_pagesets
as pagesets
7 from telemetry
import benchmark
8 from telemetry
.core
.backends
.chrome
import android_browser_finder
11 ANDROID_CHROME_BROWSERS
= [
12 browser
for browser
in android_browser_finder
.CHROME_PACKAGE_NAMES
13 if 'webview' not in browser
]
15 class ChromeProxyLatency(benchmark
.Benchmark
):
17 test
= measurements
.ChromeProxyLatency
18 page_set
= pagesets
.Top20PageSet
22 return 'chrome_proxy_benchmark.latency.top_20'
25 class ChromeProxyLatencyDirect(benchmark
.Benchmark
):
26 tag
= 'latency_direct'
27 test
= measurements
.ChromeProxyLatency
28 page_set
= pagesets
.Top20PageSet
32 return 'chrome_proxy_benchmark.latency_direct.top_20'
35 class ChromeProxyLatencySynthetic(ChromeProxyLatency
):
36 page_set
= pagesets
.SyntheticPageSet
40 return 'chrome_proxy_benchmark.latency.synthetic'
43 class ChromeProxyLatencySyntheticDirect(ChromeProxyLatencyDirect
):
44 page_set
= pagesets
.SyntheticPageSet
48 return 'chrome_proxy_benchmark.latency_direct.synthetic'
51 class ChromeProxyDataSaving(benchmark
.Benchmark
):
53 test
= measurements
.ChromeProxyDataSaving
54 page_set
= pagesets
.Top20PageSet
58 return 'chrome_proxy_benchmark.data_saving.top_20'
61 class ChromeProxyDataSavingDirect(benchmark
.Benchmark
):
62 tag
= 'data_saving_direct'
63 test
= measurements
.ChromeProxyDataSaving
64 page_set
= pagesets
.Top20PageSet
68 return 'chrome_proxy_benchmark.data_saving_direct.top_20'
71 class ChromeProxyDataSavingSynthetic(ChromeProxyDataSaving
):
72 page_set
= pagesets
.SyntheticPageSet
76 return 'chrome_proxy_benchmark.data_saving.synthetic'
79 class ChromeProxyDataSavingSyntheticDirect(ChromeProxyDataSavingDirect
):
80 page_set
= pagesets
.SyntheticPageSet
84 return 'chrome_proxy_benchmark.data_saving_direct.synthetic'
87 class ChromeProxyHeaderValidation(benchmark
.Benchmark
):
88 tag
= 'header_validation'
89 test
= measurements
.ChromeProxyHeaders
90 page_set
= pagesets
.Top20PageSet
94 return 'chrome_proxy_benchmark.header_validation.top_20'
97 class ChromeProxyBenchmark(benchmark
.Benchmark
):
99 def AddCommandLineArgs(cls
, parser
):
101 '--extra-chrome-proxy-via-header',
102 type='string', dest
="extra_header",
103 help='Adds an expected Via header for the Chrome-Proxy tests.')
106 def ProcessCommandLineArgs(cls
, parser
, args
):
107 if args
.extra_header
:
108 measurements
.ChromeProxyValidation
.extra_via_header
= args
.extra_header
111 class ChromeProxyClientVersion(ChromeProxyBenchmark
):
112 tag
= 'client_version'
113 test
= measurements
.ChromeProxyClientVersion
114 page_set
= pagesets
.SyntheticPageSet
118 return 'chrome_proxy_benchmark.client_version.synthetic'
121 class ChromeProxyClientType(ChromeProxyBenchmark
):
123 test
= measurements
.ChromeProxyClientType
124 page_set
= pagesets
.ClientTypePageSet
128 return 'chrome_proxy_benchmark.client_type.client_type'
131 class ChromeProxyLoFi(ChromeProxyBenchmark
):
133 test
= measurements
.ChromeProxyLoFi
134 page_set
= pagesets
.LoFiPageSet
138 return 'chrome_proxy_benchmark.lo_fi.lo_fi'
141 class ChromeProxyExpDirective(ChromeProxyBenchmark
):
142 tag
= 'exp_directive'
143 test
= measurements
.ChromeProxyExpDirective
144 page_set
= pagesets
.ExpDirectivePageSet
148 return 'chrome_proxy_benchmark.exp_directive.exp_directive'
151 class ChromeProxyBypass(ChromeProxyBenchmark
):
153 test
= measurements
.ChromeProxyBypass
154 page_set
= pagesets
.BypassPageSet
158 return 'chrome_proxy_benchmark.bypass.bypass'
161 class ChromeProxyCorsBypass(ChromeProxyBenchmark
):
163 test
= measurements
.ChromeProxyCorsBypass
164 page_set
= pagesets
.CorsBypassPageSet
168 return 'chrome_proxy_benchmark.bypass.corsbypass'
171 class ChromeProxyBlockOnce(ChromeProxyBenchmark
):
173 test
= measurements
.ChromeProxyBlockOnce
174 page_set
= pagesets
.BlockOncePageSet
178 return 'chrome_proxy_benchmark.block_once.block_once'
181 @benchmark.Enabled(*ANDROID_CHROME_BROWSERS
)
182 # Safebrowsing is enabled for Android and iOS.
183 class ChromeProxySafeBrowsingOn(ChromeProxyBenchmark
):
184 tag
= 'safebrowsing_on'
185 test
= measurements
.ChromeProxySafebrowsingOn
186 page_set
= pagesets
.SafebrowsingPageSet
190 return 'chrome_proxy_benchmark.safebrowsing_on.safebrowsing'
193 @benchmark.Disabled(*ANDROID_CHROME_BROWSERS
)
194 # Safebrowsing is switched off for Android Webview and all desktop platforms.
195 class ChromeProxySafeBrowsingOff(ChromeProxyBenchmark
):
196 tag
= 'safebrowsing_off'
197 test
= measurements
.ChromeProxySafebrowsingOff
198 page_set
= pagesets
.SafebrowsingPageSet
202 return 'chrome_proxy_benchmark.safebrowsing_off.safebrowsing'
204 class ChromeProxyHTTPFallbackProbeURL(ChromeProxyBenchmark
):
205 tag
= 'fallback_probe'
206 test
= measurements
.ChromeProxyHTTPFallbackProbeURL
207 page_set
= pagesets
.SyntheticPageSet
211 return 'chrome_proxy_benchmark.fallback_probe.synthetic'
214 class ChromeProxyHTTPFallbackViaHeader(ChromeProxyBenchmark
):
215 tag
= 'fallback_viaheader'
216 test
= measurements
.ChromeProxyHTTPFallbackViaHeader
217 page_set
= pagesets
.FallbackViaHeaderPageSet
221 return 'chrome_proxy_benchmark.fallback_viaheader.fallback_viaheader'
224 class ChromeProxyHTTPToDirectFallback(ChromeProxyBenchmark
):
225 tag
= 'http_to_direct_fallback'
226 test
= measurements
.ChromeProxyHTTPToDirectFallback
227 page_set
= pagesets
.HTTPToDirectFallbackPageSet
231 return ('chrome_proxy_benchmark.http_to_direct_fallback.'
232 'http_to_direct_fallback')
235 class ChromeProxyReenableAfterBypass(ChromeProxyBenchmark
):
236 tag
= 'reenable_after_bypass'
237 test
= measurements
.ChromeProxyReenableAfterBypass
238 page_set
= pagesets
.ReenableAfterBypassPageSet
242 return 'chrome_proxy_benchmark.reenable_after_bypass.reenable_after_bypass'
245 class ChromeProxySmoke(ChromeProxyBenchmark
):
247 test
= measurements
.ChromeProxySmoke
248 page_set
= pagesets
.SmokePageSet
252 return 'chrome_proxy_benchmark.smoke.smoke'