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.
7 import chrome_proxy_metrics
as metrics
8 from telemetry
.core
import exceptions
9 from telemetry
.page
import page_test
11 class ChromeProxyLatency(page_test
.PageTest
):
12 """Chrome proxy latency measurement."""
14 def __init__(self
, *args
, **kwargs
):
15 super(ChromeProxyLatency
, self
).__init
__(*args
, **kwargs
)
16 self
._metrics
= metrics
.ChromeProxyMetric()
18 def CustomizeBrowserOptions(self
, options
):
19 options
.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
21 def WillNavigateToPage(self
, page
, tab
):
22 tab
.ClearCache(force
=True)
24 def ValidateAndMeasurePage(self
, page
, tab
, results
):
25 # Wait for the load event.
26 tab
.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300)
27 self
._metrics
.AddResultsForLatency(tab
, results
)
30 class ChromeProxyDataSaving(page_test
.PageTest
):
31 """Chrome proxy data saving measurement."""
32 def __init__(self
, *args
, **kwargs
):
33 super(ChromeProxyDataSaving
, self
).__init
__(*args
, **kwargs
)
34 self
._metrics
= metrics
.ChromeProxyMetric()
36 def CustomizeBrowserOptions(self
, options
):
37 options
.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
39 def WillNavigateToPage(self
, page
, tab
):
40 tab
.ClearCache(force
=True)
41 self
._metrics
.Start(page
, tab
)
43 def ValidateAndMeasurePage(self
, page
, tab
, results
):
44 # Wait for the load event.
45 tab
.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300)
46 self
._metrics
.Stop(page
, tab
)
47 self
._metrics
.AddResultsForDataSaving(tab
, results
)