pause-remove-from-document.html (1162B)
1 <!doctype html> 2 <title>paused state when removing from a document</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/common/media.js"></script> 6 <div id="log"></div> 7 <video hidden></video> 8 <script> 9 function afterStableState(func) { 10 var a = new Audio(); 11 a.volume = 0; 12 a.addEventListener('volumechange', func); 13 } 14 15 async_test(function(t) { 16 var v = document.querySelector('video'); 17 v.src = getVideoURI('/media/movie_300'); 18 v.play(); 19 v.onplaying = t.step_func(function() { 20 assert_false(v.paused, 'paused after playing'); 21 v.parentNode.removeChild(v); 22 assert_false(v.paused, 'paused after removing'); 23 afterStableState(t.step_func(function() { 24 assert_true(v.paused, 'paused after stable state'); 25 v.onpause = t.step_func(function() { 26 assert_true(v.paused, 'paused in pause event'); 27 // re-insert and verify that it stays paused 28 document.body.appendChild(v); 29 t.step_timeout(function() { 30 assert_true(v.paused, 'paused after re-inserting'); 31 t.done(); 32 }, 0); 33 }); 34 })); 35 }); 36 }); 37 </script>