Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webmidi / permission.html
blob0075b899bc93059bc452d05e3eae43bab6f3c116
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script src="../http/tests/resources/permissions-helper.js"></script>
6 </head>
7 <body>
8 <script>
10 description("Test if sysex permission request is handled.");
12 shouldBeDefined("navigator.requestMIDIAccess");
13 shouldBeDefined("PermissionsHelper.setPermission");
15 window.jsTestIsAsync = true;
17 var finishSuccessfully = function () {
18 testPassed("all permission request rests pass successfully.");
19 finishJSTest();
22 var rejectSysex = function (next) {
23 PermissionsHelper.setPermission('midi-sysex', 'denied').then(function() {
24 promise = navigator.requestMIDIAccess({sysex: true});
25 shouldBeDefined("promise");
26 shouldBeDefined("promise.then");
27 promise.then(function(access) {
28 testFailed("sysex permission request should be rejected.");
29 finishJSTest();
30 }, function (error) {
31 testPassed("sysex permission request is successfully rejected.");
32 if (next)
33 next();
34 else
35 finishSuccessfully();
36 });
37 });
40 var acceptSysex = function (next) {
41 PermissionsHelper.setPermission('midi-sysex', 'granted').then(function() {
42 promise = navigator.requestMIDIAccess({sysex: true});
43 shouldBeDefined("promise");
44 shouldBeDefined("promise.then");
45 promise.then(function(obtainedAccess) {
46 testPassed("sysex permission request is successfully accepted.");
47 access = obtainedAccess;
48 shouldBeDefined("access");
49 shouldBeDefined("access.sysexEnabled");
50 shouldBeTrue("access.sysexEnabled");
51 if (next)
52 next();
53 else
54 finishSuccessfully();
55 }, function (error) {
56 testFailed("sysex permission request should be accepted.");
57 finishJSTest();
58 });
59 });
62 rejectSysex(acceptSysex);
64 </script>
65 </body>
66 </html>