| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 output.send([0x90, 0x45, 0x7f], performance.now()); | 54 output.send([0x90, 0x45, 0x7f], performance.now()); |
| 55 testPassed("a note on message is sent with timestamp"); | 55 testPassed("a note on message is sent with timestamp"); |
| 56 | 56 |
| 57 // Test sending of invalid MIDI data. | 57 // Test sending of invalid MIDI data. |
| 58 shouldThrow('output.send([0xfff, 0x45, 0x7f])'); | 58 shouldThrow('output.send([0xfff, 0x45, 0x7f])'); |
| 59 | 59 |
| 60 // Test sending system exclusive messages. These should throw, since we don'
t have sysex access. | 60 // Test sending system exclusive messages. These should throw, since we don'
t have sysex access. |
| 61 shouldThrow('output.send([0xf0, 0x45, 0xf7])'); | 61 shouldThrow('output.send([0xf0, 0x45, 0xf7])'); |
| 62 | 62 |
| 63 // Now test System Exclusive access - our test mock should not allow this ty
pe of access. | 63 // Now test System Exclusive access - our test mock should not allow this ty
pe of access. |
| 64 navigator.requestMIDIAccess({sysex: true}).then(successCallback2, errorCallb
ack2); | 64 shouldNotThrow("navigator.requestMIDIAccess({sysex: true}).then(successCallb
ack2, errorCallback2)"); |
| 65 } | 65 } |
| 66 | 66 |
| 67 function errorCallback1(error) { | 67 function errorCallback1(error) { |
| 68 testFailed("requestMIDIAccess() error callback should not be called when req
uesting basic access."); | 68 testFailed("requestMIDIAccess() error callback should not be called when req
uesting basic access."); |
| 69 finishJSTest(); | 69 finishJSTest(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 function successCallback2(access) { | 72 function successCallback2(access) { |
| 73 testFailed("requestMIDIAccess() was not correctly blocked for System Exclusi
ve access."); | 73 testFailed("requestMIDIAccess() was not correctly blocked for System Exclusi
ve access."); |
| 74 finishJSTest(); | 74 finishJSTest(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 function errorCallback2(error) { | 77 function errorCallback2(error) { |
| 78 testPassed("requestMIDIAccess() was correctly blocked for System Exclusive a
ccess with error " + error + "."); | 78 testPassed("requestMIDIAccess() was correctly blocked for System Exclusive a
ccess with error " + error + "."); |
| 79 finishJSTest(); | 79 finishJSTest(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 window.jsTestIsAsync = true; | 82 window.jsTestIsAsync = true; |
| 83 | 83 |
| 84 // Test basic access, with no System Exclusive. | 84 // Test basic access, with no System Exclusive. |
| 85 navigator.requestMIDIAccess().then(successCallback1, errorCallback1); | 85 shouldNotThrow("navigator.requestMIDIAccess().then(successCallback1, errorCallba
ck1)"); |
| 86 | 86 |
| 87 </script> | 87 </script> |
| 88 </body> | 88 </body> |
| 89 </html> | 89 </html> |
| OLD | NEW |