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 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 description("Tests navigator.requestMIDIAccess."); | 8 description("Tests navigator.requestMIDIAccess."); |
9 | 9 |
10 var access; | 10 var access; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // Test sending of MIDI data with a regular Array. | 49 // Test sending of MIDI data with a regular Array. |
50 output.send([0x90, 0x45, 0x7f]); | 50 output.send([0x90, 0x45, 0x7f]); |
51 | 51 |
52 // Test sending of MIDI data with a regular Array giving an explicit timesta
mp. | 52 // Test sending of MIDI data with a regular Array giving an explicit timesta
mp. |
53 output.send([0x90, 0x45, 0x7f], performance.now()); | 53 output.send([0x90, 0x45, 0x7f], performance.now()); |
54 | 54 |
55 // Test sending system exclusive messages. These should throw, since we don'
t have sysex access. | 55 // Test sending system exclusive messages. These should throw, since we don'
t have sysex access. |
56 shouldThrow('output.send([0xf1, 0x45, 0x7f])', '"SecurityError: Failed to ex
ecute \'send\' on \'MIDIOutput\': permission to send system exclusive messages i
s denied."'); | 56 shouldThrow('output.send([0xf1, 0x45, 0x7f])', '"SecurityError: Failed to ex
ecute \'send\' on \'MIDIOutput\': permission to send system exclusive messages i
s denied."'); |
57 | 57 |
58 // Now test System Exclusive access - our test mock should not allow this ty
pe of access. | 58 // Now test System Exclusive access - our test mock should not allow this ty
pe of access. |
59 shouldNotThrow("navigator.requestMIDIAccess({sysex: true}).then(successCallb
ack2, errorCallback2)"); | 59 navigator.requestMIDIAccess({sysex: true}).then(successCallback2, errorCallb
ack2); |
60 } | 60 } |
61 | 61 |
62 function errorCallback1(error) { | 62 function errorCallback1(error) { |
63 testFailed("requestMIDIAccess() error callback should not be called when req
uesting basic access."); | 63 testFailed("requestMIDIAccess() error callback should not be called when req
uesting basic access."); |
64 finishJSTest(); | 64 finishJSTest(); |
65 } | 65 } |
66 | 66 |
67 function successCallback2(access) { | 67 function successCallback2(access) { |
68 testFailed("requestMIDIAccess() was not correctly blocked for System Exclusi
ve access."); | 68 testFailed("requestMIDIAccess() was not correctly blocked for System Exclusi
ve access."); |
69 finishJSTest(); | 69 finishJSTest(); |
70 } | 70 } |
71 | 71 |
72 function errorCallback2(error) { | 72 function errorCallback2(error) { |
73 testPassed("requestMIDIAccess() was correctly blocked for System Exclusive a
ccess with error " + error + "."); | 73 testPassed("requestMIDIAccess() was correctly blocked for System Exclusive a
ccess with error " + error + "."); |
74 finishJSTest(); | 74 finishJSTest(); |
75 } | 75 } |
76 | 76 |
77 window.jsTestIsAsync = true; | 77 window.jsTestIsAsync = true; |
78 | 78 |
79 // Test basic access, with no System Exclusive. | 79 // Test basic access, with no System Exclusive. |
80 shouldNotThrow("navigator.requestMIDIAccess().then(successCallback1, errorCallba
ck1)"); | 80 navigator.requestMIDIAccess().then(successCallback1, errorCallback1); |
81 | 81 |
82 </script> | 82 </script> |
83 </body> | 83 </body> |
84 </html> | 84 </html> |
OLD | NEW |