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

Side by Side Diff: LayoutTests/battery-status/restricted-level-precision.html

Issue 1229143006: Enforce restricted precision of the Battery Status API level attribute (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: no-find-copies Created 5 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/battery-status/restricted-level-precision-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../resources/js-test.js"></script>
5 <script>
6 description("Test to ensure level is reported with restricted precision.");
7
8 if (!window.testRunner)
9 debug('This test cannot be run without the TestRunner');
10
11 // Clean-up any unused battery manager objects from previous tests.
12 gc();
13 jsTestIsAsync = true;
14 testRunner.waitUntilDone();
15
16 var levelFullPrecision = 0.556789;
17 var levelRounded = 0.56;
18
19 function setAndFireMockBatteryInfo(charging, chargingTime, dischargingTime, leve l) {
20 testRunner.didChangeBatteryStatus(charging, chargingTime, dischargingTime, l evel);
21 }
22
23 var battery;
24 function batteryStatusSuccess(batteryManager) {
25 debug('batteryStatusSuccess invoked');
26 battery = batteryManager;
27 shouldBe('battery.level', 'levelRounded');
28 setTimeout(finishJSTest, 0);
29 }
30
31 function batteryStatusFailure() {
32 testFailed('failed to successfully resolve the promise');
33 setTimeout(finishJSTest, 0);
34 }
35
36 navigator.getBattery().then(batteryStatusSuccess, batteryStatusFailure);
37 setAndFireMockBatteryInfo(false, 10, 20, levelFullPrecision);
38 </script>
39 </body>
40 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/battery-status/restricted-level-precision-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698