| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Permissions API: test midi sysex on insecure origins.</title> |
| 5 <script src='../resources/testharness.js'></script> |
| 6 <script src='../resources/testharnessreport.js'></script> |
| 7 <script src='../resources/get-host-info.js'></script> |
| 8 </head> |
| 9 <body> |
| 10 <script> |
| 11 // Midi SysEx is not available on insecure origins. This is testing that the |
| 12 // Permissions API matches navigator.requestMIDIAccess() behaviour. |
| 13 // In the context of Chromium's LayoutTests, this test is a dummy test because |
| 14 // the Permissions API and requestMIDIAccess calls are using a mock |
| 15 // implementation of the backend. However, the test can be used in different |
| 16 // context. |
| 17 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { |
| 18 window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.p
athname; |
| 19 } else { |
| 20 async_test(function() { |
| 21 navigator.requestMIDIAccess({sysex:true}).then(this.step_func(function() { |
| 22 assert_unreached('requesting midi access should fail'); |
| 23 this.done(); |
| 24 })).catch(this.step_func(function(e) { |
| 25 assert_equals(e.name, 'SecurityError') |
| 26 return navigator.permissions.query({name:'midi', sysex:true}); |
| 27 })).then(this.step_func(function(p) { |
| 28 assert_equals(p.status, "denied"); |
| 29 this.done(); |
| 30 })); |
| 31 }, 'requesting midi access and querying them should both return deny.'); |
| 32 } |
| 33 </script> |
| 34 </body> |
| 35 </html> |
| OLD | NEW |