OLD | NEW |
1 <!doctype html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test that an empty "source" inserted when networkState is NETWORK_EMPTY t
riggers resource selection, immediately changing networkState to NETWORK_NO_SOUR
CE.</title> |
3 <head> | 3 <script src="../resources/testharness.js"></script> |
4 <title>networkState after inserting <source> test</title> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 5 <video> |
6 (Please avoid writing new tests using video-test.js) --> | 6 <source></source> |
7 <script src=video-test.js></script> | 7 </video> |
8 </head> | 8 <script> |
9 <body> | 9 test(function() { |
10 <video controls><source></video> | 10 // "source" inserted by the parser. |
| 11 var video = document.querySelector("video"); |
| 12 assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); |
11 | 13 |
12 <p>Test that a <source> inserted when networkState is NETWORK_NO_S
OURCE triggers | 14 // "video" created with script. |
13 resource selection, immediately changing networkState to NETWORK_NO_SOUR
CE.</p> | 15 video = document.createElement("video"); |
| 16 assert_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY); |
14 | 17 |
15 <script> | 18 // "source" inserted by script. |
16 consoleWrite("<source> inserted by the parser."); | 19 video.appendChild(document.createElement("source")); |
17 video = document.querySelector('video'); | 20 assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); |
18 testExpected("video.networkState", HTMLMediaElement.prototype.NETWOR
K_NO_SOURCE, "=="); | 21 }); |
19 | 22 </script> |
20 consoleWrite("<br><video> created with script."); | |
21 video = document.createElement('video'); | |
22 testExpected("video.networkState", HTMLMediaElement.prototype.NETWOR
K_EMPTY, "=="); | |
23 consoleWrite("<source> inserted by script."); | |
24 video.appendChild(document.createElement('source')); | |
25 testExpected("video.networkState", HTMLMediaElement.prototype.NETWOR
K_NO_SOURCE, "=="); | |
26 if (window.testRunner) | |
27 testRunner.notifyDone(); | |
28 </script> | |
29 | |
30 </body> | |
31 </html> | |
OLD | NEW |