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

Side by Side Diff: LayoutTests/webmidi/send_messages.html

Issue 1051903002: Web MIDI: implement implicit open() on send() and setOnmidimessage() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: kouhei review Created 5 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8
9 description("Test if various kinds of MIDI messages can be validated.");
10
11 shouldBeDefined("testRunner.setMIDISysexPermission");
12 shouldBeDefined("navigator.requestMIDIAccess");
13
14 window.jsTestIsAsync = true;
15
16 testRunner.setMIDISysexPermission(true);
17
18 navigator.requestMIDIAccess({sysex: true}).then(function (a) {
19 output = a.outputs.values().next().value;
20
21 // Note on(off).
22 output.send([0xff, 0x90, 0x00, 0x00, 0x90, 0x07, 0x00]);
23
24 // Running status is not allowed in Web MIDI API.
25 shouldThrow('output.send([0x00, 0x01])');
26
27 // Unexpected End of Sysex.
28 shouldThrow('output.send([0xf7])');
29
30 // Unexpected reserved status bytes.
31 shouldThrow('output.send([0xf4])');
32 shouldThrow('output.send([0xf5])');
33 shouldThrow('output.send([0xf9])');
34 shouldThrow('output.send([0xfd])');
35
36 // Incomplete channel messages.
37 shouldThrow('output.send([0x80])');
38 shouldThrow('output.send([0x80, 0x00])');
39 shouldThrow('output.send([0x90])');
40 shouldThrow('output.send([0x90, 0x00])');
41 shouldThrow('output.send([0xa0])');
42 shouldThrow('output.send([0xa0, 0x00])');
43 shouldThrow('output.send([0xb0])');
44 shouldThrow('output.send([0xb0, 0x00])');
45 shouldThrow('output.send([0xc0])');
46 shouldThrow('output.send([0xd0])');
47 shouldThrow('output.send([0xe0])');
48 shouldThrow('output.send([0xe0, 0x00])');
49
50 // Incomplete system messages.
51 shouldThrow('output.send([0xf1])');
52 shouldThrow('output.send([0xf2])');
53 shouldThrow('output.send([0xf2, 0x00])');
54 shouldThrow('output.send([0xf3])');
55
56 // Invalid data bytes.
57 shouldThrow('output.send([0x80, 0x80, 0x00])');
58 shouldThrow('output.send([0x80, 0x00, 0x80])');
59
60 // Complete messages.
61 output.send([0x80, 0x00, 0x00]);
62 output.send([0x90, 0x00, 0x00]);
63 output.send([0xa0, 0x00, 0x00]);
64 output.send([0xb0, 0x00, 0x00]);
65 output.send([0xc0, 0x00]);
66 output.send([0xd0, 0x00]);
67 output.send([0xe0, 0x00, 0x00]);
68
69 // Real-Time messages.
70 output.send([0xf8]);
71 output.send([0xfa]);
72 output.send([0xfb]);
73 output.send([0xfc]);
74 output.send([0xfe]);
75 output.send([0xff]);
76
77 // 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]);
79
80 // Sysex messages.
81 output.send([0xf0, 0x00, 0x01, 0x02, 0x03, 0xf7]);
82 output.send([0xf0, 0xf8, 0xf7, 0xff]);
83 shouldThrow('output.send([0xf0, 0x80, 0xf7])');
84 shouldThrow('output.send([0xf0, 0xf0, 0xf7])');
85 shouldThrow('output.send([0xf0, 0xff, 0xf7, 0xf7])');
86
87 // Reserved status bytes.
88 shouldThrow('output.send([0xf4, 0x80, 0x00, 0x00])');
89 shouldThrow('output.send([0x80, 0xf4, 0x00, 0x00])');
90 shouldThrow('output.send([0x80, 0x00, 0xf4, 0x00])');
91 shouldThrow('output.send([0x80, 0x00, 0x00, 0xf4])');
92 shouldThrow('output.send([0xf0, 0xff, 0xf4, 0xf7])');
93
94 // Invalid timestamps.
95 shouldThrow('output.send([], NaN)');
96 shouldThrow('output.send([], Infinity)');
97 shouldThrow('output.send(new Uint8Array(), NaN)');
98 shouldThrow('output.send(new Uint8Array(), Infinity)');
99
100 finishJSTest();
101 }, function () {
102 testFailed("requestMIDIAccess() return an error.");
103 });
104
105 </script>
106 </body>
107 </html>
OLDNEW
« no previous file with comments | « LayoutTests/webmidi/send-messages-expected.txt ('k') | LayoutTests/webmidi/send_messages-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698