Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: LayoutTests/gamepad/gamepad-detached-no-crash.html

Issue 915033002: BatteryManager.getBattery(): gracefully bail on context-detached use. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tidying up test Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698