OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <script src="../resources/js-test.js"></script> | 2 <script src="../resources/js-test.js"></script> |
3 <script> | 3 <script> |
4 description("Accessing Navigator Gamepad methods on a closed window."); | 4 description("Accessing Navigator Gamepad methods on a closed window."); |
5 | 5 |
6 window.jsTestIsAsync = true; | 6 window.jsTestIsAsync = true; |
7 | 7 |
8 var expectedLength = 0; | 8 var expectedLength = 0; |
9 var w; | 9 var w; |
10 function processMessage(event) { | 10 function processMessage(event) { |
11 if (event.data == "opened") { | 11 if (event.data == "opened") { |
12 w.close(); | 12 w.close(); |
13 } else if (event.data == "closed") { | 13 } else if (event.data == "closed") { |
14 shouldBe("w.navigator.getGamepads().length", "expectedLength"); | 14 shouldBe("w.navigator.getGamepads().length", "expectedLength"); |
15 finishJSTest(); | 15 finishJSTest(); |
16 } | 16 } |
17 } | 17 } |
18 | 18 |
19 if (window.gamepadController) { | 19 if (window.gamepadController) { |
20 if (window.testRunner) { | 20 if (window.testRunner) { |
21 testRunner.dumpAsText(); | 21 testRunner.dumpAsText(); |
22 testRunner.setCanOpenWindows(); | 22 testRunner.setCanOpenWindows(); |
23 testRunner.waitUntilDone(); | 23 testRunner.waitUntilDone(); |
24 } | 24 } |
25 w = window.open('resources/gamepad-detached-no-crash-new-window.html'); | 25 w = window.open('../resources/window-postmessage-open-close.html'); |
26 expectedLength = w.navigator.getGamepads().length; | 26 expectedLength = w.navigator.getGamepads().length; |
27 window.addEventListener("message", processMessage, false); | 27 window.addEventListener("message", processMessage, false); |
28 } else { | 28 } else { |
29 console.log("FAIL: no gamepad controller available.") | 29 console.log("FAIL: no gamepad controller available.") |
30 } | 30 } |
31 </script> | 31 </script> |
OLD | NEW |