OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests that adding a text track does not make controls visible.</title> |
3 <head> | 3 <script src="../resources/testharness.js"></script> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="media-file.js"></script> |
| 6 <script src="media-controls.js"></script> |
| 7 <video></video> |
| 8 <script> |
| 9 async_test(function(t) { |
| 10 var video = document.querySelector("video"); |
| 11 video.src = findMediaFile("video", "content/test"); |
5 | 12 |
6 <script src=media-file.js></script> | 13 video.oncanplaythrough = t.step_func_done(function() { |
7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 14 // Initial state: no text tracks, controls should not be visible. |
8 (Please avoid writing new tests using video-test.js) --> | 15 assert_equals(video.textTracks.length, 0); |
9 <script src=video-test.js></script> | 16 assert_false(video.controls); |
10 <script src=media-controls.js></script> | |
11 <script> | |
12 | 17 |
13 function canplaythrough() | 18 // Add a text track, controls should not become visible. |
14 { | 19 video.addTextTrack("captions"); |
15 consoleWrite("<br>** Initial state: no text tracks, controls sho
uld not be visible **"); | 20 assert_equals(video.textTracks.length, 1); |
16 testExpected("video.textTracks.length", 0); | 21 assert_false(video.controls); |
17 testExpected("video.controls", false, '=='); | |
18 | 22 |
19 consoleWrite("<br>** Add a text track, controls should not becom
e visible **"); | 23 // Enable controls. |
20 run("video.addTextTrack('captions')"); | 24 video.setAttribute("controls","controls"); |
21 testExpected("video.textTracks.length", 1); | 25 assert_equals(video.textTracks.length, 1); |
22 testExpected("video.controls", false); | 26 assert_true(video.controls); |
23 | 27 assert_not_equals(internals.shadowRoot(video).firstChild, null); |
24 consoleWrite("<br>** Enable controls **"); | 28 var panel = mediaControlsButton(video, "panel"); |
25 run("video.setAttribute('controls','controls')"); | 29 assert_not_equals(panel.style["display"], "none"); |
26 testExpected("video.textTracks.length", 1); | 30 }); |
27 testExpected("video.controls", true); | 31 }); |
28 panel = mediaControlsButton(video, "panel"); | 32 </script> |
29 testExpected("internals.shadowRoot(video).firstChild", null, "!=
"); | |
30 testExpected("panel.style['display']", 'none', "!="); | |
31 | |
32 consoleWrite(""); | |
33 endTest(); | |
34 } | |
35 | |
36 function start() | |
37 { | |
38 findMediaElement(); | |
39 | |
40 waitForEvent('canplaythrough', canplaythrough); | |
41 video.src = findMediaFile("video", "content/test"); | |
42 } | |
43 | |
44 </script> | |
45 </head> | |
46 <body onload="start()"> | |
47 <video> | |
48 </video> | |
49 <p>Tests that adding a text track does not make controls visible.</p> | |
50 </body> | |
51 </html> | |
OLD | NEW |