Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py

Issue 1065763002: Add data reduction proxy integration tests for video compression. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes for reviewer comments. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py
diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py b/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py
index ee756192ee29968c9c5c94d6f6b2f95f83de2ff6..6dc799d65c479ad92af5b094a04a44cbfad44df1 100644
--- a/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py
+++ b/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py
@@ -18,9 +18,11 @@ class ChromeProxyLatency(page_test.PageTest):
def __init__(self, *args, **kwargs):
super(ChromeProxyLatency, self).__init__(*args, **kwargs)
self._metrics = metrics.ChromeProxyMetric()
+ self._enable_proxy = True
def CustomizeBrowserOptions(self, options):
- options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
+ if self._enable_proxy:
+ options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
def WillNavigateToPage(self, page, tab):
tab.ClearCache(force=True)
@@ -31,14 +33,23 @@ class ChromeProxyLatency(page_test.PageTest):
self._metrics.AddResultsForLatency(tab, results)
+class DirectFetchLatency(ChromeProxyLatency):
sclittle 2015/04/10 23:01:49 Maybe name this ChromeProxyLatencyDirect to be con
Tom Bergan 2015/04/10 23:41:05 Done.
+ """Direct fetch latency measurement."""
+ def __init__(self, *args, **kwargs):
+ super(DirectFetchLatency, self).__init__(*args, **kwargs)
+ self._enable_proxy = False
+
+
class ChromeProxyDataSaving(page_test.PageTest):
"""Chrome proxy data saving measurement."""
def __init__(self, *args, **kwargs):
super(ChromeProxyDataSaving, self).__init__(*args, **kwargs)
self._metrics = metrics.ChromeProxyMetric()
+ self._enable_proxy = True
def CustomizeBrowserOptions(self, options):
- options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
+ if self._enable_proxy:
+ options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
def WillNavigateToPage(self, page, tab):
tab.ClearCache(force=True)
@@ -51,6 +62,13 @@ class ChromeProxyDataSaving(page_test.PageTest):
self._metrics.AddResultsForDataSaving(tab, results)
+class DirectFetchDataSaving(ChromeProxyDataSaving):
+ """Direct fetch data saving measurement."""
+ def __init__(self, *args, **kwargs):
+ super(DirectFetchDataSaving, self).__init__(*args, **kwargs)
+ self._enable_proxy = False
+
+
class ChromeProxyValidation(page_test.PageTest):
"""Base class for all chrome proxy correctness measurements."""
@@ -389,3 +407,65 @@ class ChromeProxySmoke(ChromeProxyValidation):
self._page.name, page_to_metrics.keys()))
for add_result in page_to_metrics[self._page.name]:
add_result(tab, results)
+
+
+class ChromeProxyVideoValidation(page_test.PageTest):
+ """Video correctness measurements."""
sclittle 2015/04/10 23:01:49 Please add more detailed description.
Tom Bergan 2015/04/10 23:41:05 Done.
+
+ def __init__(self):
+ super(ChromeProxyVideoValidation, self).__init__(
+ needs_browser_restart_after_each_page=True,
+ clear_cache_before_each_run=True)
+ self._allMetrics = {}
sclittle 2015/04/10 23:01:49 Please add a comment describing what _allMetrics i
Tom Bergan 2015/04/10 23:41:05 Done.
+
+ def CustomizeBrowserOptionsForSinglePage(self, page, options):
+ if page.use_chrome_proxy:
+ options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
+
+ def DidNavigateToPage(self, page, tab):
+ self._currMetrics = metrics.ChromeProxyVideoMetric(tab)
+ self._currMetrics.Start(page, tab)
+
+ def ValidateAndMeasurePage(self, page, tab, results):
+ assert self._currMetrics
+ self._currMetrics.Stop(page, tab)
+ if page.url not in self._allMetrics:
+ self._allMetrics[page.url] = {}
+ # Verify this page.
sclittle 2015/04/10 23:01:49 nit: the code in this method looks dense, could yo
Tom Bergan 2015/04/10 23:41:05 Done.
+ if page.use_chrome_proxy:
+ self._currMetrics.AddResultsForProxied(tab, results)
+ self._allMetrics[page.url]['proxied'] = self._currMetrics.videoMetrics
+ else:
+ self._currMetrics.AddResultsForDirect(tab, results)
+ self._allMetrics[page.url]['direct'] = self._currMetrics.videoMetrics
+ self._currMetrics = None
+ # Compare proxied and direct results for this url, if they exist.
+ m = self._allMetrics[page.url]
+ if 'proxied' in m and 'direct' in m:
+ self._CompareProxiedAndDirectMetrics(page.url, m['proxied'], m['direct'])
+
+ def _CompareProxiedAndDirectMetrics(self, url, pm, dm):
sclittle 2015/04/10 23:01:49 What is this method for? Please add a comment
Tom Bergan 2015/04/10 23:41:05 Done.
+ def err(s):
+ raise ChromeProxyMetricException, s
+
+ if not pm['ready']:
+ err('Proxied page did not load video: %s' % page.url)
+ if not dm['ready']:
+ err('Direct page did not load video: %s' % page.url)
+
+ for x in ('video_height', 'video_width', 'video_duration',
sclittle 2015/04/10 23:01:49 Add a comment describing the purpose of this for l
Tom Bergan 2015/04/10 23:41:05 Done.
+ 'decoded_frames'):
+ if x not in pm:
+ err('Proxied page has no %s: %s' % (x, page.url))
+ if x not in dm:
+ err('Direct page has no %s: %s' % (x, page.url))
+ if pm[x] != dm[x]:
+ err('Mismatch for %s (proxied=%s direct=%s): %s' %
+ (x, str(pm[x]), str(dm[x]), page.url))
+
+ # Proxied XOCL should match direct CL.
+ pxocl = pm['x_original_content_length_header']
+ dcl = dm['content_length_header']
+ if pxocl != dcl:
+ err('Mismatch for content length (proxied=%s direct=%s): %s' %
+ (str(pxocl), str(dcl), page.url))

Powered by Google App Engine
This is Rietveld 408576698