startNewPresentation_displaynotallowed-manual.https.html (1940B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Calling "start" when the user denied permission to use the display returns a Promise rejected with a NotAllowedError exception.</title> 4 <link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs/"> 5 <link rel="help" href="http://w3c.github.io/presentation-api/#dfn-controlling-user-agent"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="common.js"></script> 9 10 <p>Before starting this test, confirm that there are one or more available presentation display on your local network.</p> 11 <p>Click the button below to start the manual test. If prompted to select a device, please dismiss the dialog box. The test passes if a "PASS" result appears. 12 </p> 13 <button id="presentBtn">Start Presentation Test</button> 14 15 <script> 16 // disable the timeout function for the tests 17 setup({explicit_timeout: true}); 18 19 // ---------- 20 // DOM Object 21 // ---------- 22 var presentBtn = document.getElementById("presentBtn"); 23 24 // ------------------------------------------- 25 // Start New Presentation Test (error) - begin 26 // ------------------------------------------- 27 presentBtn.onclick = function () { 28 presentBtn.disabled = true; 29 promise_test(function (t) { 30 var request = new PresentationRequest(presentationUrls); 31 32 // terminate the presentation connection when the presentation is started by accident 33 var connection; 34 t.add_cleanup(function() { 35 if(connection) 36 connection.terminate(); 37 }); 38 39 return promise_rejects_dom(t, 'NotAllowedError', request.start().then(function(c) { connection = c; })); 40 }); 41 }; 42 // ----------------------------------------- 43 // Start New Presentation Test (error) - end 44 // ----------------------------------------- 45 </script>