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

Side by Side Diff: LayoutTests/battery-status/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 <body> 2 <body>
3 <head> 3 <head>
4 <script src="../resources/js-test.js"></script> 4 <script src="../resources/js-test.js"></script>
5 <script src="vibration-utils.js"></script>
6 </head> 5 </head>
7 <script> 6 <script>
8 description("Accessing navigator.vibrate on a closed window."); 7 description("Accessing navigator.getBattery() on a closed window.");
9 8
10 window.jsTestIsAsync = true; 9 window.jsTestIsAsync = true;
11 10
12 var w; 11 var w;
12 var nav;
13
13 function processMessage(event) { 14 function processMessage(event) {
14 if (event.data == "opened") { 15 if (event.data == "opened") {
16 nav = w.navigator;
17 shouldBeTrue("typeof(nav.getBattery()) == 'object'");
15 w.close(); 18 w.close();
19 w = null;
16 } else if (event.data == "closed") { 20 } else if (event.data == "closed") {
17 shouldBeFalse("w.navigator.vibrate([])"); 21 shouldBeUndefined("nav.getBattery()");
18 finishJSTest(); 22 finishJSTest();
19 } 23 }
20 } 24 }
21 25
22 if (window.testRunner) { 26 if (window.testRunner) {
23 testRunner.dumpAsText(); 27 testRunner.dumpAsText();
24 testRunner.setCanOpenWindows(); 28 testRunner.setCanOpenWindows();
25 } 29 }
26 w = window.open('resources/vibration-detached-no-crash-new-window.html'); 30 w = window.open('../resources/window-postmessage-open-close.html');
27 window.addEventListener("message", processMessage, false); 31 window.addEventListener("message", processMessage, false);
28 </script> 32 </script>
29 </body> 33 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698