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

Side by Side Diff: third_party/WebKit/LayoutTests/battery-status/multiple-windows.html

Issue 1740843002: Revert of Migrates battery_status from content/renderer/ to WebKit/platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 <html> 2 <html>
3 <body> 3 <body>
4 <script src="../resources/js-test.js"></script> 4 <script src="../resources/js-test.js"></script>
5 <script> 5 <script>
6 description("Test battery status API with multiple windows."); 6 description("Test battery status API with multiple windows.");
7 7
8 if (!window.testRunner) 8 if (!window.testRunner)
9 debug('This test cannot be run without the TestRunner'); 9 debug('This test cannot be run without the TestRunner');
10 if (!window.internals)
11 debug('This test cannot be run without the window.internals');
12 10
13 // Clean-up any unused battery manager objects from previous tests. 11 // Clean-up any unused battery manager objects from previous tests.
14 gc(); 12 gc();
15 jsTestIsAsync = true; 13 jsTestIsAsync = true;
16 testRunner.waitUntilDone(); 14 testRunner.waitUntilDone();
17 testRunner.setCanOpenWindows(); 15 testRunner.setCanOpenWindows();
18 testRunner.setCloseRemainingWindowsWhenComplete(true); 16 testRunner.setCloseRemainingWindowsWhenComplete(true);
19 17
20 var mockBatteryInfo; 18 var mockBatteryInfo;
21 function setAndFireMockBatteryInfo(charging, chargingTime, dischargingTime, leve l) { 19 function setAndFireMockBatteryInfo(charging, chargingTime, dischargingTime, leve l) {
22 mockBatteryInfo = { charging: charging, 20 mockBatteryInfo = { charging: charging,
23 chargingTime: chargingTime, 21 chargingTime: chargingTime,
24 dischargingTime: dischargingTime, 22 dischargingTime: dischargingTime,
25 level: level }; 23 level: level };
26 window.internals.updateBatteryStatus(charging, chargingTime, dischargingTime , level); 24 testRunner.didChangeBatteryStatus(charging, chargingTime, dischargingTime, l evel);
27 } 25 }
28 26
29 // compare obtained battery values with the mock values 27 // compare obtained battery values with the mock values
30 function checkBatteryInfo(batteryManager) { 28 function checkBatteryInfo(batteryManager) {
31 batteryInfo = batteryManager; 29 batteryInfo = batteryManager;
32 shouldBeDefined("batteryInfo"); 30 shouldBeDefined("batteryInfo");
33 shouldBeDefined("mockBatteryInfo"); 31 shouldBeDefined("mockBatteryInfo");
34 shouldBe('batteryInfo.charging', 'mockBatteryInfo.charging'); 32 shouldBe('batteryInfo.charging', 'mockBatteryInfo.charging');
35 shouldBe('batteryInfo.chargingTime', 'mockBatteryInfo.chargingTime'); 33 shouldBe('batteryInfo.chargingTime', 'mockBatteryInfo.chargingTime');
36 shouldBe('batteryInfo.dischargingTime', 'mockBatteryInfo.dischargingTime'); 34 shouldBe('batteryInfo.dischargingTime', 'mockBatteryInfo.dischargingTime');
(...skipping 16 matching lines...) Expand all
53 checkBatteryInfo(battery2); 51 checkBatteryInfo(battery2);
54 setTimeout(finishJSTest, 0); 52 setTimeout(finishJSTest, 0);
55 }, batteryStatusFailure); 53 }, batteryStatusFailure);
56 } 54 }
57 55
58 navigator.getBattery().then(batteryStatusSuccess, batteryStatusFailure); 56 navigator.getBattery().then(batteryStatusSuccess, batteryStatusFailure);
59 setAndFireMockBatteryInfo(false, 10, 20, 0.5); 57 setAndFireMockBatteryInfo(false, 10, 20, 0.5);
60 </script> 58 </script>
61 </body> 59 </body>
62 </html> 60 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698