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

Unified Diff: tools/chrome_proxy/webdriver/video.py

Issue 2702753002: Add video metrics integration test (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/chrome_proxy/webdriver/video.py
diff --git a/tools/chrome_proxy/webdriver/video.py b/tools/chrome_proxy/webdriver/video.py
index 9755e045fe301cdb0a298feb976dca399dfbb03f..321d404e8d8bd1d05a0a135653113b348630756a 100644
--- a/tools/chrome_proxy/webdriver/video.py
+++ b/tools/chrome_proxy/webdriver/video.py
@@ -42,6 +42,36 @@ class Video(IntegrationTest):
self.assertHasChromeProxyViaHeader(response)
self.assertTrue(saw_video_response, 'No video request seen in test!')
+ # Check the compressed video has the same frame count, width, height, and
+ # duration as uncompressed.
+ def testVideoMetrics(self):
+ expected = {
+ 'duration': 60.127,
Tom Bergan 2017/02/17 18:20:48 I haven't done the math, but at first glance, this
Robert Ogden 2017/02/17 18:49:28 Done.
RyanSturm 2017/02/17 19:24:10 As a nit on a nit, delta=0.25 is way, way bigger t
Robert Ogden 2017/02/17 19:28:18 Done.
+ 'webkitDecodedFrameCount': 1080.0,
+ 'videoWidth': 640.0,
+ 'videoHeight': 360.0
+ }
+ with TestDriver() as t:
+ t.AddChromeArg('--enable-spdy-proxy-auth')
+ t.LoadURL('http://check.googlezip.net/cacheable/video/buck_bunny_640x360_24fps_video.html')
+ # Check request vwas proxied and we got a compressed video back.
+ for response in t.GetHTTPResponses():
+ self.assertHasChromeProxyViaHeader(response)
+ if ('content-type' in response.response_headers
+ and 'video' in response.response_headers['content-type']):
+ self.assertEqual('video/webm',
+ response.response_headers['content-type'])
+ t.ExecuteJavascriptStatement('document.getElementById("video").play()')
+ # Wait for the video to finish playing, plus some headroom.
+ time.sleep(80)
+ # Check each metric against its expected value.
+ for metric in expected:
+ actual = float(t.ExecuteJavascriptStatement(
+ 'document.getElementById("video").%s' % metric))
+ self.assertEqual(expected[metric], actual, "Compressed video metric "
+ "doesn't match expected! Metric=%s Expected=%f Actual=%f"
+ % (metric, expected[metric], actual))
+
# Check the frames of a compressed video.
def testVideoFrames(self):
self.instrumentedVideoTest('http://check.googlezip.net/cacheable/video/buck_bunny_640x360_24fps_video.html')
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698