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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Panner/pannernode-basic.html

Issue 2676873002: Convert Panner Audit tsets to testharness (Closed)
Patch Set: Remove finish task and some extra blank lines Created 3 years, 10 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 3
4 <head> 4 <head>
5 <script src="../../resources/js-test.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
7 <script src="../resources/audio-testing.js"></script> 8 <script src="../resources/audio-testing.js"></script>
8 </head> 9 </head>
9 10
10 <body> 11 <body>
11 <script> 12 <script>
12 description("Basic tests for PannerNode.");
13 window.jsTestIsAsync = true;
14
15 var context; 13 var context;
16 var panner; 14 var panner;
17 var audit = Audit.createTaskRunner(); 15 var audit = Audit.createTaskRunner();
18 16
19 audit.defineTask("initialize", function (done) { 17 audit.defineTask("initialize", function (done) {
20 context = new AudioContext(); 18 context = new AudioContext();
21 panner = context.createPanner(); 19 panner = context.createPanner();
22 done(); 20 done();
23 }); 21 });
24 22
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 .beEqualTo(0) && success; 68 .beEqualTo(0) && success;
71 success = Should("panner.positionZ", panner.positionZ.value) 69 success = Should("panner.positionZ", panner.positionZ.value)
72 .beEqualTo(0) && success; 70 .beEqualTo(0) && success;
73 success = Should("panner.orientationX", panner.orientationX.value) 71 success = Should("panner.orientationX", panner.orientationX.value)
74 .beEqualTo(1) && success; 72 .beEqualTo(1) && success;
75 success = Should("panner.orientationY", panner.orientationY.value) 73 success = Should("panner.orientationY", panner.orientationY.value)
76 .beEqualTo(0) && success; 74 .beEqualTo(0) && success;
77 success = Should("panner.orientationZ", panner.orientationZ.value) 75 success = Should("panner.orientationZ", panner.orientationZ.value)
78 .beEqualTo(0) && success; 76 .beEqualTo(0) && success;
79 77
80 if (success) 78 Should("Basic Panner attribute tests", success)
81 testPassed("Basic Panner attribute tests.\n"); 79 .summarize("passed", "failed");
82 else
83 testFailed("Basic Panner attribute tests.\n");
84 80
85 done(); 81 done();
86 }); 82 });
87 83
88 audit.defineTask("listener", function (done) { 84 audit.defineTask("listener", function (done) {
89 var success = true; 85 var success = true;
90 86
91 success = Should("listener.positionX", context.listener.positionX.value) 87 success = Should("listener.positionX", context.listener.positionX.value)
92 .beEqualTo(0) && success; 88 .beEqualTo(0) && success;
93 success = Should("listener.positionY", context.listener.positionY.value) 89 success = Should("listener.positionY", context.listener.positionY.value)
94 .beEqualTo(0) && success; 90 .beEqualTo(0) && success;
95 success = Should("listener.positionZ", context.listener.positionZ.value) 91 success = Should("listener.positionZ", context.listener.positionZ.value)
96 .beEqualTo(0) && success; 92 .beEqualTo(0) && success;
97 success = Should("listener.forwardX", context.listener.forwardX.value) 93 success = Should("listener.forwardX", context.listener.forwardX.value)
98 .beEqualTo(0) && success; 94 .beEqualTo(0) && success;
99 success = Should("listener.forwardY", context.listener.forwardY.value) 95 success = Should("listener.forwardY", context.listener.forwardY.value)
100 .beEqualTo(0) && success; 96 .beEqualTo(0) && success;
101 success = Should("listener.forwardZ", context.listener.forwardZ.value) 97 success = Should("listener.forwardZ", context.listener.forwardZ.value)
102 .beEqualTo(-1) && success; 98 .beEqualTo(-1) && success;
103 success = Should("listener.upX", context.listener.upX.value) 99 success = Should("listener.upX", context.listener.upX.value)
104 .beEqualTo(0) && success; 100 .beEqualTo(0) && success;
105 success = Should("listener.upY", context.listener.upY.value) 101 success = Should("listener.upY", context.listener.upY.value)
106 .beEqualTo(1) && success; 102 .beEqualTo(1) && success;
107 success = Should("listener.upZ", context.listener.upZ.value) 103 success = Should("listener.upZ", context.listener.upZ.value)
108 .beEqualTo(0) && success; 104 .beEqualTo(0) && success;
109 105
110 if (success) 106 Should("Basic AudioListener attribute tests", success)
111 testPassed("Basic AudioListener attribute tests.\n"); 107 .summarize("passed", "failed");
112 else
113 testFailed("Basic AudioListener attribute tests.\n");
114 done(); 108 done();
115 }); 109 });
116 110
117 audit.defineTask("panning models", function (done) { 111 audit.defineTask("panning models", function (done) {
118 // Check that the .panningModel attribute can be set to all legal values . 112 // Check that the .panningModel attribute can be set to all legal values .
119 var panningModels = ["equalpower", "HRTF"]; 113 var panningModels = ["equalpower", "HRTF"];
120 114
121 var success = true; 115 var success = true;
122 for (var i = 0; i < panningModels.length; ++i) { 116 for (var i = 0; i < panningModels.length; ++i) {
123 success = Should('panner.panningModel = "' + panningModels[i] + '"', f unction () { 117 success = Should('panner.panningModel = "' + panningModels[i] + '"', f unction () {
(...skipping 14 matching lines...) Expand all
138 // Check that numerical values are no longer supported. We shouldn't th row and the value 132 // Check that numerical values are no longer supported. We shouldn't th row and the value
139 // shouldn't be changed. 133 // shouldn't be changed.
140 panner.panningModel = "HRTF"; 134 panner.panningModel = "HRTF";
141 success = Should('panner.panningModel = 1', function () { 135 success = Should('panner.panningModel = 1', function () {
142 panner.panningModel = 1; 136 panner.panningModel = 1;
143 }).notThrow() && success; 137 }).notThrow() && success;
144 138
145 success = Should('panner.panningModel', panner.panningModel) 139 success = Should('panner.panningModel', panner.panningModel)
146 .beEqualTo("HRTF") && success; 140 .beEqualTo("HRTF") && success;
147 141
148 if (success) 142 Should("Basic Panner panning models tests", success)
149 testPassed("Basic Panner panning models tests.\n"); 143 .summarize("passed", "failed");
150 else
151 testFailed("Basic Panner panning models tests.\n");
152 done(); 144 done();
153 }); 145 });
154 146
155 audit.defineTask("distance models", function (done) { 147 audit.defineTask("distance models", function (done) {
156 // Check that the .panningModel attribute can be set to all legal values . 148 // Check that the .panningModel attribute can be set to all legal values .
157 var distanceModels = ["linear", "inverse", "exponential"]; 149 var distanceModels = ["linear", "inverse", "exponential"];
158 150
159 var success = true; 151 var success = true;
160 for (var i = 0; i < distanceModels.length; ++i) { 152 for (var i = 0; i < distanceModels.length; ++i) {
161 success = Should('panner.distanceModel = "' + distanceModels[i] + '"', 153 success = Should('panner.distanceModel = "' + distanceModels[i] + '"',
162 function () { 154 function () {
163 panner.distanceModel = distanceModels[i]; 155 panner.distanceModel = distanceModels[i];
164 }).notThrow() && success; 156 }).notThrow() && success;
165 157
166 success = Should('panner.distanceModel = "' + distanceModels[i] + '"', panner 158 success = Should('panner.distanceModel = "' + distanceModels[i] + '"', panner
167 .distanceModel) 159 .distanceModel)
168 .beEqualTo(distanceModels[i]) && success; 160 .beEqualTo(distanceModels[i]) && success;
169 } 161 }
170 162
171 success = Should('panner.distanceModel = "invalid"', function () { 163 success = Should('panner.distanceModel = "invalid"', function () {
172 panner.distanceModel = "invalid"; 164 panner.distanceModel = "invalid";
173 }).notThrow() && success; 165 }).notThrow() && success;
174 166
175 success = Should("panner.distanceModel", panner.distanceModel) 167 success = Should("panner.distanceModel", panner.distanceModel)
176 .beEqualTo("exponential") && success; 168 .beEqualTo("exponential") && success;
177 169
178 if (success) 170 Should("Basic Panner distance models tests", success)
179 testPassed("Basic Panner distance models tests.\n"); 171 .summarize("passed", "failed");
180 else
181 testFailed("Basic Panner distance models tests.\n");
182 done(); 172 done();
183 }); 173 });
184 174
185 audit.defineTask("finish", function (done) {
186 finishJSTest();
187 done();
188 });
189
190
191 audit.runTasks(); 175 audit.runTasks();
192 </script> 176 </script>
193 177
194 </body> 178 </body>
195 179
196 </html> 180 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698