diff options
author | harringtond <harringtond@google.com> | 2015-06-24 13:22:47 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-24 20:23:21 +0000 |
commit | cd1a2566e50e689086adb6bae94ccec4d334406b (patch) | |
tree | b90fc50bc046e96d2fcb41a22f1880d0157ada27 /tools/chrome_proxy | |
parent | 0ca257319cd07dd7289921e10e964578fbdac368 (diff) | |
download | chromium_src-cd1a2566e50e689086adb6bae94ccec4d334406b.zip chromium_src-cd1a2566e50e689086adb6bae94ccec4d334406b.tar.gz chromium_src-cd1a2566e50e689086adb6bae94ccec4d334406b.tar.bz2 |
added tests for chrome proxy video transcoder
BUG=
Review URL: https://codereview.chromium.org/1209443004
Cr-Commit-Position: refs/heads/master@{#335987}
Diffstat (limited to 'tools/chrome_proxy')
4 files changed, 95 insertions, 2 deletions
diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_benchmark.py b/tools/chrome_proxy/integration_tests/chrome_proxy_benchmark.py index 8607eea..693c176 100644 --- a/tools/chrome_proxy/integration_tests/chrome_proxy_benchmark.py +++ b/tools/chrome_proxy/integration_tests/chrome_proxy_benchmark.py @@ -217,3 +217,28 @@ class ChromeProxyVideoCompare(benchmark.Benchmark): @classmethod def Name(cls): return 'chrome_proxy_benchmark.video.compare' + +@benchmark.Enabled('desktop') +class ChromeProxyVideoFrames(benchmark.Benchmark): + """Check for video frames similar to original video.""" + + tag = 'video' + test = measurements.ChromeProxyInstrumentedVideoValidation + page_set = pagesets.VideoFramePageSet + + @classmethod + def Name(cls): + return 'chrome_proxy_benchmark.video.frames' + +@benchmark.Enabled('desktop') +class ChromeProxyVideoAudio(benchmark.Benchmark): + """Check that audio is similar to original video.""" + + tag = 'video' + test = measurements.ChromeProxyInstrumentedVideoValidation + page_set = pagesets.VideoAudioPageSet + + @classmethod + def Name(cls): + return 'chrome_proxy_benchmark.video.audio' + diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py b/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py index dbb9aae..9632860 100644 --- a/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py +++ b/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py @@ -414,7 +414,6 @@ class ChromeProxyVideoValidation(page_test.PageTest): def CustomizeBrowserOptionsForSinglePage(self, page, options): if page.use_chrome_proxy: options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') - options.AppendExtraBrowserArgs('--data-reduction-proxy-experiment=video') def DidNavigateToPage(self, page, tab): self._currMetrics = metrics.ChromeProxyVideoMetric(tab) @@ -479,3 +478,23 @@ class ChromeProxyVideoValidation(page_test.PageTest): if pxocl != dcl: err('Mismatch for content length (proxied=%s direct=%s): %s' % (str(pxocl), str(dcl), page.url)) + +class ChromeProxyInstrumentedVideoValidation(page_test.PageTest): + """Tests a specially instrumented page for correct video transcoding.""" + + def __init__(self): + super(ChromeProxyInstrumentedVideoValidation, self).__init__( + needs_browser_restart_after_each_page=True, + clear_cache_before_each_run=True) + self._metrics = metrics.ChromeProxyInstrumentedVideoMetric() + + def CustomizeBrowserOptions(self, options): + options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') + + def WillNavigateToPage(self, page, tab): + tab.ClearCache(force=True) + self._metrics.Start(page, tab) + + def ValidateAndMeasurePage(self, page, tab, results): + self._metrics.Stop(page, tab) + self._metrics.AddResults(tab, results) diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py index 7966a93..b25020d 100644 --- a/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py +++ b/tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py @@ -11,7 +11,7 @@ from common import network_metrics from common.chrome_proxy_metrics import ChromeProxyMetricException from telemetry.page import page_test from telemetry.value import scalar - +from metrics import Metric class ChromeProxyMetric(network_metrics.NetworkMetric): """A Chrome proxy timeline metric.""" @@ -705,6 +705,30 @@ class ChromeProxyVideoMetric(network_metrics.NetworkMetric): k = "%s_%s" % (k, kind) results.AddValue(scalar.ScalarValue(results.current_page, k, "", v)) +class ChromeProxyInstrumentedVideoMetric(Metric): + """Metric for pages instrumented to evaluate video transcoding.""" + def __init__(self): + super(ChromeProxyInstrumentedVideoMetric, self).__init__() + + def Stop(self, page, tab): + waitTime = tab.EvaluateJavaScript('test.waitTime') + tab.WaitForJavaScriptExpression('test.metrics.complete', waitTime) + super(ChromeProxyInstrumentedVideoMetric, self).Stop(page, tab) + + def AddResults(self, tab, results): + metrics = tab.EvaluateJavaScript('test.metrics') + for (k,v) in metrics.iteritems(): + results.AddValue(scalar.ScalarValue(results.current_page, k, '', v)) + try: + complete = metrics['complete'] + failed = metrics['failed'] + if not complete: + raise ChromeProxyMetricException, 'Test not complete' + if failed: + raise ChromeProxyMetricException, 'failed' + except KeyError: + raise ChromeProxyMetricException, 'No metrics found' + # Returns whether |url| is a block-once test URL. Data Reduction Proxy has been # configured to always return block-once for these URLs. def IsTestUrlForBlockOnce(url): diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/video_instrumented.py b/tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/video_instrumented.py new file mode 100644 index 0000000..7465317 --- /dev/null +++ b/tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/video_instrumented.py @@ -0,0 +1,25 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from telemetry.page import page as page_module +from telemetry.page import page_set as page_set_module + +class VideoFramePageSet(page_set_module.PageSet): + """Chrome proxy video tests: verify frames of transcoded videos""" + def __init__(self): + super(VideoFramePageSet, self).__init__() + for url in [ + 'http://check.googlezip.net/cacheable/video/buck_bunny_640x360_24fps_video.html', + 'http://check.googlezip.net/cacheable/video/buck_bunny_60fps_video.html', + ]: + self.AddUserStory(page_module.Page(url, self)) + +class VideoAudioPageSet(page_set_module.PageSet): + """Chrome proxy video tests: verify audio of transcoded videos""" + def __init__(self): + super(VideoAudioPageSet, self).__init__() + for url in [ + 'http://check.googlezip.net/cacheable/video/buck_bunny_640x360_24fps_audio.html', + ]: + self.AddUserStory(page_module.Page(url, self)) |