| 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..6b7a0629bf64380c817530b6e96e5843bbd32d28
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/permissions/test-midi-sysex-insecure-origin.html
|
| @@ -0,0 +1,35 @@
|
| +<!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 and requestMIDIAccess calls are using a mock
|
| +// implementation of the backend. 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>
|
|
|