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 description("Tests navigator.requestMIDIAccess."); | 8 description("Tests navigator.requestMIDIAccess."); |
9 | 9 |
10 var access; | 10 var access; |
11 var input; | 11 var input; |
12 var output; | 12 var output; |
13 | 13 |
14 function checkInputMap(inputs) { | 14 function checkInputMap(inputs) { |
15 window.inputs = inputs; | 15 window.inputs = inputs; |
16 debug("for (var input of inputs.values())"); | 16 debug("for (var input of inputs.values())"); |
17 for (var input of inputs.values()) { | 17 for (var input of inputs.values()) { |
18 window.input = input; | 18 window.input = input; |
19 shouldBeEqualToString("input.id", "MockInputID"); | 19 shouldBeEqualToString("input.id", "MockInputID"); |
20 shouldBeEqualToString("input.manufacturer", "MockInputManufacturer"); | 20 shouldBeEqualToString("input.manufacturer", "MockInputManufacturer"); |
21 shouldBeEqualToString("input.name", "MockInputName"); | 21 shouldBeEqualToString("input.name", "MockInputName"); |
22 shouldBeEqualToString("input.version", "MockInputVersion"); | 22 shouldBeEqualToString("input.version", "MockInputVersion"); |
23 // FIXME: Once Web MIDI introduces open(), the initial state will be | 23 shouldBeEqualToString("input.state", "connected"); |
24 // changed to "connected". | |
25 shouldBeEqualToString("input.state", "opened"); | |
26 shouldBeEqualToString("input.type", "input"); | 24 shouldBeEqualToString("input.type", "input"); |
27 } | 25 } |
28 debug("for (var input of inputs.keys())"); | 26 debug("for (var input of inputs.keys())"); |
29 for (var key of inputs.keys()) { | 27 for (var key of inputs.keys()) { |
30 window.inputKey = key; | 28 window.inputKey = key; |
31 shouldBeEqualToString("inputKey", "MockInputID"); | 29 shouldBeEqualToString("inputKey", "MockInputID"); |
32 } | 30 } |
33 debug("for (var input of inputs.entries())"); | 31 debug("for (var input of inputs.entries())"); |
34 for (var entry of inputs.entries()) { | 32 for (var entry of inputs.entries()) { |
35 window.entry = entry; | 33 window.entry = entry; |
(...skipping 23 matching lines...) Expand all Loading... |
59 | 57 |
60 function checkOutputMap(outputs) { | 58 function checkOutputMap(outputs) { |
61 window.outputs = outputs; | 59 window.outputs = outputs; |
62 debug("for (var output of outputs.values())"); | 60 debug("for (var output of outputs.values())"); |
63 for (var output of outputs.values()) { | 61 for (var output of outputs.values()) { |
64 window.output = output; | 62 window.output = output; |
65 shouldBeEqualToString("output.id", "MockOutputID"); | 63 shouldBeEqualToString("output.id", "MockOutputID"); |
66 shouldBeEqualToString("output.manufacturer", "MockOutputManufacturer"); | 64 shouldBeEqualToString("output.manufacturer", "MockOutputManufacturer"); |
67 shouldBeEqualToString("output.name", "MockOutputName"); | 65 shouldBeEqualToString("output.name", "MockOutputName"); |
68 shouldBeEqualToString("output.version", "MockOutputVersion"); | 66 shouldBeEqualToString("output.version", "MockOutputVersion"); |
69 // FIXME: Once Web MIDI introduces open(), the initial state will be | 67 shouldBeEqualToString("output.state", "connected"); |
70 // changed to "connected". | |
71 shouldBeEqualToString("output.state", "opened"); | |
72 shouldBeEqualToString("output.type", "output"); | 68 shouldBeEqualToString("output.type", "output"); |
73 } | 69 } |
74 debug("for (var output of outputs.keys())"); | 70 debug("for (var output of outputs.keys())"); |
75 for (var key of outputs.keys()) { | 71 for (var key of outputs.keys()) { |
76 window.outputKey = key; | 72 window.outputKey = key; |
77 shouldBeEqualToString("outputKey", "MockOutputID"); | 73 shouldBeEqualToString("outputKey", "MockOutputID"); |
78 } | 74 } |
79 debug("for (var output of outputs.entries())"); | 75 debug("for (var output of outputs.entries())"); |
80 for (var entry of outputs.entries()) { | 76 for (var entry of outputs.entries()) { |
81 window.entry = entry; | 77 window.entry = entry; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 151 } |
156 | 152 |
157 window.jsTestIsAsync = true; | 153 window.jsTestIsAsync = true; |
158 | 154 |
159 // Test basic access, with no System Exclusive. | 155 // Test basic access, with no System Exclusive. |
160 navigator.requestMIDIAccess().then(successCallback1, errorCallback1); | 156 navigator.requestMIDIAccess().then(successCallback1, errorCallback1); |
161 | 157 |
162 </script> | 158 </script> |
163 </body> | 159 </body> |
164 </html> | 160 </html> |
OLD | NEW |