Chromium Code Reviews| 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 calls are using a mock implementation of the backend. | |
|
Takashi Toyoshima
2015/06/02 02:40:37
Can you do s/the Permission API/the Permission API
| |
| 15 // However, the test can be used in different context. | |
| 16 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { | |
| 17 window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.p athname; | |
| 18 } else { | |
| 19 async_test(function() { | |
| 20 navigator.requestMIDIAccess({sysex:true}).then(this.step_func(function() { | |
| 21 assert_unreached('requesting midi access should fail'); | |
| 22 this.done(); | |
| 23 })).catch(this.step_func(function(e) { | |
| 24 assert_equals(e.name, 'SecurityError') | |
| 25 return navigator.permissions.query({name:'midi', sysex:true}); | |
| 26 })).then(this.step_func(function(p) { | |
| 27 assert_equals(p.status, "denied"); | |
| 28 this.done(); | |
| 29 })); | |
| 30 }, 'requesting midi access and querying them should both return deny.'); | |
| 31 } | |
| 32 </script> | |
| 33 </body> | |
| 34 </html> | |
| OLD | NEW |