| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../resources/js-test.js"></script> |
| </head> |
| <body> |
| <script> |
| description("Tests navigator.requestMIDIAccess failure."); |
| |
| function successCallback(access) { |
| testFailed("requestMIDIAccess() does not fail unexpectedly."); |
| finishJSTest(); |
| } |
| |
| function errorCallback(error) { |
| errorName = error.name; |
| shouldBe("errorName", "'InvalidStateError'"); |
| testPassed("requestMIDIAccess() fail as expected."); |
| finishJSTest(); |
| } |
| |
| window.jsTestIsAsync = true; |
| |
| // set testRunner configuration so that requestMIDIAccess returns "InvalidStateError". |
| testRunner.setMIDIAccessorResult(false); |
| navigator.requestMIDIAccess().then(successCallback, errorCallback); |
| |
| </script> |
| </body> |
| </html> |