Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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> | |
| 9 | |
| 10 description("Test if various kinds of system messages can be validated."); | |
| 11 | |
| 12 window.jsTestIsAsync = true; | |
| 13 | |
| 14 // See https://www.midi.org/specifications/item/table-1-summary-of-midi-message | |
| 15 let systemMessages = (function(messages) { | |
| 16 // Prepare various combinations of messages from input message array. | |
| 17 let combinations = []; | |
| 18 for (let i = 0; i < messages.length; ++i) { | |
| 19 combinations.push(messages[i]); | |
| 20 for (let j = 0; j < messages.length; ++j) { | |
| 21 combinations.push(messages[i].concat(messages[j])); | |
| 22 for (let k = 0; k < messages.length; ++k) { | |
| 23 combinations.push(messages[i].concat(messages[j], messages[k])); | |
| 24 } | |
| 25 } | |
| 26 } | |
| 27 return combinations; | |
| 28 })([[0xf1, 0x00], | |
| 29 [0xf2, 0x00, 0x00], | |
| 30 [0xf3, 0x00], | |
| 31 [0xf6]]); | |
| 32 | |
| 33 PermissionsHelper.setPermission('midi', 'granted').then(() => { | |
| 34 return navigator.requestMIDIAccess(); | |
| 35 }).then(a => { | |
| 36 output = a.outputs.values().next().value; | |
| 37 | |
| 38 for (message of systemMessages) { | |
| 39 shouldNotThrow('output.send(message)'); | |
|
yhirano
2016/05/10 16:08:24
optional: You don't need shouldNotThrow because if
Takashi Toyoshima
2016/05/11 05:59:16
Done.
| |
| 40 } | |
| 41 | |
| 42 finishJSTest(); | |
| 43 }).catch(e => { | |
| 44 testFailed("requestMIDIAccess() return an error."); | |
| 45 finishJSTest(); | |
| 46 }); | |
| 47 | |
| 48 </script> | |
| 49 </body> | |
| 50 </html> | |
| OLD | NEW |