OLD | NEW |
1 <html> | 1 <html> |
2 <body> | 2 <body> |
3 <script src=media-file.js></script> | 3 <script src=media-file.js></script> |
| 4 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 5 (Please avoid writing new tests using video-test.js) --> |
4 <script src=video-test.js></script> | 6 <script src=video-test.js></script> |
5 <div id=panel></div> | 7 <div id=panel></div> |
6 <script> | 8 <script> |
7 var panel = document.getElementById("panel"); | 9 var panel = document.getElementById("panel"); |
8 var mediaFile = findMediaFile("video", "content/test"); | 10 var mediaFile = findMediaFile("video", "content/test"); |
9 panel.innerHTML = "<video src=" + mediaFile + " controls onloadedmetadat
a='loadedmetadata()'><source src=content/counting.mp4></video>"; | 11 panel.innerHTML = "<video src=" + mediaFile + " controls onloadedmetadat
a='loadedmetadata()'><source src=content/counting.mp4></video>"; |
10 </script> | 12 </script> |
11 | 13 |
12 <p>Test that removing valid 'src' attribute DOES NOT trigger load of <sou
rce> elements</p> | 14 <p>Test that removing valid 'src' attribute DOES NOT trigger load of <sou
rce> elements</p> |
13 | 15 |
14 <script> | 16 <script> |
15 findMediaElement(); | 17 findMediaElement(); |
16 | 18 |
17 var loadCount = 0; | 19 var loadCount = 0; |
18 | 20 |
19 function testSrc() | 21 function testSrc() |
20 { | 22 { |
21 testExpected("stripExtension(relativeURL(video.currentSrc))", stripE
xtension(mediaFile)); | 23 testExpected("stripExtension(relativeURL(video.currentSrc))", stripE
xtension(mediaFile)); |
22 testExpected("isNaN(video.duration)", false); | 24 testExpected("isNaN(video.duration)", false); |
23 consoleWrite(""); | 25 consoleWrite(""); |
24 } | 26 } |
25 | 27 |
26 function loadedmetadata() | 28 function loadedmetadata() |
27 { | 29 { |
28 consoleWrite("EVENT(loadedmetadata)"); | 30 consoleWrite("EVENT(loadedmetadata)"); |
29 | 31 |
30 ++loadCount; | 32 ++loadCount; |
31 if (loadCount == 1) | 33 if (loadCount == 1) |
32 { | 34 { |
33 testSrc(); | 35 testSrc(); |
34 run("video.removeAttribute('src')"); | 36 run("video.removeAttribute('src')"); |
35 } | 37 } |
36 else | 38 else |
37 { | 39 { |
38 consoleWrite("<span style='color:red'>FAIL</span> : 'loadCount'
fired " + loadCount + "times" ); | 40 consoleWrite("<span style='color:red'>FAIL</span> : 'loadCount'
fired " + loadCount + "times" ); |
39 endTest(); | 41 endTest(); |
40 } | 42 } |
41 consoleWrite(""); | 43 consoleWrite(""); |
42 setTimeout(someTimeLater, 100) ; | 44 setTimeout(someTimeLater, 100) ; |
43 } | 45 } |
44 | 46 |
45 function someTimeLater() | 47 function someTimeLater() |
46 { | 48 { |
47 testSrc(); | 49 testSrc(); |
48 endTest(); | 50 endTest(); |
49 consoleWrite(""); | 51 consoleWrite(""); |
50 } | 52 } |
51 | 53 |
52 consoleWrite(""); | 54 consoleWrite(""); |
53 </script> | 55 </script> |
54 | 56 |
55 </body> | 57 </body> |
56 </html> | 58 </html> |
OLD | NEW |