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

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

Issue 2702753002: Add video metrics integration test (Closed)
Patch Set: Use a shorter video 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..ead67e1180fad729a67483a357380c1f0ff41629 100644
--- a/tools/chrome_proxy/webdriver/video.py
+++ b/tools/chrome_proxy/webdriver/video.py
@@ -42,6 +42,37 @@ 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': 3.124,
+ 'webkitDecodedFrameCount': 54.0,
+ 'videoWidth': 1280.0,
+ 'videoHeight': 720.0
+ }
+ with TestDriver() as t:
+ t.AddChromeArg('--enable-spdy-proxy-auth')
+ t.LoadURL('http://check.googlezip.net/cacheable/video/buck_bunny_tiny.html')
+ # Check request was 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.querySelectorAll("video")[0].play()')
+ # Wait for the video to finish playing, plus some headroom.
+ time.sleep(5)
+ # Check each metric against its expected value.
+ for metric in expected:
+ actual = float(t.ExecuteJavascriptStatement(
+ 'document.querySelectorAll("video")[0].%s' % metric))
+ self.assertAlmostEqual(expected[metric], actual, msg="Compressed video "
+ "metric doesn't match expected! Metric=%s Expected=%f Actual=%f"
+ % (metric, expected[metric], actual), places=None, delta=0.001)
+
# 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