restricted-level-precision.https.html (650B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/resources/test-only-api.js"></script> 7 <script src="resources/battery-status-helpers.js"></script> 8 </head> 9 <body> 10 <script> 11 battery_status_test(async (t, mockBatteryMonitor) => { 12 const levelFullPrecision = 0.556789; 13 const levelRounded = 0.56; 14 15 mockBatteryMonitor.setBatteryStatus(false, 10, 20, levelFullPrecision); 16 17 const battery = await navigator.getBattery(); 18 assert_equals(battery.level, levelRounded); 19 }, 'battery level is reported with restricted precision'); 20 </script> 21 </body> 22 </html>