Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <title>Tests default DOM layout structure for a VTTRegion.</title> |
| 3 <head> | 3 <script src="../../media-controls.js"></script> |
| 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <script src="../../media-file.js"></script> |
| 5 <script src="../../../resources/testharness.js"></script> | |
| 6 <script src="../../../resources/testharnessreport.js"></script> | |
| 7 <script> | |
| 8 var testTrack; | |
|
philipj_slow
2016/04/06 12:40:04
Looks like you can move these into the async_test
Srirama
2016/04/07 10:40:07
Done.
| |
| 9 var region; | |
| 10 var container; | |
| 11 var video; | |
| 5 | 12 |
| 6 <script src=../../media-controls.js></script> | 13 async_test(function() { |
| 7 <script src=../../media-file.js></script> | 14 video = document.createElement('video'); |
| 8 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 15 video.src = findMediaFile('video', '../../content/test'); |
| 9 (Please avoid writing new tests using video-test.js) --> | 16 testTrack = document.createElement('track'); |
| 10 <script src=../../video-test.js></script> | 17 testTrack.onload = this.step_func(function() { |
| 11 <script> | 18 video.oncanplaythrough = this.step_func(function() { |
| 12 var testTrack; | 19 assert_equals(testTrack.track.regions.length, 1); |
| 13 var region; | |
| 14 var container; | |
| 15 | 20 |
| 16 function testRegionsDisplay() | 21 region = textTrackDisplayElement(video, 'region'); |
| 17 { | 22 container = textTrackDisplayElement(video, 'region-container'); |
| 18 testTrack = video.textTracks[0]; | |
| 19 | 23 |
| 20 consoleWrite("** The text track has only one region **"); | 24 assert_equals(region.children.length, 1); |
| 21 testExpected("testTrack.regions.length", 1); | 25 assert_equals(region.children[0], container); |
| 22 | 26 assert_equals(internals.shadowPseudoId(region), '-webkit-media-text- track-region'); |
| 23 try { | 27 assert_equals(internals.shadowPseudoId(container), '-webkit-media-te xt-track-region-container'); |
| 24 region = textTrackDisplayElement(video, 'region'); | 28 this.done(); |
| 25 container = textTrackDisplayElement(video, 'region-container'); | 29 }); |
| 26 } catch(e) { | 30 }); |
| 27 consoleWrite(e); | 31 testTrack.src = '../captions-webvtt/captions-regions.vtt'; |
| 28 } | 32 testTrack.kind = 'captions'; |
| 29 | 33 testTrack.default = true; |
| 30 consoleWrite("<br>** Inspecting the default DOM layout used for regi ons display **"); | 34 video.appendChild(testTrack); |
| 31 | 35 }); |
| 32 consoleWrite("<br>** Only one region should be displayed **"); | 36 </script> |
| 33 testExpected("region.children.length", 1); | |
| 34 | |
| 35 consoleWrite("<br>** The child of the region should be the container **"); | |
| 36 testExpected("region.children[0] == container", true); | |
| 37 | |
| 38 consoleWrite("<br>** Default pseudo IDs should be set properly"); | |
| 39 testExpected("internals.shadowPseudoId(region)", "-webkit-media-text -track-region"); | |
| 40 testExpected("internals.shadowPseudoId(container)", "-webkit-media-t ext-track-region-container"); | |
| 41 | |
| 42 endTest(); | |
| 43 } | |
| 44 | |
| 45 function startTest() | |
| 46 { | |
| 47 if (!window.VTTRegion) { | |
| 48 failTest(); | |
| 49 return; | |
| 50 } | |
| 51 | |
| 52 findMediaElement(); | |
| 53 | |
| 54 video.src = findMediaFile('video', '../../content/test'); | |
| 55 waitForEvent('canplaythrough', testRegionsDisplay); | |
| 56 } | |
| 57 | |
| 58 </script> | |
| 59 </head> | |
| 60 <body> | |
| 61 <p>Tests default DOM layout structure for a VTTRegion.</p> | |
| 62 <video controls> | |
| 63 <track src="../captions-webvtt/captions-regions.vtt" kind="captions" default onload="startTest()"> | |
| 64 </video> | |
| 65 </body> | |
| 66 </html> | |
| OLD | NEW |