Chromium Code Reviews| Index: LayoutTests/http/tests/permissions/test-midi-sysex-insecure-origin.html |
| diff --git a/LayoutTests/http/tests/permissions/test-midi-sysex-insecure-origin.html b/LayoutTests/http/tests/permissions/test-midi-sysex-insecure-origin.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e72a8d8f739034e423634d5f8fb5bfbe48c2c395 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/permissions/test-midi-sysex-insecure-origin.html |
| @@ -0,0 +1,34 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<title>Permissions API: test midi sysex on insecure origins.</title> |
| +<script src='../resources/testharness.js'></script> |
| +<script src='../resources/testharnessreport.js'></script> |
| +<script src='../resources/get-host-info.js'></script> |
| +</head> |
| +<body> |
| +<script> |
| +// Midi SysEx is not available on insecure origins. This is testing that the |
| +// Permissions API matches navigator.requestMIDIAccess() behaviour. |
| +// In the context of Chromium's LayoutTests, this test is a dummy test because |
| +// 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
|
| +// However, the test can be used in different context. |
| +if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { |
| + window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.pathname; |
| +} else { |
| + async_test(function() { |
| + navigator.requestMIDIAccess({sysex:true}).then(this.step_func(function() { |
| + assert_unreached('requesting midi access should fail'); |
| + this.done(); |
| + })).catch(this.step_func(function(e) { |
| + assert_equals(e.name, 'SecurityError') |
| + return navigator.permissions.query({name:'midi', sysex:true}); |
| + })).then(this.step_func(function(p) { |
| + assert_equals(p.status, "denied"); |
| + this.done(); |
| + })); |
| + }, 'requesting midi access and querying them should both return deny.'); |
| +} |
| +</script> |
| +</body> |
| +</html> |