| 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..83efe331041d2b90e38451a01fca46bc4a432b87
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/webmidi/send-system-messages.html
|
| @@ -0,0 +1,62 @@
|
| +<!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]]);
|
| +
|
| +let reservedSystemMessages = [[0xf4], [0xf5]];
|
| +let systemExclusiveMessages = [[0xf0, 0xf7], [0xf0, 0x00, 0xf7]];
|
| +
|
| +PermissionsHelper.setPermission("midi", "granted").then(() => {
|
| + return navigator.requestMIDIAccess();
|
| +}).then(a => {
|
| + output = a.outputs.values().next().value;
|
| +
|
| + for (let message of systemMessages) {
|
| + output.send(message);
|
| + testPassed("output.send([" + message + "])");
|
| + }
|
| +
|
| + for (message of reservedSystemMessages) {
|
| + shouldThrow("output.send(message)");
|
| + }
|
| +
|
| + for (message of systemExclusiveMessages) {
|
| + shouldThrow("output.send(message)");
|
| + }
|
| +
|
| + finishJSTest();
|
| +}).catch(e => {
|
| + testFailed(e.toString());
|
| + finishJSTest();
|
| +});
|
| +
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|