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

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

Issue 17619003: Fulfill or reject MIDIAccessPromise from MIDIAccessor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move layout test from fast/webmidi to webmidi Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
5 <script src="../fast/js/resources/js-test-pre.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
10 <script>
11 description("Tests navigator.requestMIDIAccess.");
12
13 var access;
14
15 function successCallback1(a) {
16 access = a;
17
18 testPassed('requestMIDIAccess() succeeded with access ' + access + '.');
19
20 // Validate that we have one mock input and one mock output.
21 shouldBe('access.inputs().length', '1');
22 shouldBe('access.outputs().length', '1');
23
24 var inputs = access.inputs();
25 var outputs = access.outputs();
26 var input = inputs[0];
27 var output = outputs[0];
28
29 // Validate the values of the attributes on the input and output.
30 if (input.id == "MockInputID" &&
31 input.manufacturer == "MockInputManufacturer" &&
32 input.name == "MockInputName" &&
33 input.version == "MockInputVersion") {
34 testPassed('input attributes are correct');
35 } else {
36 testFailed('input attributes are not correct');
37 }
38
39 if (output.id == "MockOutputID" &&
40 output.manufacturer == "MockOutputManufacturer" &&
41 output.name == "MockOutputName" &&
42 output.version == "MockOutputVersion") {
43 testPassed('output attributes are correct');
44 } else {
45 testFailed('output attributes are not correct');
46 }
47
48 // Now test System Exclusive access - our test mock should not allow this ty pe of access.
49 try {
50 navigator.requestMIDIAccess( { sysexEnabled: true } ).then(successCallba ck2, errorCallback2);
51 testPassed('navigator.requestMIDIAccess() did not throw exception.');
52 } catch(e) {
53 testFailed('navigator.requestMIDIAccess() should not throw exception.');
54 finishJSTest();
55 }
56 }
57
58 function errorCallback1(error) {
59 testFailed('requestMIDIAccess() error callback should not be called when req uesting basic access.');
60 finishJSTest();
61 }
62
63 function successCallback2(access) {
64 testFailed('requestMIDIAccess() was not correctly blocked for System Exclusi ve access.');
65 finishJSTest();
66 }
67
68 function errorCallback2(error) {
69 testPassed('requestMIDIAccess() was correctly blocked for System Exclusive a ccess with error ' + error + '.');
70 finishJSTest();
71 }
72
73 window.jsTestIsAsync = true;
74
75 // Test basic access, with no System Exclusive.
76 try {
77 navigator.requestMIDIAccess().then(successCallback1, errorCallback1);
78 testPassed('navigator.requestMIDIAccess() did not throw exception.');
79 } catch(e) {
80 testFailed('navigator.requestMIDIAccess() should not throw exception.');
81 finishJSTest();
82 }
83
84 window.successfullyParsed = true;
85
86 </script>
87 <script src="../fast/js/resources/js-test-post.js"></script>
88 </body>
89 </html>
OLDNEW
« no previous file with comments | « LayoutTests/webmidi/request-midi-access-expected.txt ('k') | LayoutTests/webmidi/requestmidiaccess-basic.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698