Chromium Code Reviews| 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..eb32d6004b1b5f4b5a832c8d38a2d06ac3ae6e0d 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, |
| + '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) |
|
RyanSturm
2017/02/17 19:24:10
What is the impact of having a test that takes 80
Robert Ogden
2017/02/17 19:28:18
The test harness itself it happy to wait, but yes
Tom Bergan
2017/02/17 20:10:56
We should be able to use a shorter video. No reaso
bolian
2017/02/17 20:21:57
I am not sure how the test works internally. At le
|
| + # Check each metric against its expected value. |
| + for metric in expected: |
| + actual = float(t.ExecuteJavascriptStatement( |
| + 'document.getElementById("video").%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.25) |
| + |
| # Check the frames of a compressed video. |
| def testVideoFrames(self): |
| self.instrumentedVideoTest('http://check.googlezip.net/cacheable/video/buck_bunny_640x360_24fps_video.html') |