OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src=../media-file.js></script> | 4 <script src=../media-file.js></script> |
| 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 | 8 |
7 <script> | 9 <script> |
8 function clearSrc() | 10 function clearSrc() |
9 { | 11 { |
10 consoleWrite("<br>** Video and track loaded, one cue should be a
ctive **"); | 12 consoleWrite("<br>** Video and track loaded, one cue should be a
ctive **"); |
11 testExpected("trackElement.track.activeCues.length", 1); | 13 testExpected("trackElement.track.activeCues.length", 1); |
12 | 14 |
13 consoleWrite("<br>** Clear video 'src' and force reload **"); | 15 consoleWrite("<br>** Clear video 'src' and force reload **"); |
14 run("video.src = ''"); | 16 run("video.src = ''"); |
15 consoleWrite(""); | 17 consoleWrite(""); |
16 } | 18 } |
17 | 19 |
18 function videoError() | 20 function videoError() |
19 { | 21 { |
20 consoleWrite("** 'error' event, no cues should be active **)"); | 22 consoleWrite("** 'error' event, no cues should be active **)"); |
21 testExpected("event.target", video); | 23 testExpected("event.target", video); |
22 testExpected("video.error", null, "!="); | 24 testExpected("video.error", null, "!="); |
23 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SU
PPORTED); | 25 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SU
PPORTED); |
24 testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_S
OURCE); | 26 testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_S
OURCE); |
25 testExpected("trackElement.track.activeCues.length", 0); | 27 testExpected("trackElement.track.activeCues.length", 0); |
26 | 28 |
27 consoleWrite(""); | 29 consoleWrite(""); |
28 endTest(); | 30 endTest(); |
29 } | 31 } |
30 | 32 |
31 function setup() | 33 function setup() |
32 { | 34 { |
33 consoleWrite(""); | 35 consoleWrite(""); |
34 | 36 |
35 findMediaElement(); | 37 findMediaElement(); |
36 trackElement = document.querySelector('track'); | 38 trackElement = document.querySelector('track'); |
37 | 39 |
38 waitForEventsAndCall([[video, 'canplaythrough'], [trackElement,
'load'], [trackElement, 'cuechange']], clearSrc); | 40 waitForEventsAndCall([[video, 'canplaythrough'], [trackElement,
'load'], [trackElement, 'cuechange']], clearSrc); |
39 | 41 |
40 video.src = findMediaFile("video", "../content/test"); | 42 video.src = findMediaFile("video", "../content/test"); |
41 } | 43 } |
42 | 44 |
43 </script> | 45 </script> |
44 </head> | 46 </head> |
45 <body onload="setup()"> | 47 <body onload="setup()"> |
46 <video controls onerror="videoError()"> | 48 <video controls onerror="videoError()"> |
47 <track src="captions-webvtt/captions-fast.vtt" kind="captions" defau
lt> | 49 <track src="captions-webvtt/captions-fast.vtt" kind="captions" defau
lt> |
48 </video> | 50 </video> |
49 | 51 |
50 <p>Test to ensure that a no text track cues are active after the video i
s unloaded.</p> | 52 <p>Test to ensure that a no text track cues are active after the video i
s unloaded.</p> |
51 | 53 |
52 </body> | 54 </body> |
53 </html> | 55 </html> |
OLD | NEW |