OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <link rel="stylesheet" href="../fast/js/resources/js-test-style.css"> | 4 <link rel="stylesheet" href="../fast/js/resources/js-test-style.css"> |
5 <script src="../fast/js/resources/js-test-pre.js"></script> | 5 <script src="../fast/js/resources/js-test-pre.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <script> | 8 <script> |
9 description("Tests navigator.requestMIDIAccess failure."); | 9 description("Tests navigator.requestMIDIAccess failure."); |
10 | 10 |
11 function successCallback(access) { | 11 function successCallback(access) { |
12 testFailed("requestMIDIAccess() does not fail unexpectedly."); | 12 testFailed("requestMIDIAccess() does not fail unexpectedly."); |
13 finishJSTest(); | 13 finishJSTest(); |
14 } | 14 } |
15 | 15 |
16 function errorCallback(error) { | 16 function errorCallback(error) { |
17 errorName = error.name; | 17 errorName = error.name; |
18 shouldBe("errorName", "'InvalidStateError'"); | 18 shouldBe("errorName", "'InvalidStateError'"); |
19 testPassed("requestMIDIAccess() fail as expected."); | 19 testPassed("requestMIDIAccess() fail as expected."); |
20 finishJSTest(); | 20 finishJSTest(); |
21 } | 21 } |
22 | 22 |
23 window.jsTestIsAsync = true; | 23 window.jsTestIsAsync = true; |
24 | 24 |
25 // set testRunner configuration so that requestMIDIAccess returns "InvalidStateE
rror". | 25 // set testRunner configuration so that requestMIDIAccess returns "InvalidStateE
rror". |
26 testRunner.setMIDIAccessorResult(false); | 26 testRunner.setMIDIAccessorResult(false); |
27 shouldNotThrow("navigator.requestMIDIAccess().then(successCallback, errorCallbac
k)"); | 27 shouldNotThrow("navigator.requestMIDIAccess().then(successCallback, errorCallbac
k)"); |
28 | 28 |
29 </script> | 29 </script> |
30 <script src="../fast/js/resources/js-test-post.js"></script> | |
31 </body> | 30 </body> |
32 </html> | 31 </html> |
OLD | NEW |