OLD | NEW |
---|---|
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <title>Test to ensure that no text track cues are active after the video is unlo aded.</title> |
3 <head> | 3 <script src="../media-file.js"></script> |
4 <script src=../media-file.js></script> | 4 <script src="../../resources/testharness.js"></script> |
5 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 5 <script src="../../resources/testharnessreport.js"></script> |
6 (Please avoid writing new tests using video-test.js) --> | 6 <script> |
7 <script src=../video-test.js></script> | 7 async_test(function(t) { |
8 var video = document.createElement('video'); | |
9 video.src = findMediaFile('video', '../content/test'); | |
10 video.setAttribute('controls', ''); | |
11 var trackElement = document.createElement('track'); | |
8 | 12 |
9 <script> | 13 trackElement.oncuechange = t.step_func(function() { |
10 function clearSrc() | 14 assert_equals(trackElement.track.activeCues.length, 1); |
11 { | 15 video.src = ''; |
12 consoleWrite("<br>** Video and track loaded, one cue should be a ctive **"); | 16 }); |
13 testExpected("trackElement.track.activeCues.length", 1); | |
14 | 17 |
15 consoleWrite("<br>** Clear video 'src' and force reload **"); | 18 video.onerror = t.step_func_done(function() { |
16 run("video.src = ''"); | 19 assert_equals(event.target, video); |
17 consoleWrite(""); | 20 assert_not_equals(video.error, null); |
18 } | 21 assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); |
22 assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); | |
23 assert_equals(trackElement.track.activeCues.length, 0); | |
24 }); | |
19 | 25 |
20 function videoError() | 26 trackElement.src = 'captions-webvtt/captions-fast.vtt'; |
21 { | 27 trackElement.kind = 'captions'; |
22 consoleWrite("** 'error' event, no cues should be active **)"); | 28 trackElement.default = true; |
23 testExpected("event.target", video); | 29 video.appendChild(trackElement); |
24 testExpected("video.error", null, "!="); | 30 }); |
25 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SU PPORTED); | 31 </script> |
26 testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_S OURCE); | |
27 testExpected("trackElement.track.activeCues.length", 0); | |
28 | |
29 consoleWrite(""); | |
30 endTest(); | |
31 } | |
32 | |
33 function setup() | |
34 { | |
35 consoleWrite(""); | |
36 | |
37 findMediaElement(); | |
38 trackElement = document.querySelector('track'); | |
39 | |
40 waitForEventsAndCall([[video, 'canplaythrough'], [trackElement, 'load'], [trackElement, 'cuechange']], clearSrc); | |
Srirama
2016/04/08 11:58:36
I removed all these events and just added 'oncuech
Srirama
2016/04/08 13:43:00
Sorry, looks like the test is failing with latest
Srirama
2016/04/09 09:07:33
Fixed test failure.
| |
41 | |
42 video.src = findMediaFile("video", "../content/test"); | |
43 } | |
44 | |
45 </script> | |
46 </head> | |
47 <body onload="setup()"> | |
48 <video controls onerror="videoError()"> | |
49 <track src="captions-webvtt/captions-fast.vtt" kind="captions" defau lt> | |
50 </video> | |
51 | |
52 <p>Test to ensure that a no text track cues are active after the video i s unloaded.</p> | |
53 | |
54 </body> | |
55 </html> | |
OLD | NEW |