Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / battery-status / restricted-level-precision.html
blobb2706a5d47da4bade21f01c6fe30219e330e3209
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.");
8 if (!window.testRunner)
9 debug('This test cannot be run without the TestRunner');
11 // Clean-up any unused battery manager objects from previous tests.
12 gc();
13 jsTestIsAsync = true;
14 testRunner.waitUntilDone();
16 var levelFullPrecision = 0.556789;
17 var levelRounded = 0.56;
19 function setAndFireMockBatteryInfo(charging, chargingTime, dischargingTime, level) {
20 testRunner.didChangeBatteryStatus(charging, chargingTime, dischargingTime, level);
23 var battery;
24 function batteryStatusSuccess(batteryManager) {
25 debug('batteryStatusSuccess invoked');
26 battery = batteryManager;
27 shouldBe('battery.level', 'levelRounded');
28 setTimeout(finishJSTest, 0);
31 function batteryStatusFailure() {
32 testFailed('failed to successfully resolve the promise');
33 setTimeout(finishJSTest, 0);
36 navigator.getBattery().then(batteryStatusSuccess, batteryStatusFailure);
37 setAndFireMockBatteryInfo(false, 10, 20, levelFullPrecision);
38 </script>
39 </body>
40 </html>