| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 description("Test basic API definitions."); | 6 description("Test basic API definitions."); |
| 7 | 7 |
| 8 if (!window.testRunner) | 8 if (!window.testRunner) |
| 9 debug('This test cannot be run without the TestRunner'); | 9 debug('This test cannot be run without the TestRunner'); |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 shouldBe('battery.charging', 'mockBatteryInfo.charging'); | 37 shouldBe('battery.charging', 'mockBatteryInfo.charging'); |
| 38 shouldBe('battery.chargingTime', 'mockBatteryInfo.chargingTime'); | 38 shouldBe('battery.chargingTime', 'mockBatteryInfo.chargingTime'); |
| 39 shouldBe('battery.dischargingTime', 'mockBatteryInfo.dischargingTime'); | 39 shouldBe('battery.dischargingTime', 'mockBatteryInfo.dischargingTime'); |
| 40 shouldBe('battery.level', 'mockBatteryInfo.level'); | 40 shouldBe('battery.level', 'mockBatteryInfo.level'); |
| 41 | 41 |
| 42 shouldBeTrue("typeof battery.onchargingchange == 'object'"); | 42 shouldBeTrue("typeof battery.onchargingchange == 'object'"); |
| 43 shouldBeTrue("typeof battery.onchargingtimechange == 'object'"); | 43 shouldBeTrue("typeof battery.onchargingtimechange == 'object'"); |
| 44 shouldBeTrue("typeof battery.ondischargingtimechange == 'object'"); | 44 shouldBeTrue("typeof battery.ondischargingtimechange == 'object'"); |
| 45 shouldBeTrue("typeof battery.onlevelchange == 'object'"); | 45 shouldBeTrue("typeof battery.onlevelchange == 'object'"); |
| 46 | 46 |
| 47 shouldBeTrue("battery.hasOwnProperty('onchargingchange')"); | |
| 48 shouldBeTrue("battery.hasOwnProperty('onchargingtimechange')"); | |
| 49 shouldBeTrue("battery.hasOwnProperty('ondischargingtimechange')"); | |
| 50 shouldBeTrue("battery.hasOwnProperty('onlevelchange')"); | |
| 51 | |
| 52 shouldBeTrue("'onchargingchange' in battery"); | 47 shouldBeTrue("'onchargingchange' in battery"); |
| 53 shouldBeTrue("'onchargingtimechange' in battery"); | 48 shouldBeTrue("'onchargingtimechange' in battery"); |
| 54 shouldBeTrue("'ondischargingtimechange' in battery"); | 49 shouldBeTrue("'ondischargingtimechange' in battery"); |
| 55 shouldBeTrue("'onlevelchange' in battery"); | 50 shouldBeTrue("'onlevelchange' in battery"); |
| 56 | 51 |
| 57 setTimeout(finishJSTest, 0); | 52 setTimeout(finishJSTest, 0); |
| 58 } | 53 } |
| 59 | 54 |
| 60 function batteryStatusFailure() { | 55 function batteryStatusFailure() { |
| 61 testFailed('failed to successfully resolve the promise'); | 56 testFailed('failed to successfully resolve the promise'); |
| 62 setTimeout(finishJSTest, 0); | 57 setTimeout(finishJSTest, 0); |
| 63 } | 58 } |
| 64 | 59 |
| 65 promise = navigator.getBattery(); | 60 promise = navigator.getBattery(); |
| 66 shouldBeDefined("promise"); | 61 shouldBeDefined("promise"); |
| 67 shouldBeDefined("promise.then"); | 62 shouldBeDefined("promise.then"); |
| 68 promise.then(batteryStatusSuccess, batteryStatusFailure); | 63 promise.then(batteryStatusSuccess, batteryStatusFailure); |
| 69 setAndFireMockBatteryInfo(false, 10, 20, 0.5); | 64 setAndFireMockBatteryInfo(false, 10, 20, 0.5); |
| 70 </script> | 65 </script> |
| 71 </body> | 66 </body> |
| 72 </html> | 67 </html> |
| OLD | NEW |