cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / tools / chrome_proxy / live_tests / chrome_proxy_measurements.py
blob6086697464094280577e28ecebba4ff3e34433c3
1 # Copyright 2015 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 import logging
7 import chrome_proxy_metrics as metrics
8 from telemetry.core import exceptions
9 from telemetry.page import page_test
11 class ChromeProxyLatencyBase(page_test.PageTest):
12 """Chrome latency measurement."""
14 def __init__(self, *args, **kwargs):
15 super(ChromeProxyLatencyBase, self).__init__(*args, **kwargs)
16 self._metrics = metrics.ChromeProxyMetric()
18 def WillNavigateToPage(self, page, tab):
19 tab.ClearCache(force=True)
21 def ValidateAndMeasurePage(self, page, tab, results):
22 # Wait for the load event.
23 tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300)
24 self._metrics.AddResultsForLatency(tab, results)
27 class ChromeProxyLatency(ChromeProxyLatencyBase):
28 """Chrome proxy latency measurement."""
30 def __init__(self, *args, **kwargs):
31 super(ChromeProxyLatency, self).__init__(*args, **kwargs)
33 def CustomizeBrowserOptions(self, options):
34 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
37 class ChromeProxyLatencyDirect(ChromeProxyLatencyBase):
38 """Direct connection latency measurement."""
40 def __init__(self, *args, **kwargs):
41 super(ChromeProxyLatencyDirect, self).__init__(*args, **kwargs)
44 class ChromeProxyDataSavingBase(page_test.PageTest):
45 """Chrome data saving measurement."""
46 def __init__(self, *args, **kwargs):
47 super(ChromeProxyDataSavingBase, self).__init__(*args, **kwargs)
48 self._metrics = metrics.ChromeProxyMetric()
50 def WillNavigateToPage(self, page, tab):
51 tab.ClearCache(force=True)
52 self._metrics.Start(page, tab)
54 def ValidateAndMeasurePage(self, page, tab, results):
55 # Wait for the load event.
56 tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300)
57 self._metrics.Stop(page, tab)
58 self._metrics.AddResultsForDataSaving(tab, results)
61 class ChromeProxyDataSaving(ChromeProxyDataSavingBase):
62 """Chrome proxy data saving measurement."""
64 def __init__(self, *args, **kwargs):
65 super(ChromeProxyDataSaving, self).__init__(*args, **kwargs)
67 def CustomizeBrowserOptions(self, options):
68 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
71 class ChromeProxyDataSavingDirect(ChromeProxyDataSavingBase):
72 """Direct connection data saving measurement."""
74 def __init__(self, *args, **kwargs):
75 super(ChromeProxyDataSavingDirect, self).__init__(*args, **kwargs)