| Wanming Lin | fddd2c8 | 2017-05-11 11:01:01 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <meta charset="utf-8"> |
| 3 | <title>Battery Test: navigator.getBattery() shall throw "SecurityError" in an insecure context</title> |
| 4 | <link rel="author" title="Intel" href="http://www.intel.com"> |
| 5 | <link rel="help" href="https://www.w3.org/TR/battery-status/"> |
| 6 | <script src="/resources/testharness.js"></script> |
| 7 | <script src="/resources/testharnessreport.js"></script> |
| 8 | <style> |
| 9 | #note { |
| 10 | background-color: #fef1b5; |
| 11 | border: solid 1px #cdab2d; |
| 12 | padding: 5px; |
| 13 | margin: 15px; |
| 14 | display: block; |
| 15 | } |
| 16 | </style> |
| 17 | <div id="note"> |
| 18 | Run test in an insecure context, e.g. http://example.com/. |
| 19 | </div> |
| 20 | |
| 21 | <script> |
| 22 | |
| 23 | promise_test(t => { |
| 24 | return promise_rejects(t, 'SecurityError', navigator.getBattery()); |
| 25 | }, "navigator.getBattery() shall throw a 'SecurityError' in an insecure context"); |
| 26 | |
| 27 | </script> |