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