OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests that having an empty cue does not crash when calling getCueAsHTML()
.</title> |
3 <head> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src=../media-file.js></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 5 <script> |
6 (Please avoid writing new tests using video-test.js) --> | 6 test(function() { |
7 <script src=../video-test.js></script> | 7 var emptyCue = new VTTCue(0, 0, ""); |
8 <script> | 8 var fragment = emptyCue.getCueAsHTML(); |
9 var fragment; | |
10 function startTest() | |
11 { | |
12 var emptyCue = new VTTCue(0, 0, ""); | |
13 fragment = emptyCue.getCueAsHTML(); | |
14 | 9 |
15 consoleWrite("** The getCueAsHTML() method should return a document
fragment **"); | 10 // The getCueAsHTML() method should return a document fragment. |
16 testExpected("fragment", null, "!="); | 11 assert_true(fragment instanceof DocumentFragment); |
17 | 12 |
18 consoleWrite("<br>** The document fragment should have one child, an
empty Text node **"); | 13 // The document fragment should have one child, an empty Text node. |
19 testExpected("fragment.childNodes.length", 1); | 14 assert_equals(fragment.childNodes.length, 1); |
20 testExpected("fragment.childNodes[0].constructor.name", Text.name); | 15 assert_equals(fragment.childNodes[0].constructor.name, Text.name); |
21 testExpected("fragment.childNodes[0].length", 0); | 16 assert_equals(fragment.childNodes[0].length, 0); |
22 | 17 assert_equals(fragment.childNodes[0].data, ""); |
23 consoleWrite(""); | 18 }); |
24 consoleWrite("No crash. PASS."); | 19 </script> |
25 consoleWrite(""); | |
26 | |
27 endTest(); | |
28 } | |
29 </script> | |
30 </head> | |
31 | |
32 <body onload="startTest()"> | |
33 <p>Tests that having an empty cue does not crash when calling getCueAsHT
ML().</p> | |
34 <video controls /> | |
35 </body> | |
36 </html> | |
OLD | NEW |