Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: third_party/WebKit/LayoutTests/webmidi/send-system-messages.html

Issue 1963063002: Web MIDI: Tune Request [0xf6] wasn't handled correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698