removeTrack-after-setSinkId.https.html (1016B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Test source track removal after setSinkId does not crash</title> 5 </head> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <script src="/common/gc.js"></script> 11 <script> 12 'use strict'; 13 // This could be a crashtest, except that testdriver.bless() is not functional 14 // in crashtests. promise_test() is more elegant than class="test-wait" anyway. 15 promise_test(async t => { 16 await test_driver.bless('transient activation'); 17 const {deviceId, label} = await navigator.mediaDevices.selectAudioOutput(); 18 const audio = new Audio(); 19 await audio.setSinkId(deviceId); 20 audio.srcObject = new AudioContext().createMediaStreamDestination().stream; 21 audio.play(); 22 await new Promise(r => t.step_timeout(r, 0)); 23 audio.srcObject.removeTrack(audio.srcObject.getTracks()[0]); 24 await garbageCollect(); 25 }); 26 </script> 27 </html>