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 | 8 |
9 description("Test if sysex permission request is handled."); | 9 description("Test if sysex permission request is handled."); |
10 | 10 |
11 shouldBeDefined("testRunner.setMIDISysExPermission"); | 11 // FIXME: remove following workaround once testRunner in Chromium has a new inte rface. |
12 if (!testRunner.setMIDISysexPermission) | |
13 testRunner.setMIDISysexPermission = testRunner.setMIDISysExPermission; | |
tkent
2014/03/24 13:57:36
nit: We use four spaces indentation.
Takashi Toyoshima
2014/03/24 14:36:00
Done.
| |
14 | |
15 shouldBeDefined("testRunner.setMIDISysexPermission"); | |
12 shouldBeDefined("navigator.requestMIDIAccess"); | 16 shouldBeDefined("navigator.requestMIDIAccess"); |
13 | 17 |
14 window.jsTestIsAsync = true; | 18 window.jsTestIsAsync = true; |
15 | 19 |
16 var finishSuccessfully = function () { | 20 var finishSuccessfully = function () { |
17 testPassed("all permission request rests pass successfully."); | 21 testPassed("all permission request rests pass successfully."); |
18 finishJSTest(); | 22 finishJSTest(); |
19 } | 23 } |
20 | 24 |
21 var rejectSysEx = function (next) { | 25 var rejectSysEx = function (next) { |
22 testRunner.setMIDISysExPermission(false); | 26 testRunner.setMIDISysexPermission(false); |
23 promise = navigator.requestMIDIAccess({sysex: true}); | 27 promise = navigator.requestMIDIAccess({sysex: true}); |
24 shouldBeDefined("promise"); | 28 shouldBeDefined("promise"); |
25 shouldBeDefined("promise.then"); | 29 shouldBeDefined("promise.then"); |
26 promise.then(function(access) { | 30 promise.then(function(access) { |
27 testFailed("sysex permission request should be rejected."); | 31 testFailed("sysex permission request should be rejected."); |
28 finishJSTest(); | 32 finishJSTest(); |
29 }, function (error) { | 33 }, function (error) { |
30 testPassed("sysex permission request is successfully rejected."); | 34 testPassed("sysex permission request is successfully rejected."); |
31 if (next) | 35 if (next) |
32 next(); | 36 next(); |
33 else | 37 else |
34 finishSuccessfully(); | 38 finishSuccessfully(); |
35 }); | 39 }); |
36 } | 40 } |
37 | 41 |
38 var acceptSysEx = function (next) { | 42 var acceptSysEx = function (next) { |
39 testRunner.setMIDISysExPermission(true); | 43 testRunner.setMIDISysexPermission(true); |
40 promise = navigator.requestMIDIAccess({sysex: true}); | 44 promise = navigator.requestMIDIAccess({sysex: true}); |
41 shouldBeDefined("promise"); | 45 shouldBeDefined("promise"); |
42 shouldBeDefined("promise.then"); | 46 shouldBeDefined("promise.then"); |
43 promise.then(function(access) { | 47 promise.then(function(a) { |
44 testPassed("sysex permission request is successfully accepted."); | 48 testPassed("sysex permission request is successfully accepted."); |
49 access = a; | |
50 shouldBeDefined("access"); | |
51 shouldBeDefined("access.sysexEnabled"); | |
52 shouldBeTrue("access.sysexEnabled"); | |
45 if (next) | 53 if (next) |
46 next(); | 54 next(); |
47 else | 55 else |
48 finishSuccessfully(); | 56 finishSuccessfully(); |
49 }, function (error) { | 57 }, function (error) { |
50 testFailed("sysex permission request should be accepted."); | 58 testFailed("sysex permission request should be accepted."); |
51 finishJSTest(); | 59 finishJSTest(); |
52 }); | 60 }); |
53 } | 61 } |
54 | 62 |
55 rejectSysEx(acceptSysEx); | 63 rejectSysEx(acceptSysEx); |
56 | 64 |
57 </script> | 65 </script> |
58 </body> | 66 </body> |
59 </html> | 67 </html> |
OLD | NEW |