diff options
Diffstat (limited to 'android_webview/tools/WebViewShell/test/blink-apis/battery-status')
2 files changed, 4 insertions, 11 deletions
diff --git a/android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback-expected.txt b/android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback-expected.txt index 64e31f5..ca967ee 100644 --- a/android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback-expected.txt +++ b/android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback-expected.txt @@ -2,7 +2,7 @@ Test Battery Status API callback in WebView batteryStatusSuccess invoked PASS: battery.level is >= 0 PASS: battery.level is <= 1 -PASS: isInteger(battery.level * 100) is true +PASS: battery.level.toPrecision(2) === battery.level.toString() is true PASS: !battery.charging || battery.dischargingTime === Infinity is true PASS: battery.charging || battery.chargingTime === Infinity is true -TEST FINISHED
\ No newline at end of file +TEST FINISHED diff --git a/android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback.html b/android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback.html index 42f2ec3..a85a3e4 100644 --- a/android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback.html +++ b/android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback.html @@ -6,13 +6,6 @@ description("Test Battery Status API callback in WebView"); window.jsTestIsAsync = true; - function isInteger(value) { - if ((undefined === value) || (null === value)) { - return false; - } - return value % 1 == 0; - } - var battery; function batteryStatusSuccess(batteryManager) { debug('batteryStatusSuccess invoked'); @@ -22,7 +15,7 @@ shouldBeGreaterThanOrEqual('battery.level', '0'); shouldBeLessThanOrEqual('battery.level', '1'); // Check that level has at most 2 significant digits - shouldBeTrue('isInteger(battery.level * 100)'); + shouldBeTrue('battery.level.toPrecision(2) === battery.level.toString()'); shouldBeTrue('!battery.charging || battery.dischargingTime === Infinity'); shouldBeTrue('battery.charging || battery.chargingTime === Infinity'); finishJSTest(); @@ -36,4 +29,4 @@ navigator.getBattery().then(batteryStatusSuccess, batteryStatusFailure); </script> </body> -</html>
\ No newline at end of file +</html> |