resource-selection-remove-source.html (1113B)
1 <!doctype html> 2 <title>Changes to networkState when inserting and removing a <source></title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <div id=log></div> 6 <script> 7 var v; 8 var t = async_test(function(t) { 9 v = document.createElement('video'); 10 assert_equals(v.networkState, v.NETWORK_EMPTY, 'networkState when creating the element'); 11 v.appendChild(document.createElement('source')); // runs resource selection algorithm 12 assert_equals(v.networkState, v.NETWORK_NO_SOURCE, 'networkState when inserting a source element'); 13 v.removeChild(v.firstChild); 14 assert_equals(v.networkState, v.NETWORK_NO_SOURCE, 'networkState after removing the source element'); 15 }); 16 </script> 17 <!-- now resource selection will continue its sync section (the </script> tag below provides a stable state) --> 18 <!-- will find neither src nor source, so sets networkState to NETWORK_EMPTY --> 19 <script> 20 t.step(function() { 21 assert_equals(v.networkState, v.NETWORK_EMPTY, 'networkState after letting the sync section of resource selection run'); 22 t.done(); 23 }); 24 </script>