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

Unified Diff: android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback.html

Issue 1394303007: [WebViewLayoutTest] Fix potential rounding error in testBatteryApi() layout test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix the precision test Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback.html
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 42f2ec39240549835fdd1529ae38ed97e57ab112..fd9a2e17ac0637ec3df442aee41896c7853310a1 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');
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>
+</html>
« no previous file with comments | « no previous file | android_webview/tools/WebViewShell/test/blink-apis/battery-status/battery-callback-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698