Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: LayoutTests/webmidi/permission.html

Issue 77773003: Make WebMIDI use blink Promise. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/webmidi/permission-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 shouldBeDefined("testRunner.setMIDISysExPermission");
12 shouldBeDefined("navigator.requestMIDIAccess"); 12 shouldBeDefined("navigator.requestMIDIAccess");
13 13
14 window.jsTestIsAsync = true; 14 window.jsTestIsAsync = true;
15 15
16 var finishSuccessfully = function () { 16 var finishSuccessfully = function () {
17 testPassed("all permission request rests pass successfully."); 17 testPassed("all permission request rests pass successfully.");
18 finishJSTest(); 18 finishJSTest();
19 } 19 }
20 20
21 var rejectSysEx = function (next) { 21 var rejectSysEx = function (next) {
22 testRunner.setMIDISysExPermission(false); 22 testRunner.setMIDISysExPermission(false);
23 shouldNotThrow("promise = navigator.requestMIDIAccess({sysex: true})"); 23 promise = navigator.requestMIDIAccess({sysex: true});
24 shouldBeDefined("promise"); 24 shouldBeDefined("promise");
25 shouldBeDefined("promise.then"); 25 shouldBeDefined("promise.then");
26 promise.then(function(access) { 26 promise.then(function(access) {
27 testFailed("sysex permission request should be rejected."); 27 testFailed("sysex permission request should be rejected.");
28 finishJSTest(); 28 finishJSTest();
29 }, function (error) { 29 }, function (error) {
30 testPassed("sysex permission request is successfully rejected."); 30 testPassed("sysex permission request is successfully rejected.");
31 if (next) 31 if (next)
32 next(); 32 next();
33 else 33 else
34 finishSuccessfully(); 34 finishSuccessfully();
35 }); 35 });
36 } 36 }
37 37
38 var acceptSysEx = function (next) { 38 var acceptSysEx = function (next) {
39 testRunner.setMIDISysExPermission(true); 39 testRunner.setMIDISysExPermission(true);
40 shouldNotThrow("promise = navigator.requestMIDIAccess({sysex: true})"); 40 promise = navigator.requestMIDIAccess({sysex: true});
41 shouldBeDefined("promise"); 41 shouldBeDefined("promise");
42 shouldBeDefined("promise.then"); 42 shouldBeDefined("promise.then");
43 promise.then(function(access) { 43 promise.then(function(access) {
44 testPassed("sysex permission request is successfully accepted."); 44 testPassed("sysex permission request is successfully accepted.");
45 if (next) 45 if (next)
46 next(); 46 next();
47 else 47 else
48 finishSuccessfully(); 48 finishSuccessfully();
49 }, function (error) { 49 }, function (error) {
50 testFailed("sysex permission request should be accepted."); 50 testFailed("sysex permission request should be accepted.");
51 finishJSTest(); 51 finishJSTest();
52 }); 52 });
53 } 53 }
54 54
55 rejectSysEx(acceptSysEx); 55 rejectSysEx(acceptSysEx);
56 56
57 </script> 57 </script>
58 </body> 58 </body>
59 </html> 59 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/webmidi/permission-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698