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

Side by Side Diff: third_party/WebKit/LayoutTests/battery-status/api-defined.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, 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 <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 basic API definitions."); 6 description("Test basic API definitions.");
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 15
18 var mockBatteryInfo; 16 var mockBatteryInfo;
19 function setAndFireMockBatteryInfo(charging, chargingTime, dischargingTime, leve l) { 17 function setAndFireMockBatteryInfo(charging, chargingTime, dischargingTime, leve l) {
20 mockBatteryInfo = { charging: charging, 18 mockBatteryInfo = { charging: charging,
21 chargingTime: chargingTime, 19 chargingTime: chargingTime,
22 dischargingTime: dischargingTime, 20 dischargingTime: dischargingTime,
23 level: level }; 21 level: level };
24 window.internals.updateBatteryStatus(charging, chargingTime, dischargingTime , level); 22 testRunner.didChangeBatteryStatus(charging, chargingTime, dischargingTime, l evel);
25 } 23 }
26 24
27 var battery; 25 var battery;
28 function batteryStatusSuccess(batteryManager) { 26 function batteryStatusSuccess(batteryManager) {
29 debug('batteryStatusSuccess invoked'); 27 debug('batteryStatusSuccess invoked');
30 battery = batteryManager; 28 battery = batteryManager;
31 29
32 shouldBeDefined("battery"); 30 shouldBeDefined("battery");
33 shouldBeNonNull("battery"); 31 shouldBeNonNull("battery");
34 shouldBeDefined("battery.charging"); 32 shouldBeDefined("battery.charging");
(...skipping 25 matching lines...) Expand all
60 } 58 }
61 59
62 promise = navigator.getBattery(); 60 promise = navigator.getBattery();
63 shouldBeDefined("promise"); 61 shouldBeDefined("promise");
64 shouldBeDefined("promise.then"); 62 shouldBeDefined("promise.then");
65 promise.then(batteryStatusSuccess, batteryStatusFailure); 63 promise.then(batteryStatusSuccess, batteryStatusFailure);
66 setAndFireMockBatteryInfo(false, 10, 20, 0.5); 64 setAndFireMockBatteryInfo(false, 10, 20, 0.5);
67 </script> 65 </script>
68 </body> 66 </body>
69 </html> 67 </html>
OLDNEW
« no previous file with comments | « media/blink/BUILD.gn ('k') | third_party/WebKit/LayoutTests/battery-status/multiple-promises.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698