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; |
(...skipping 24 matching lines...) Expand all Loading... |
35 debug("for (var input of inputs)"); | 35 debug("for (var input of inputs)"); |
36 for (var entry of inputs) { | 36 for (var entry of inputs) { |
37 window.entry = entry; | 37 window.entry = entry; |
38 shouldBe("entry[0]", "inputKey"); | 38 shouldBe("entry[0]", "inputKey"); |
39 shouldBe("entry[1]", "input"); | 39 shouldBe("entry[1]", "input"); |
40 } | 40 } |
41 shouldBeTrue("inputs.has('MockInputID')"); | 41 shouldBeTrue("inputs.has('MockInputID')"); |
42 shouldBeFalse("inputs.has('MockOutputID')"); | 42 shouldBeFalse("inputs.has('MockOutputID')"); |
43 shouldBe("inputs.get('MockInputID')", "input"); | 43 shouldBe("inputs.get('MockInputID')", "input"); |
44 shouldBeUndefined("inputs.get('MockOutputID')"); | 44 shouldBeUndefined("inputs.get('MockOutputID')"); |
| 45 debug("inputs.forEach(...)"); |
| 46 inputs.forEach(function (input, key, map) { |
| 47 window.forEachInput = input; |
| 48 shouldBe("forEachInput", "input"); |
| 49 window.forEachInputKey = key; |
| 50 shouldBe("forEachInputKey", "inputKey"); |
| 51 window.forEachMap = map; |
| 52 shouldBe("forEachMap", "inputs"); |
| 53 }); |
45 } | 54 } |
46 | 55 |
47 function checkOutputMap(outputs) { | 56 function checkOutputMap(outputs) { |
48 window.outputs = outputs; | 57 window.outputs = outputs; |
49 debug("for (var output of outputs.values())"); | 58 debug("for (var output of outputs.values())"); |
50 for (var output of outputs.values()) { | 59 for (var output of outputs.values()) { |
51 window.output = output; | 60 window.output = output; |
52 shouldBeEqualToString("output.id", "MockOutputID"); | 61 shouldBeEqualToString("output.id", "MockOutputID"); |
53 shouldBeEqualToString("output.manufacturer", "MockOutputManufacturer"); | 62 shouldBeEqualToString("output.manufacturer", "MockOutputManufacturer"); |
54 shouldBeEqualToString("output.name", "MockOutputName"); | 63 shouldBeEqualToString("output.name", "MockOutputName"); |
(...skipping 13 matching lines...) Expand all Loading... |
68 debug("for (var output of outputs)"); | 77 debug("for (var output of outputs)"); |
69 for (var entry of outputs) { | 78 for (var entry of outputs) { |
70 window.entry = entry; | 79 window.entry = entry; |
71 shouldBe("entry[0]", "outputKey"); | 80 shouldBe("entry[0]", "outputKey"); |
72 shouldBe("entry[1]", "output"); | 81 shouldBe("entry[1]", "output"); |
73 } | 82 } |
74 shouldBeTrue("outputs.has('MockOutputID')"); | 83 shouldBeTrue("outputs.has('MockOutputID')"); |
75 shouldBeFalse("outputs.has('MockInputID')"); | 84 shouldBeFalse("outputs.has('MockInputID')"); |
76 shouldBe("outputs.get('MockOutputID')", "output"); | 85 shouldBe("outputs.get('MockOutputID')", "output"); |
77 shouldBeUndefined("outputs.get('MockInputID')"); | 86 shouldBeUndefined("outputs.get('MockInputID')"); |
| 87 debug("outputs.forEach(...)"); |
| 88 outputs.forEach(function (output, key, map) { |
| 89 window.forEachOutput = output; |
| 90 shouldBe("forEachOutput", "output"); |
| 91 window.forEachOutputKey = key; |
| 92 shouldBe("forEachOutputKey", "outputKey"); |
| 93 window.forEachMap = map; |
| 94 shouldBe("forEachMap", "outputs"); |
| 95 }); |
78 } | 96 } |
79 | 97 |
80 function successCallback1(a) { | 98 function successCallback1(a) { |
81 access = a; | 99 access = a; |
82 | 100 |
83 testPassed("requestMIDIAccess() succeeded with access " + access + "."); | 101 testPassed("requestMIDIAccess() succeeded with access " + access + "."); |
84 | 102 |
85 // Validate the values of the attributes on the access. | 103 // Validate the values of the attributes on the access. |
86 shouldBeDefined("access.sysexEnabled"); | 104 shouldBeDefined("access.sysexEnabled"); |
87 shouldBeFalse("access.sysexEnabled"); | 105 shouldBeFalse("access.sysexEnabled"); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 147 } |
130 | 148 |
131 window.jsTestIsAsync = true; | 149 window.jsTestIsAsync = true; |
132 | 150 |
133 // Test basic access, with no System Exclusive. | 151 // Test basic access, with no System Exclusive. |
134 navigator.requestMIDIAccess().then(successCallback1, errorCallback1); | 152 navigator.requestMIDIAccess().then(successCallback1, errorCallback1); |
135 | 153 |
136 </script> | 154 </script> |
137 </body> | 155 </body> |
138 </html> | 156 </html> |
OLD | NEW |