OLD | NEW |
| 1 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 2 (Please avoid writing new tests using video-test.js) --> |
1 <script src=video-test.js></script> | 3 <script src=video-test.js></script> |
2 <video poster="content/abe.png"> | 4 <video poster="content/abe.png"> |
3 <source src="content/bogus" type="bogus"> | 5 <source src="content/bogus" type="bogus"> |
4 </video> | 6 </video> |
5 <script> | 7 <script> |
6 findMediaElement(); | 8 findMediaElement(); |
7 | 9 |
8 function listenForWidthAndHeight(expectedWidth, expectedHeight, callback) { | 10 function listenForWidthAndHeight(expectedWidth, expectedHeight, callback) { |
9 if (video.clientWidth == expectedWidth && video.clientHeight == expected
Height) { | 11 if (video.clientWidth == expectedWidth && video.clientHeight == expected
Height) { |
10 callback(); | 12 callback(); |
11 } else { | 13 } else { |
12 // This uses a 20ms sleep loop to accomplish the wait, since the | 14 // This uses a 20ms sleep loop to accomplish the wait, since the |
13 // standard specifies no events that fire on poster load or error. | 15 // standard specifies no events that fire on poster load or error. |
14 window.setTimeout(listenForWidthAndHeight, 20, expectedWidth, expect
edHeight, callback); | 16 window.setTimeout(listenForWidthAndHeight, 20, expectedWidth, expect
edHeight, callback); |
15 } | 17 } |
16 } | 18 } |
17 | 19 |
18 function expected() { | 20 function expected() { |
19 testExpected("video.clientWidth", 76); | 21 testExpected("video.clientWidth", 76); |
20 testExpected("video.clientHeight", 103); | 22 testExpected("video.clientHeight", 103); |
21 endTest(); | 23 endTest(); |
22 } | 24 } |
23 | 25 |
24 run("video.load()"); | 26 run("video.load()"); |
25 waitForEvent("loadstart", function () { | 27 waitForEvent("loadstart", function () { |
26 listenForWidthAndHeight(76, 103, expected); | 28 listenForWidthAndHeight(76, 103, expected); |
27 }); | 29 }); |
28 </script> | 30 </script> |
OLD | NEW |