зеркало из https://github.com/mozilla/gecko-dev.git
Bug 856947 - Fix dom/battery test to handle running on either battery or AC power. r=mounir
This commit is contained in:
Родитель
1902cbdc20
Коммит
d037c7f522
|
@ -17,10 +17,15 @@
|
|||
ok('battery' in navigator, "navigator.battery should exist");
|
||||
|
||||
var battery = navigator.battery;
|
||||
is(battery.level, 1.0, "Default battery level should be 1.0");
|
||||
is(battery.charging, true, "Default charging value should be true");
|
||||
is(battery.dischargingTime, Infinity, "Default dischargingTime should be Inifinity");
|
||||
is(battery.chargingTime, 0, "Default chargingTime should be 0");
|
||||
ok(battery.level >= 0.0 && battery.level <= 1.0, "Battery level " + battery.level + " should be in the range [0.0, 1.0]");
|
||||
|
||||
if (battery.charging) {
|
||||
ok(battery.chargingTime >= 0, "Battery chargingTime " + battery.chargingTime + " should be nonnegative when charging");
|
||||
is(battery.dischargingTime, Infinity, "Battery dischargingTime should be Infinity when charging");
|
||||
} else {
|
||||
is(battery.chargingTime, Infinity, "Battery chargingTime should be Infinity when discharging");
|
||||
ok(battery.dischargingTime > 0, "Battery dischargingTime " + battery.dischargingTime + " should be positive when discharging");
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
|
Загрузка…
Ссылка в новой задаче