OLD | NEW |
1 <!doctype html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test that a single valid "source" element loads correctly.</title> |
3 <head> | 3 <script src="../resources/testharness.js"></script> |
4 <script src=media-file.js></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 5 <script src="media-file.js"></script> |
6 (Please avoid writing new tests using video-test.js) --> | 6 <video></video> |
7 <script src=video-test.js></script> | 7 <script> |
| 8 async_test(function(t) { |
| 9 var video = document.querySelector("video"); |
8 | 10 |
9 <script> | 11 // The first source should load. |
| 12 var source = document.createElement("source"); |
| 13 source.src = findMediaFile("video", "content/test");; |
| 14 video.appendChild(source); |
10 | 15 |
11 function errorEvent() | 16 // The second source is bogus and won't load, but it should never be process
ed. |
12 { | 17 source = document.createElement("source"); |
13 logResult(false, "*** \"" + relativeURL(video.currentSrc) + "\"
should not have been processed!" ); | 18 source.src = "content/does-not-exist"; |
14 consoleWrite(""); | 19 source.onerror = t.unreached_func(); |
15 endTest(); | 20 video.appendChild(source); |
16 } | |
17 | 21 |
18 function setup() | 22 video.onloadedmetadata = t.step_func_done(); |
19 { | 23 }); |
20 video = document.createElement("video"); | 24 </script> |
21 video.setAttribute("controls", "controls"); | |
22 | |
23 // The first source should load. | |
24 var source = document.createElement("source"); | |
25 source.setAttribute("src", findMediaFile("video", "content/test"
)); | |
26 source.setAttribute("type", mimeTypeForFile(source.getAttribute(
"src"))); | |
27 video.appendChild(source); | |
28 | |
29 // The second source is bogus and won't load, but it should neve
r be processed. | |
30 source = document.createElement("source"); | |
31 source.setAttribute("src", findMediaFile("video", "content/does-
not-exist")); | |
32 source.setAttribute("type", mimeTypeForFile(source.getAttribute(
"src"))); | |
33 video.appendChild(source); | |
34 | |
35 document.body.appendChild(video); | |
36 | |
37 waitForEvent('error', errorEvent); | |
38 waitForEvent('loadedmetadata', endTest); | |
39 consoleWrite(""); | |
40 } | |
41 | |
42 </script> | |
43 </head> | |
44 <body onload="setup()"> | |
45 | |
46 <p>Test that a single valid <source> element loads correctly</p> | |
47 | |
48 </body> | |
49 </html> | |
OLD | NEW |