forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a WPT test to cover the double conversion of the "midi" permission.
Differential Revision: https://phabricator.services.mozilla.com/D164843 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1805783 gecko-commit: 89dcf7b6208caa0f3d8598d632b8a0be6c8f200d gecko-reviewers: emilio
- Loading branch information
1 parent
0418075
commit c787b3c
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Test WebIDL conversion when querying the "midi" permission</title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<div id="log"></div> | ||
|
||
<script> | ||
promise_test(async (test) => { | ||
let calledCount = 0; | ||
const status = await navigator.permissions.query({ | ||
get name() { | ||
calledCount++; | ||
return "midi"; | ||
}, | ||
}); | ||
assert_true(status instanceof PermissionStatus); | ||
assert_equals(status.name, "midi", `permission's name should be "midi"`); | ||
// | ||
// First call should be from: | ||
// | ||
// Let rootDesc be the object permissionDesc refers to, converted to an | ||
// IDL value of type PermissionDescriptor. | ||
// | ||
// Second from: | ||
// | ||
// Let typedDescriptor be the object permissionDesc refers to, | ||
// converted to an IDL value of rootDesc's name's permission descriptor | ||
// type. | ||
// | ||
// See: https://w3c.github.io/permissions/#query-method | ||
// | ||
assert_equals(calledCount, 2, "midi permission should be converted twice"); | ||
}, `querying the "midi" permission requires two WebIDL conversions`); | ||
</script> |