selectAudioOutput-user-activation-consumed.https.html (1401B)
1 <!doctype html> 2 <head> 3 <title>Test selectAudioOutput() after user activation is consumed</title> 4 <link rel="help" href="https://github.com/w3c/mediacapture-output/issues/107"> 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> 11 'use strict'; 12 13 promise_test(async t => { 14 await test_driver.bless('transient activation'); 15 // SpecialPowers is used to consume user activation because the only 16 // spec-compliant Gecko API that consumes user activation is 17 // navigator.share(), which is disabled on CI versions of WINNT. 18 // https://searchfox.org/mozilla-central/rev/66547980e8e8ca583473c74f207cae5bac1ed541/testing/web-platform/meta/web-share/share-consume-activation.https.html.ini#4 19 const had_transient_activation = 20 SpecialPowers.wrap(document).consumeTransientUserGestureActivation(); 21 assert_true(had_transient_activation, 22 'should have had transient activation'); 23 const p = navigator.mediaDevices.selectAudioOutput(); 24 // Race a settled promise to check that the returned promise is already 25 // rejected. 26 await promise_rejects_dom( 27 t, 'InvalidStateError', Promise.race([p, Promise.resolve()]), 28 'selectAudioOutput should have returned an already-rejected promise.'); 29 }); 30 </script>