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

Side by Side Diff: third_party/WebKit/LayoutTests/battery-status/page-visibility.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 with page visibility."); 6 description("Test with page visibility.");
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 // compare obtained battery values with the mock values 25 // compare obtained battery values with the mock values
28 function checkBatteryInfo(batteryManager) { 26 function checkBatteryInfo(batteryManager) {
29 batteryInfo = batteryManager; 27 batteryInfo = batteryManager;
30 shouldBeDefined("batteryInfo"); 28 shouldBeDefined("batteryInfo");
31 shouldBeDefined("mockBatteryInfo"); 29 shouldBeDefined("mockBatteryInfo");
32 shouldBe('batteryInfo.charging', 'mockBatteryInfo.charging'); 30 shouldBe('batteryInfo.charging', 'mockBatteryInfo.charging');
33 shouldBe('batteryInfo.chargingTime', 'mockBatteryInfo.chargingTime'); 31 shouldBe('batteryInfo.chargingTime', 'mockBatteryInfo.chargingTime');
34 shouldBe('batteryInfo.dischargingTime', 'mockBatteryInfo.dischargingTime'); 32 shouldBe('batteryInfo.dischargingTime', 'mockBatteryInfo.dischargingTime');
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 testFailed('received event while the page was hidden'); 71 testFailed('received event while the page was hidden');
74 setTimeout(finishJSTest, 0); 72 setTimeout(finishJSTest, 0);
75 } 73 }
76 74
77 debug("page is visible"); 75 debug("page is visible");
78 navigator.getBattery().then(batteryStatusSuccess, batteryStatusFailure); 76 navigator.getBattery().then(batteryStatusSuccess, batteryStatusFailure);
79 setAndFireMockBatteryInfo(false, 10, 20, 0.5); 77 setAndFireMockBatteryInfo(false, 10, 20, 0.5);
80 </script> 78 </script>
81 </body> 79 </body>
82 </html> 80 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698