| OLD | NEW |
| (Empty) |
| 1 description('Tests that the window.navigator.battery properties are present.'); | |
| 2 | |
| 3 function hasOnBatteryProperty() | |
| 4 { | |
| 5 var result = 0; | |
| 6 for (var property in navigator.webkitBattery) { | |
| 7 if (property == 'onchargingchange' || | |
| 8 property == 'onchargingtimechange' || | |
| 9 property == 'ondischargingtimechange' || | |
| 10 property == 'onlevelchange') | |
| 11 result += 1; | |
| 12 } | |
| 13 if (result == 4) | |
| 14 return true; | |
| 15 return false; | |
| 16 } | |
| 17 | |
| 18 shouldBeTrue("typeof navigator.webkitBattery == 'object'"); | |
| 19 shouldBeTrue("hasOnBatteryProperty()"); | |
| 20 shouldBeTrue("navigator.webkitBattery.hasOwnProperty('onchargingchange')"); | |
| 21 shouldBeTrue("navigator.webkitBattery.hasOwnProperty('onchargingtimechange')"); | |
| 22 shouldBeTrue("navigator.webkitBattery.hasOwnProperty('ondischargingtimechange')"
); | |
| 23 shouldBeTrue("navigator.webkitBattery.hasOwnProperty('onlevelchange')"); | |
| OLD | NEW |