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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/constructor/delay.html

Issue 2829903003: Convert constructor/delay.html to use new Audit (Closed)
Patch Set: Rebase Created 3 years, 7 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 | no next file » | 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 <title>Test Constructor: Delay</title> 4 <title>Test Constructor: Delay</title>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
8 <script src="../resources/audio-testing.js"></script> 8 <script src="../resources/audit.js"></script>
9 <script src="audionodeoptions.js"></script> 9 <script src="new-audionodeoptions.js"></script>
10 </head> 10 </head>
11 11
12 <body> 12 <body>
13 <script> 13 <script>
14 var context; 14 var context;
15 15
16 var audit = Audit.createTaskRunner(); 16 var audit = Audit.createTaskRunner();
17 17
18 audit.defineTask("initialize", function (taskDone) { 18 audit.define('initialize', (task, should) => {
19 Should("context = new OfflineAudioContext(...)", function () { 19 context = initializeContext(should);
20 context = new OfflineAudioContext(1, 1, 48000); 20 task.done();
21 }).notThrow();
22 taskDone();
23 }); 21 });
24 22
25 audit.defineTask("invalid constructor", function (taskDone) { 23 audit.define('invalid constructor', (task, should) => {
26 var node; 24 testInvalidConstructor(should, 'DelayNode', context);
27 var success = true; 25 task.done();
28
29 success = Should("new DelayNode()", function () {
30 node = new DelayNode();
31 }).throw("TypeError") && success;
32 success = Should("new DelayNode(1)", function () {
33 node = new DelayNode(1);
34 }).throw("TypeError") && success;
35 success = Should("new DelayNode(context, 42)", function () {
36 node = new DelayNode(context, 42);
37 }).throw("TypeError") && success;
38
39 Should("Invalid constructors", success)
40 .summarize(
41 "correctly threw errors",
42 "did not throw errors in all cases");
43 taskDone();
44 }); 26 });
45 27
46 audit.defineTask("default constructor", function (taskDone) { 28 audit.define('default constructor', (task, should) => {
47 var node; 29 let prefix = 'node0';
48 var success = true; 30 let node = testDefaultConstructor(should, 'DelayNode', context, {
31 prefix: prefix,
32 numberOfInputs: 1,
33 numberOfOutputs: 1,
34 channelCount: 2,
35 channelCountMode: 'max',
36 channelInterpretation: 'speakers'
37 });
49 38
50 success = Should("node0 = new DelayNode(context)", function () { 39 testDefaultAttributes(
51 node = new DelayNode(context); 40 should, node, prefix, [{name: 'delayTime', value: 0}]);
52 }).notThrow();
53 success = Should("node0 instanceof DelayNode", node instanceof DelayNode )
54 .beEqualTo(true) && success;
55 41
56 success = Should("node0.delayTime.value", node.delayTime.value) 42 task.done();
57 .beEqualTo(0) && success;
58
59 success = Should("node0.channelCount", node.channelCount)
60 .beEqualTo(2) && success;
61 success = Should("node0.channelCountMode", node.channelCountMode)
62 .beEqualTo("max") && success;
63 success = Should("node0.channelInterpretation", node.channelInterpretati on)
64 .beEqualTo("speakers") && success;
65
66 success = Should("DelayNode(context) constructed with correct values", s uccess)
67 .beEqualTo(true);
68
69 Should("new DelayNode(context)", success)
70 .summarize(
71 "constructed node with correct attributes",
72 "did not construct correct node correctly")
73
74 taskDone();
75 }); 43 });
76 44
77 audit.defineTask("test AudioNodeOptions", function (taskDone) { 45 audit.define('test AudioNodeOptions', (task, should) => {
78 testAudioNodeOptions(context, "DelayNode"); 46 testAudioNodeOptions(should, context, 'DelayNode');
79 taskDone(); 47 task.done();
80 }); 48 });
81 49
82 audit.defineTask("constructor options", function (taskDone) { 50 audit.define('constructor options', (task, should) => {
83 var node; 51 var node;
84 var success = true;
85 var options = { 52 var options = {
86 delayTime: 0.5, 53 delayTime: 0.5,
87 maxDelayTime: 1.5, 54 maxDelayTime: 1.5,
88 }; 55 };
89 56
90 success = Should("node1 = new DelayNode(c, " + JSON.stringify(options) + ")", 57 should(
91 function () { 58 () => {
92 node = new DelayNode(context, options); 59 node = new DelayNode(context, options);
93 }).notThrow(); 60 },
61 'node1 = new DelayNode(c, ' + JSON.stringify(options) + ')')
62 .notThrow();
94 63
95 success = Should("node1.delayTime.value", node.delayTime.value) 64 should(node.delayTime.value, 'node1.delayTime.value')
96 .beEqualTo(options.delayTime) && success; 65 .beEqualTo(options.delayTime);
97 success = Should("node1.delayTime.maxValue", node.delayTime.maxValue) 66 should(node.delayTime.maxValue, 'node1.delayTime.maxValue')
98 .beEqualTo(options.maxDelayTime) && success; 67 .beEqualTo(options.maxDelayTime);
99 68
100 success = Should("DelayNode(context, options) correctly handled", succes s) 69 task.done();
101 .beEqualTo(true);
102
103 Should("new DelayNode() with options", success)
104 .summarize(
105 "constructed with correct attributes",
106 "was not constructed correctly");
107
108 taskDone();
109 }); 70 });
110 71
111 audit.runTasks(); 72 audit.run();
112 </script> 73 </script>
113 </body> 74 </body>
114 </html> 75 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698