not-fully-active.html (802B)
1 <!DOCTYPE html> 2 <meta charset="utf-8" /> 3 <title>Gamepad tests for non-fully-active document</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <body> 7 <script> 8 promise_test(async () => { 9 const iframe = document.createElement('iframe'); 10 iframe.srcdoc = `<h1>test</h1>` 11 await new Promise(resolve => { 12 iframe.onload = resolve; 13 document.body.appendChild(iframe); 14 }); 15 const navigator = iframe.contentWindow.navigator; 16 iframe.remove(); 17 const gamepads = navigator.getGamepads(); 18 assert_true(Array.isArray(gamepads), 'getGamepads should return an array'); 19 assert_equals(gamepads.length, 0, "No gamepads should be available"); 20 }, "calling getGamepads() in a non-fully-active document"); 21 </script>