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 32e9aa3a7e576ba84d2a3da4b664f04be96fd408..4af0670ee9e07d28d934e04a84374ac038d57d34 100644 |
| --- a/tools/chrome_proxy/webdriver/video.py |
| +++ b/tools/chrome_proxy/webdriver/video.py |
| @@ -83,6 +83,59 @@ class Video(IntegrationTest): |
| "metric doesn't match expected! Metric=%s Expected=%f Actual=%f" |
| % (metric, expected[metric], actual), places=None, delta=0.001) |
| + # Check that the compressed video can be seeked. Use a slow network to ensure |
| + # the entire video isn't downloaded before we have a chance to seek. |
| + @Slow |
| + @NotAndroid |
|
RyanSturm
2017/05/22 21:32:01
t.FindElement(By.ID, 'video').click() might work o
Robert Ogden
2017/05/22 21:34:53
this test can't be android because ` with TestDriv
Tom Bergan
2017/05/22 22:18:36
I added a comment explaining why I added control_n
Robert Ogden
2017/05/22 23:00:27
From what I came across implementing the feature,
RyanSturm
2017/05/22 23:09:16
Thanks for the comment. Let's land as is.
|
| + def testVideoSeeking(self): |
| + with TestDriver(control_network_connection=True) as t: |
| + t.SetNetworkConnection("3G") |
| + t.AddChromeArg('--enable-spdy-proxy-auth') |
| + t.LoadURL('http://check.googlezip.net/cacheable/video/buck_bunny_640x360_24fps.html') |
|
RyanSturm
2017/05/22 21:32:02
nit: can you split this over 2 lines (80 char limi
Tom Bergan
2017/05/22 22:18:36
Done.
RyanSturm
2017/05/22 23:09:16
Not seeing the change here.
Tom Bergan
2017/05/22 23:15:14
Done for real.
Tom Bergan
2017/05/22 23:16:47
Err, I fixed the wrong one. Now fixed for real.
|
| + # Play, pause, seek to 1s before the end, play again. |
| + t.ExecuteJavascript( |
| + ''' |
| + window.testDone = false; |
| + const v = document.getElementsByTagName("video")[0]; |
| + let first = true; |
| + v.onplaying = function() { |
| + if (first) { |
| + v.pause(); |
| + first = false; |
| + } else { |
| + window.testDone = true; |
| + } |
| + }; |
| + v.onpause = function() { |
| + if (v.currentTime < v.duration) { |
| + v.currentTime = v.duration-1; |
| + v.play(); |
| + } |
| + }; |
| + v.play(); |
| + ''') |
| + t.WaitForJavascriptExpression('window.testDone', 10) |
| + # Check request was proxied and we got a compressed video back. |
| + # We expect to make multiple requests for the video: ensure they |
| + # all have the same ETag. |
| + video_etag = None |
| + num_range_requests = 0 |
| + for response in t.GetHTTPResponses(): |
| + self.assertHasChromeProxyViaHeader(response) |
| + rh = response.response_headers |
| + if ('content-type' in rh and 'video' in rh['content-type']): |
| + self.assertTrue('etag' in rh), |
| + self.assertEqual('video/webm', rh['content-type']) |
| + if video_etag == None: |
| + video_etag = rh['etag'] |
| + else: |
| + self.assertEqual(video_etag, rh['etag']) |
| + if ('range' in response.request_headers and |
| + response.request_headers['range'] != 'bytes=0-'): |
|
RyanSturm
2017/05/22 21:32:01
Are all the range requests of the form 0-? I thoug
Tom Bergan
2017/05/22 22:18:36
s/num_range_requests/num_partial_requests/
When t
RyanSturm
2017/05/22 23:09:16
Ah I see. I read the condition wrong. Thanks for r
|
| + num_range_requests += 1 |
| + # Also make sure that we had at least one Range request. |
| + self.assertGreaterEqual(num_range_requests, 1) |
| + |
| # Check the frames of a compressed video. |
| @Slow |
| def testVideoFrames(self): |