OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 <script src="../resources/permissions-helper.js"></script> |
5 </head> | 6 </head> |
6 <body> | 7 <body> |
7 <script> | 8 <script> |
8 | 9 |
9 description("Test if midimessage event handler work."); | 10 description("Test if midimessage event handler work."); |
10 | 11 |
11 shouldBeDefined("testRunner.setPermission"); | |
12 shouldBeDefined("navigator.requestMIDIAccess"); | 12 shouldBeDefined("navigator.requestMIDIAccess"); |
13 | 13 |
14 window.jsTestIsAsync = true; | 14 window.jsTestIsAsync = true; |
15 | 15 |
16 testRunner.setPermission('midi-sysex', 'granted', location.origin, location.orig
in); | |
17 | |
18 testData = [ | 16 testData = [ |
19 // Complete messages. | 17 // Complete messages. |
20 [0x80, 0x00, 0x00], | 18 [0x80, 0x00, 0x00], |
21 [0x90, 0x00, 0x00], | 19 [0x90, 0x00, 0x00], |
22 [0xa0, 0x00, 0x00], | 20 [0xa0, 0x00, 0x00], |
23 [0xb0, 0x00, 0x00], | 21 [0xb0, 0x00, 0x00], |
24 [0xc0, 0x00], | 22 [0xc0, 0x00], |
25 [0xd0, 0x00], | 23 [0xd0, 0x00], |
26 [0xe0, 0x00, 0x00], | 24 [0xe0, 0x00, 0x00], |
27 | 25 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 var output = a.outputs.values().next().value; | 64 var output = a.outputs.values().next().value; |
67 for (var i = 0; i < testData.length; ++i) | 65 for (var i = 0; i < testData.length; ++i) |
68 output.send(testData[i]); | 66 output.send(testData[i]); |
69 }, function () { | 67 }, function () { |
70 testFailed("requestMIDIAccess() return an error."); | 68 testFailed("requestMIDIAccess() return an error."); |
71 reject(); | 69 reject(); |
72 }); | 70 }); |
73 }); | 71 }); |
74 } | 72 } |
75 | 73 |
76 test(false).then(test.bind(null, true)).then(finishJSTest, finishJSTest); | 74 PermissionsHelper.setPermission('midi-sysex', 'granted').then(function() { |
| 75 test(false).then(test.bind(null, true)).then(finishJSTest, finishJSTest); |
| 76 }); |
77 | 77 |
78 </script> | 78 </script> |
79 </body> | 79 </body> |
80 </html> | 80 </html> |
OLD | NEW |