Chromium Code Reviews| 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 | 8 |
| 9 description("Test if various kinds of MIDI messages can be validated."); | 9 description("Test if various kinds of MIDI messages can be validated."); |
| 10 | 10 |
| 11 shouldBeDefined("testRunner.setMIDISysExPermission"); | 11 // FIXME: remove following workaround once testRunner in Chromium has a new inte rface. |
| 12 if (!testRunner.setMIDISysexPermission) | |
| 13 testRunner.setMIDISysexPermission = testRunner.setMIDISysExPermission; | |
|
tkent
2014/03/24 13:57:36
nit: We use four spaces indentation.
Takashi Toyoshima
2014/03/24 14:36:00
Done.
| |
| 14 | |
| 15 shouldBeDefined("testRunner.setMIDISysexPermission"); | |
| 12 shouldBeDefined("navigator.requestMIDIAccess"); | 16 shouldBeDefined("navigator.requestMIDIAccess"); |
| 13 | 17 |
| 14 window.jsTestIsAsync = true; | 18 window.jsTestIsAsync = true; |
| 15 | 19 |
| 16 testRunner.setMIDISysExPermission(true); | 20 testRunner.setMIDISysexPermission(true); |
| 17 | 21 |
| 18 navigator.requestMIDIAccess({sysex: true}).then(function (a) { | 22 navigator.requestMIDIAccess({sysex: true}).then(function (a) { |
| 19 output = a.outputs()[0]; | 23 output = a.outputs()[0]; |
| 20 | 24 |
| 21 // Note on(off). | 25 // Note on(off). |
| 22 output.send([0xff, 0x90, 0x00, 0x00, 0x90, 0x07, 0x00]); | 26 output.send([0xff, 0x90, 0x00, 0x00, 0x90, 0x07, 0x00]); |
| 23 | 27 |
| 24 // Running status is not allowed in Web MIDI API. | 28 // Running status is not allowed in Web MIDI API. |
| 25 shouldThrow('output.send([0x00, 0x01])'); | 29 shouldThrow('output.send([0x00, 0x01])'); |
| 26 | 30 |
| 27 // Unexpected End of SysEx. | 31 // Unexpected End of Sysex. |
| 28 shouldThrow('output.send([0xf7])'); | 32 shouldThrow('output.send([0xf7])'); |
| 29 | 33 |
| 30 // Unexpected reserved status bytes. | 34 // Unexpected reserved status bytes. |
| 31 shouldThrow('output.send([0xf4])'); | 35 shouldThrow('output.send([0xf4])'); |
| 32 shouldThrow('output.send([0xf5])'); | 36 shouldThrow('output.send([0xf5])'); |
| 33 shouldThrow('output.send([0xf9])'); | 37 shouldThrow('output.send([0xf9])'); |
| 34 shouldThrow('output.send([0xfd])'); | 38 shouldThrow('output.send([0xfd])'); |
| 35 | 39 |
| 36 // Incomplete channel messages. | 40 // Incomplete channel messages. |
| 37 shouldThrow('output.send([0x80])'); | 41 shouldThrow('output.send([0x80])'); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 output.send([0xf8]); | 74 output.send([0xf8]); |
| 71 output.send([0xfa]); | 75 output.send([0xfa]); |
| 72 output.send([0xfb]); | 76 output.send([0xfb]); |
| 73 output.send([0xfc]); | 77 output.send([0xfc]); |
| 74 output.send([0xfe]); | 78 output.send([0xfe]); |
| 75 output.send([0xff]); | 79 output.send([0xff]); |
| 76 | 80 |
| 77 // Valid messages with Real-Time messages. | 81 // Valid messages with Real-Time messages. |
| 78 output.send([0x90, 0xff, 0xff, 0x00, 0xff, 0x01, 0xff, 0x80, 0xff, 0x00, 0xf f, 0xff, 0x00, 0xff, 0xff]); | 82 output.send([0x90, 0xff, 0xff, 0x00, 0xff, 0x01, 0xff, 0x80, 0xff, 0x00, 0xf f, 0xff, 0x00, 0xff, 0xff]); |
| 79 | 83 |
| 80 // SysEx messages. | 84 // Sysex messages. |
| 81 output.send([0xf0, 0x00, 0x01, 0x02, 0x03, 0xf7]); | 85 output.send([0xf0, 0x00, 0x01, 0x02, 0x03, 0xf7]); |
| 82 output.send([0xf0, 0xf8, 0xf7, 0xff]); | 86 output.send([0xf0, 0xf8, 0xf7, 0xff]); |
| 83 shouldThrow('output.send([0xf0, 0x80, 0xf7])'); | 87 shouldThrow('output.send([0xf0, 0x80, 0xf7])'); |
| 84 shouldThrow('output.send([0xf0, 0xf0, 0xf7])'); | 88 shouldThrow('output.send([0xf0, 0xf0, 0xf7])'); |
| 85 shouldThrow('output.send([0xf0, 0xff, 0xf7, 0xf7])'); | 89 shouldThrow('output.send([0xf0, 0xff, 0xf7, 0xf7])'); |
| 86 | 90 |
| 87 // Reserved status bytes. | 91 // Reserved status bytes. |
| 88 shouldThrow('output.send([0xf4, 0x80, 0x00, 0x00])'); | 92 shouldThrow('output.send([0xf4, 0x80, 0x00, 0x00])'); |
| 89 shouldThrow('output.send([0x80, 0xf4, 0x00, 0x00])'); | 93 shouldThrow('output.send([0x80, 0xf4, 0x00, 0x00])'); |
| 90 shouldThrow('output.send([0x80, 0x00, 0xf4, 0x00])'); | 94 shouldThrow('output.send([0x80, 0x00, 0xf4, 0x00])'); |
| 91 shouldThrow('output.send([0x80, 0x00, 0x00, 0xf4])'); | 95 shouldThrow('output.send([0x80, 0x00, 0x00, 0xf4])'); |
| 92 shouldThrow('output.send([0xf0, 0xff, 0xf4, 0xf7])'); | 96 shouldThrow('output.send([0xf0, 0xff, 0xf4, 0xf7])'); |
| 93 | 97 |
| 94 finishJSTest(); | 98 finishJSTest(); |
| 95 }, function () { | 99 }, function () { |
| 96 testFailed("requestMIDIAccess() return an error."); | 100 testFailed("requestMIDIAccess() return an error."); |
| 97 }); | 101 }); |
| 98 | 102 |
| 99 </script> | 103 </script> |
| 100 </body> | 104 </body> |
| 101 </html> | 105 </html> |
| OLD | NEW |