Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/webmidi/send-system-messages.html |
| diff --git a/third_party/WebKit/LayoutTests/webmidi/send-system-messages.html b/third_party/WebKit/LayoutTests/webmidi/send-system-messages.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1b191a033d750064a24491b6ff610a9992550e5c |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/webmidi/send-system-messages.html |
| @@ -0,0 +1,50 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<script src="../resources/js-test.js"></script> |
| +<script src="../http/tests/resources/permissions-helper.js"></script> |
| +</head> |
| +<body> |
| +<script> |
| + |
| +description("Test if various kinds of system messages can be validated."); |
| + |
| +window.jsTestIsAsync = true; |
| + |
| +// See https://www.midi.org/specifications/item/table-1-summary-of-midi-message |
| +let systemMessages = (function(messages) { |
| + // Prepare various combinations of messages from input message array. |
| + let combinations = []; |
| + for (let i = 0; i < messages.length; ++i) { |
| + combinations.push(messages[i]); |
| + for (let j = 0; j < messages.length; ++j) { |
| + combinations.push(messages[i].concat(messages[j])); |
| + for (let k = 0; k < messages.length; ++k) { |
| + combinations.push(messages[i].concat(messages[j], messages[k])); |
| + } |
| + } |
| + } |
| + return combinations; |
| +})([[0xf1, 0x00], |
| + [0xf2, 0x00, 0x00], |
| + [0xf3, 0x00], |
| + [0xf6]]); |
| + |
| +PermissionsHelper.setPermission('midi', 'granted').then(() => { |
| + return navigator.requestMIDIAccess(); |
| +}).then(a => { |
| + output = a.outputs.values().next().value; |
| + |
| + for (message of systemMessages) { |
| + 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.
|
| + } |
| + |
| + finishJSTest(); |
| +}).catch(e => { |
| + testFailed("requestMIDIAccess() return an error."); |
| + finishJSTest(); |
| +}); |
| + |
| +</script> |
| +</body> |
| +</html> |