OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../resources/js-test.js"></script> |
| 5 <script src="state-check-utils.js"></script> |
| 6 </head> |
| 7 <body> |
| 8 <script> |
| 9 description("Tests MIDIPort.open and MIDIPort.close."); |
| 10 |
| 11 function runTests(port) { |
| 12 return Promise.resolve().then(checkStateTransition.bind(undefined, { |
| 13 port: port, |
| 14 method: "close", |
| 15 initialconnection: "closed", |
| 16 finalconnection: "closed", |
| 17 })).then(checkStateTransition.bind(undefined, { |
| 18 port: port, |
| 19 method: "open", |
| 20 initialconnection: "closed", |
| 21 finalconnection: "open", |
| 22 })).then(checkStateTransition.bind(undefined, { |
| 23 port: port, |
| 24 method: "open", |
| 25 initialconnection: "open", |
| 26 finalconnection: "open", |
| 27 })).then(checkStateTransition.bind(undefined, { |
| 28 port: port, |
| 29 method: "close", |
| 30 initialconnection: "open", |
| 31 finalconnection: "closed", |
| 32 })); |
| 33 } |
| 34 |
| 35 function successAccessCallback(a) { |
| 36 window.access = a; |
| 37 testPassed("requestMIDIAccess() succeeded with access " + access + "."); |
| 38 |
| 39 runTests(access.inputs.values().next().value) |
| 40 .then(finishJSTest, finishJSTest); |
| 41 } |
| 42 |
| 43 function errorAccessCallback(error) { |
| 44 testFailed("requestMIDIAccess() error callback should not be called when req
uesting basic access."); |
| 45 finishJSTest(); |
| 46 } |
| 47 |
| 48 window.jsTestIsAsync = true; |
| 49 |
| 50 // Test MIDIPort state transition by open() and close(). |
| 51 navigator.requestMIDIAccess().then(successAccessCallback, errorAccessCallback); |
| 52 |
| 53 </script> |
| 54 </body> |
| 55 </html> |
OLD | NEW |