OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
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 | 7 |
6 | 8 |
7 <script> | 9 <script> |
8 function loadedmetadata() | 10 function loadedmetadata() |
9 { | 11 { |
10 failTest(relativeURL(video.currentSrc) + "loaded but should not"
); | 12 failTest(relativeURL(video.currentSrc) + "loaded but should not"
); |
11 consoleWrite(""); | 13 consoleWrite(""); |
12 } | 14 } |
13 | 15 |
14 function errorEvent() | 16 function errorEvent() |
15 { | 17 { |
16 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SU
PPORTED); | 18 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SU
PPORTED); |
17 | 19 |
18 // "setTimeout()" is generally bad form in a layout test, but we
need to verify | 20 // "setTimeout()" is generally bad form in a layout test, but we
need to verify |
19 // that changing the 'src' attribute does not do something that
happens | 21 // that changing the 'src' attribute does not do something that
happens |
20 // asynchronously so we don't have a lot of options. | 22 // asynchronously so we don't have a lot of options. |
21 setTimeout(function () { endTest(); }, 200) ; | 23 setTimeout(function () { endTest(); }, 200) ; |
22 run("video.removeAttribute('src')"); | 24 run("video.removeAttribute('src')"); |
23 consoleWrite(""); | 25 consoleWrite(""); |
24 } | 26 } |
25 | 27 |
26 function setup() | 28 function setup() |
27 { | 29 { |
28 findMediaElement(); | 30 findMediaElement(); |
29 | 31 |
30 video.src = "bogus.mov"; | 32 video.src = "bogus.mov"; |
31 | 33 |
32 var source = document.createElement("source"); | 34 var source = document.createElement("source"); |
33 source.setAttribute("src", findMediaFile("video", "content/test"
)); | 35 source.setAttribute("src", findMediaFile("video", "content/test"
)); |
34 video.appendChild(source); | 36 video.appendChild(source); |
35 | 37 |
36 waitForEvent('loadedmetadata', loadedmetadata); | 38 waitForEvent('loadedmetadata', loadedmetadata); |
37 waitForEvent('error', errorEvent); | 39 waitForEvent('error', errorEvent); |
38 consoleWrite(""); | 40 consoleWrite(""); |
39 } | 41 } |
40 | 42 |
41 </script> | 43 </script> |
42 </head> | 44 </head> |
43 <body onload="setup()"> | 45 <body onload="setup()"> |
44 | 46 |
45 <video controls></video> | 47 <video controls></video> |
46 | 48 |
47 <p>Test that removing 'src' attribute does NOT trigger load of <source>
; elements</p> | 49 <p>Test that removing 'src' attribute does NOT trigger load of <source>
; elements</p> |
48 | 50 |
49 <script> | 51 <script> |
50 | 52 |
51 </script> | 53 </script> |
52 | 54 |
53 </body> | 55 </body> |
54 </html> | 56 </html> |
OLD | NEW |