OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>no usable <source> test</title> | 4 <title>no usable <source> test</title> |
| 5 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 6 (Please avoid writing new tests using video-test.js) --> |
5 <script src=video-test.js></script> | 7 <script src=video-test.js></script> |
6 <script> | 8 <script> |
7 document.addEventListener("error", errorEvent, true); | 9 document.addEventListener("error", errorEvent, true); |
8 | 10 |
9 function errorEvent(evt) | 11 function errorEvent(evt) |
10 { | 12 { |
11 findMediaElement(); | 13 findMediaElement(); |
12 consoleWrite("++ ERROR, src = " + relativeURL(event.target.src) + ",
type = \"" + event.target.type + "\""); | 14 consoleWrite("++ ERROR, src = " + relativeURL(event.target.src) + ",
type = \"" + event.target.type + "\""); |
13 testExpected("event.target.tagName", "SOURCE", "=="); | 15 testExpected("event.target.tagName", "SOURCE", "=="); |
14 | 16 |
15 // Any more source elements pending? | 17 // Any more source elements pending? |
16 var nextSource = event.target.nextSibling; | 18 var nextSource = event.target.nextSibling; |
17 while (video.hasChildNodes()) { | 19 while (video.hasChildNodes()) { |
18 if (!nextSource || nextSource.tagName == "SOURCE") | 20 if (!nextSource || nextSource.tagName == "SOURCE") |
19 break; | 21 break; |
20 nextSource = nextSource.nextSibling; | 22 nextSource = nextSource.nextSibling; |
21 } | 23 } |
22 | 24 |
23 if (!nextSource) { | 25 if (!nextSource) { |
24 testExpected("event.target.parentNode.networkState", HTMLMediaEl
ement.NETWORK_NO_SOURCE, "=="); | 26 testExpected("event.target.parentNode.networkState", HTMLMediaEl
ement.NETWORK_NO_SOURCE, "=="); |
25 consoleWrite(""); | 27 consoleWrite(""); |
26 endTest(); | 28 endTest(); |
27 } else { | 29 } else { |
28 // Because the error event is fired asynchronously the network s
tate can be either | 30 // Because the error event is fired asynchronously the network s
tate can be either |
29 // NETWORK_LOADING or NETWORK_NO_SOURCE, depending on whether or
not | 31 // NETWORK_LOADING or NETWORK_NO_SOURCE, depending on whether or
not |
30 testExpected("event.target.parentNode.networkState", HTMLMediaEl
ement.NETWORK_IDLE, ">"); | 32 testExpected("event.target.parentNode.networkState", HTMLMediaEl
ement.NETWORK_IDLE, ">"); |
31 } | 33 } |
32 | 34 |
33 consoleWrite(""); | 35 consoleWrite(""); |
34 } | 36 } |
35 </script> | 37 </script> |
36 | 38 |
37 </head> | 39 </head> |
38 <body> | 40 <body> |
39 <video controls> | 41 <video controls> |
40 <source src="test.mp4" type="audio/x-chicken-face"> | 42 <source src="test.mp4" type="audio/x-chicken-face"> |
41 <source src="test.ogv" type="video/x-higglety-pigglety"> | 43 <source src="test.ogv" type="video/x-higglety-pigglety"> |
42 <source src="doesnotexist.mp4"> | 44 <source src="doesnotexist.mp4"> |
43 </video> | 45 </video> |
44 | 46 |
45 <p>1. Test that no usable <source> element leaves the media element wi
th | 47 <p>1. Test that no usable <source> element leaves the media element wi
th |
46 networkState == NETWORK_NO_SOURCE</p> | 48 networkState == NETWORK_NO_SOURCE</p> |
47 </body> | 49 </body> |
48 </html> | 50 </html> |
OLD | NEW |