track-default-attribute.html (1001B)
1 <!DOCTYPE html> 2 <title>A track with the "default" attribute loads automatically</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <video> 6 <track kind="captions" src="resources/default-styles.vtt"> 7 <track kind="captions" src="resources/metadata-area.vtt"> 8 <track kind="captions" src="resources/webvtt-file.vtt" id="default" default> 9 <script> 10 async_test(function(t) { 11 var timer = null; 12 var tracks = document.querySelectorAll("track"); 13 for (var track of tracks) { 14 track.onload = t.step_func(function() { 15 assert_equals(event.target.readyState, HTMLTrackElement.LOADED); 16 assert_equals(event.target.id, "default"); 17 assert_true(event.target.default); 18 // End the test after a brief pause so we allow other tracks to load if they will. 19 if (timer) 20 clearTimeout(timer); 21 timer = t.step_timeout(t.step_func_done(), 200); 22 }); 23 } 24 }); 25 </script> 26 </video>