| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <title>Tests that the cue display tree has been removed properly and no crash ha
ppens.</title> |
| 3 <head> | 3 <script src="../media-file.js"></script> |
| 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <script src="../media-controls.js"></script> |
| 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <video> |
| 8 <track src="captions-webvtt/captions.vtt" kind="captions" mode="showing"> |
| 9 </video> |
| 10 <script> |
| 11 async_test(function(t) { |
| 12 var video = document.querySelector("video"); |
| 13 video.src = findMediaFile("video", "../content/test"); |
| 5 | 14 |
| 6 <script src=../media-file.js></script> | 15 video.play(); |
| 7 <script src=../media-controls.js></script> | 16 video.oncanplaythrough = t.step_func_done(function() { |
| 8 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 17 // Empty the contents of the video element when it is ready to play. |
| 9 (Please avoid writing new tests using video-test.js) --> | 18 video.textContent = ""; |
| 10 <script src=../video-test.js></script> | |
| 11 | 19 |
| 12 <script> | 20 // Text track should not be rendered anymore. |
| 13 function emptyVideoTextContent() | 21 assert_throws(null, function() { textTrackDisplayElement(video, "display
"); }); |
| 14 { | 22 }); |
| 15 consoleWrite(""); | 23 }); |
| 16 consoleWrite("** Empty the contents of the video element when it
is ready to play **"); | 24 </script> |
| 17 video.textContent = ""; | |
| 18 | |
| 19 consoleWrite(""); | |
| 20 consoleWrite("** Text track should not be rendered anymore **"); | |
| 21 try { | |
| 22 var textTrackCueBox = textTrackDisplayElement(video, 'displa
y'); | |
| 23 } catch (e) { | |
| 24 consoleWrite(e); | |
| 25 } | |
| 26 | |
| 27 consoleWrite(""); | |
| 28 consoleWrite("No crash. PASS."); | |
| 29 consoleWrite(""); | |
| 30 | |
| 31 endTest(); | |
| 32 } | |
| 33 | |
| 34 function initElements() | |
| 35 { | |
| 36 consoleWrite("** Set the mode of the text track to showing **"); | |
| 37 testTrack = document.querySelector('track'); | |
| 38 testTrack.track.mode = "showing"; | |
| 39 | |
| 40 consoleWrite(""); | |
| 41 consoleWrite("** Initialize the video element **"); | |
| 42 findMediaElement(); | |
| 43 video.src = findMediaFile('video', '../content/test'); | |
| 44 | |
| 45 video.play(); | |
| 46 waitForEvent('canplaythrough', emptyVideoTextContent); | |
| 47 } | |
| 48 | |
| 49 </script> | |
| 50 </head> | |
| 51 <body onload="initElements()"> | |
| 52 <p>Tests that the cue display tree has been removed properly and no cras
h happens.</p> | |
| 53 <video controls> | |
| 54 <track src="captions-webvtt/captions.vtt" kind="captions"> | |
| 55 </video> | |
| 56 </body> | |
| 57 </html> | |
| OLD | NEW |