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

Side by Side Diff: third_party/WebKit/LayoutTests/battery-status/multiple-promises.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 multiple promise resolution."); 6 description("Test multiple promise resolution.");
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 29 matching lines...) Expand all
66 checkBatteryInfo(battery); 64 checkBatteryInfo(battery);
67 promise2Count++; 65 promise2Count++;
68 finishIfReady(); 66 finishIfReady();
69 }, batteryStatusFailure); 67 }, batteryStatusFailure);
70 68
71 shouldBeTrue('promise1 === promise2'); 69 shouldBeTrue('promise1 === promise2');
72 setAndFireMockBatteryInfo(false, 10, 20, 0.5); 70 setAndFireMockBatteryInfo(false, 10, 20, 0.5);
73 </script> 71 </script>
74 </body> 72 </body>
75 </html> 73 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698