resource-selection-remove-src.html (912B)
1 <!doctype html> 2 <title>invoking resource selection by setting src; await stable state</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 v.onloadstart = t.step_func(function() { assert_unreached(); }); 11 v.setAttribute('src', ''); // runs resource selection algorithm, but it will wait running the sync section until this script has finished 12 assert_equals(v.networkState, v.NETWORK_NO_SOURCE); 13 v.removeAttribute('src'); // will make resource selection algorithm revert to NETWORK_EMPTY and abort (in the sync section) 14 assert_equals(v.networkState, v.NETWORK_NO_SOURCE); 15 window.onload = t.step_func(function() { t.done(); }); 16 }); 17 </script> 18 <script> 19 t.step(function() { 20 assert_equals(v.networkState, v.NETWORK_EMPTY); 21 }); 22 </script>