Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: LayoutTests/http/tests/permissions/test-midi-sysex-insecure-origin.html

Issue 1155823002: Tests that Permissions API and requestMidiAccess() are consistent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698