Skip to content

Commit ad6526f

Browse files
committed
Many WebAudio js-tests use waitUntilDone
https://bugs.webkit.org/show_bug.cgi?id=172398 Reviewed by Sam Weinig. Corrected the use of js-test harness, updated the tests to use js-test.js instead of js-test-pre.js where possible. * resources/js-test.js: (shouldReject): Copied some funcitonality form js-test-pre.js that wasn't present here. * webaudio/analyser-exception.html: * webaudio/audiobuffer-neuter-expected.txt: * webaudio/audiobuffer-neuter.html: * webaudio/audiobuffersource-channels.html: * webaudio/audiobuffersource-ended-expected.txt: * webaudio/audiobuffersource-ended.html: * webaudio/audiobuffersource-exception.html: * webaudio/audiobuffersource-loop-comprehensive-expected.txt: * webaudio/audiobuffersource-loop-comprehensive.html: * webaudio/audiobuffersource-negative-playbackrate-expected.txt: * webaudio/audiobuffersource-negative-playbackrate-interpolated-expected.txt: * webaudio/audiobuffersource-negative-playbackrate-interpolated-loop-expected.txt: * webaudio/audiobuffersource-negative-playbackrate-interpolated-loop.html: * webaudio/audiobuffersource-negative-playbackrate-interpolated.html: * webaudio/audiobuffersource-negative-playbackrate-loop-expected.txt: * webaudio/audiobuffersource-negative-playbackrate-loop.html: * webaudio/audiobuffersource-negative-playbackrate.html: * webaudio/audiobuffersource-playbackState.html: * webaudio/audiobuffersource-start-expected.txt: * webaudio/audiobuffersource-start.html: * webaudio/audiochannelmerger-basic.html: * webaudio/audiochannelmerger-stereo.html: * webaudio/audiochannelsplitter.html: * webaudio/audiocontext-promise-throwing.html: * webaudio/audiocontext-promise.html: * webaudio/audiocontext-restriction-audiobuffersourcenode-start.html: * webaudio/audiocontext-restriction.html: * webaudio/audiocontext-state-interrupted.html: * webaudio/audiocontext-state.html: * webaudio/audionode-channel-rules.html: * webaudio/audionode-connect-order.html: * webaudio/audionode.html: * webaudio/audioparam-connect-audioratesignal.html: * webaudio/audioparam-summingjunction.html: * webaudio/audioprocessingevent.html: * webaudio/automatic-pull-node.html: * webaudio/biquad-allpass.html: * webaudio/biquad-bandpass.html: * webaudio/biquad-getFrequencyResponse.html: * webaudio/biquad-highpass.html: * webaudio/biquad-highshelf.html: * webaudio/biquad-lowpass.html: * webaudio/biquad-lowshelf.html: * webaudio/biquad-notch.html: * webaudio/biquad-peaking.html: * webaudio/biquadfilternode-basic.html: * webaudio/convolution-mono-mono.html: * webaudio/decode-audio-data-basic.html: * webaudio/decode-audio-data-too-short.html: * webaudio/delaynode-max-default-delay.html: * webaudio/delaynode-max-nondefault-delay.html: * webaudio/delaynode-maxdelay.html: * webaudio/delaynode-maxdelaylimit.html: * webaudio/delaynode-scheduling.html: * webaudio/delaynode.html: * webaudio/distance-exponential.html: * webaudio/distance-inverse.html: * webaudio/distance-linear.html: * webaudio/dynamicscompressor-basic.html: * webaudio/javascriptaudionode-downmix8-2channel-input.html: * webaudio/javascriptaudionode-upmix2-8channel-input.html: * webaudio/javascriptaudionode-zero-input-channels.html: * webaudio/javascriptaudionode.html: * webaudio/mediaelementaudiosourcenode.html: * webaudio/oscillator-basic.html: * webaudio/oscillator-ended-expected.txt: * webaudio/oscillator-ended.html: * webaudio/page-canstartmedia.html: * webaudio/panner-equalpower-stereo.html: * webaudio/panner-equalpower.html: * webaudio/panner-loop.html: * webaudio/pannernode-basic.html: * webaudio/realtimeanalyser-fft-scaling.html: * webaudio/realtimeanalyser-fft-sizing.html: * webaudio/resources/audiobuffersource-testing.js: (checkAllTests): * webaudio/sample-accurate-scheduling.html: * webaudio/stereo2mono-down-mixing.html: * webaudio/test-basic.html: * webaudio/waveshaper.html: Canonical link: https://commits.webkit.org/189368@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217243 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 59927d1 commit ad6526f

81 files changed

Lines changed: 235 additions & 572 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LayoutTests/ChangeLog

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,97 @@
1+
2017-05-22 Alexey Proskuryakov <ap@apple.com>
2+
3+
Many WebAudio js-tests use waitUntilDone
4+
https://bugs.webkit.org/show_bug.cgi?id=172398
5+
6+
Reviewed by Sam Weinig.
7+
8+
Corrected the use of js-test harness, updated the tests to use js-test.js instead
9+
of js-test-pre.js where possible.
10+
11+
* resources/js-test.js: (shouldReject): Copied some funcitonality form js-test-pre.js
12+
that wasn't present here.
13+
14+
* webaudio/analyser-exception.html:
15+
* webaudio/audiobuffer-neuter-expected.txt:
16+
* webaudio/audiobuffer-neuter.html:
17+
* webaudio/audiobuffersource-channels.html:
18+
* webaudio/audiobuffersource-ended-expected.txt:
19+
* webaudio/audiobuffersource-ended.html:
20+
* webaudio/audiobuffersource-exception.html:
21+
* webaudio/audiobuffersource-loop-comprehensive-expected.txt:
22+
* webaudio/audiobuffersource-loop-comprehensive.html:
23+
* webaudio/audiobuffersource-negative-playbackrate-expected.txt:
24+
* webaudio/audiobuffersource-negative-playbackrate-interpolated-expected.txt:
25+
* webaudio/audiobuffersource-negative-playbackrate-interpolated-loop-expected.txt:
26+
* webaudio/audiobuffersource-negative-playbackrate-interpolated-loop.html:
27+
* webaudio/audiobuffersource-negative-playbackrate-interpolated.html:
28+
* webaudio/audiobuffersource-negative-playbackrate-loop-expected.txt:
29+
* webaudio/audiobuffersource-negative-playbackrate-loop.html:
30+
* webaudio/audiobuffersource-negative-playbackrate.html:
31+
* webaudio/audiobuffersource-playbackState.html:
32+
* webaudio/audiobuffersource-start-expected.txt:
33+
* webaudio/audiobuffersource-start.html:
34+
* webaudio/audiochannelmerger-basic.html:
35+
* webaudio/audiochannelmerger-stereo.html:
36+
* webaudio/audiochannelsplitter.html:
37+
* webaudio/audiocontext-promise-throwing.html:
38+
* webaudio/audiocontext-promise.html:
39+
* webaudio/audiocontext-restriction-audiobuffersourcenode-start.html:
40+
* webaudio/audiocontext-restriction.html:
41+
* webaudio/audiocontext-state-interrupted.html:
42+
* webaudio/audiocontext-state.html:
43+
* webaudio/audionode-channel-rules.html:
44+
* webaudio/audionode-connect-order.html:
45+
* webaudio/audionode.html:
46+
* webaudio/audioparam-connect-audioratesignal.html:
47+
* webaudio/audioparam-summingjunction.html:
48+
* webaudio/audioprocessingevent.html:
49+
* webaudio/automatic-pull-node.html:
50+
* webaudio/biquad-allpass.html:
51+
* webaudio/biquad-bandpass.html:
52+
* webaudio/biquad-getFrequencyResponse.html:
53+
* webaudio/biquad-highpass.html:
54+
* webaudio/biquad-highshelf.html:
55+
* webaudio/biquad-lowpass.html:
56+
* webaudio/biquad-lowshelf.html:
57+
* webaudio/biquad-notch.html:
58+
* webaudio/biquad-peaking.html:
59+
* webaudio/biquadfilternode-basic.html:
60+
* webaudio/convolution-mono-mono.html:
61+
* webaudio/decode-audio-data-basic.html:
62+
* webaudio/decode-audio-data-too-short.html:
63+
* webaudio/delaynode-max-default-delay.html:
64+
* webaudio/delaynode-max-nondefault-delay.html:
65+
* webaudio/delaynode-maxdelay.html:
66+
* webaudio/delaynode-maxdelaylimit.html:
67+
* webaudio/delaynode-scheduling.html:
68+
* webaudio/delaynode.html:
69+
* webaudio/distance-exponential.html:
70+
* webaudio/distance-inverse.html:
71+
* webaudio/distance-linear.html:
72+
* webaudio/dynamicscompressor-basic.html:
73+
* webaudio/javascriptaudionode-downmix8-2channel-input.html:
74+
* webaudio/javascriptaudionode-upmix2-8channel-input.html:
75+
* webaudio/javascriptaudionode-zero-input-channels.html:
76+
* webaudio/javascriptaudionode.html:
77+
* webaudio/mediaelementaudiosourcenode.html:
78+
* webaudio/oscillator-basic.html:
79+
* webaudio/oscillator-ended-expected.txt:
80+
* webaudio/oscillator-ended.html:
81+
* webaudio/page-canstartmedia.html:
82+
* webaudio/panner-equalpower-stereo.html:
83+
* webaudio/panner-equalpower.html:
84+
* webaudio/panner-loop.html:
85+
* webaudio/pannernode-basic.html:
86+
* webaudio/realtimeanalyser-fft-scaling.html:
87+
* webaudio/realtimeanalyser-fft-sizing.html:
88+
* webaudio/resources/audiobuffersource-testing.js:
89+
(checkAllTests):
90+
* webaudio/sample-accurate-scheduling.html:
91+
* webaudio/stereo2mono-down-mixing.html:
92+
* webaudio/test-basic.html:
93+
* webaudio/waveshaper.html:
94+
195
2017-05-22 Myles C. Maxfield <mmaxfield@apple.com>
296

397
Enable the woff2-variations @font-face format identifier

LayoutTests/resources/js-test.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,42 @@ function expectError()
645645
expectingError = true;
646646
}
647647

648+
function shouldReject(_a, _message)
649+
{
650+
var _exception;
651+
var _av;
652+
try {
653+
_av = typeof _a == "function" ? _a() : eval(_a);
654+
} catch (e) {
655+
testFailed((_message ? _message : _a) + " should not throw exception. Threw exception " + e + ".");
656+
return Promise.resolve();
657+
}
658+
659+
return _av.then(function(result) {
660+
testFailed((_message ? _message : _a) + " should reject promise. Resolved with " + result + ".");
661+
}, function(error) {
662+
testPassed((_message ? _message : _a) + " rejected promise with " + error + ".");
663+
});
664+
}
665+
666+
function shouldThrowErrorName(_a, _name)
667+
{
668+
var _exception;
669+
try {
670+
typeof _a == "function" ? _a() : eval(_a);
671+
} catch (e) {
672+
_exception = e;
673+
}
674+
675+
if (_exception) {
676+
if (_exception.name == _name)
677+
testPassed(_a + " threw exception " + _exception + ".");
678+
else
679+
testFailed(_a + " should throw a " + _name + ". Threw a " + _exception.name + ".");
680+
} else
681+
testFailed(_a + " should throw a " + _name + ". Did not throw.");
682+
}
683+
648684
function shouldHaveHadError(message)
649685
{
650686
if (expectingError) {

LayoutTests/webaudio/analyser-exception.html

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<html>
44
<head>
5-
<script src="../resources/js-test-pre.js"></script>
5+
<script src="../resources/js-test.js"></script>
66
<script src="resources/audio-testing.js"></script>
77
<script src="resources/audiobuffersource-testing.js"></script>
88
</head>
@@ -18,11 +18,6 @@
1818
var analyser;
1919

2020
function runTest() {
21-
if (window.testRunner) {
22-
testRunner.dumpAsText();
23-
testRunner.waitUntilDone();
24-
}
25-
2621
window.jsTestIsAsync = true;
2722

2823
var sampleRate = 44100.0;
@@ -47,7 +42,5 @@
4742
runTest();
4843

4944
</script>
50-
51-
<script src="../resources/js-test-post.js"></script>
5245
</body>
5346
</html>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
Tests that neutered AudioBuffers do not produce garbage
22
PASS Output matches expectations.
3+
PASS successfullyParsed is true
4+
5+
TEST COMPLETE
36

LayoutTests/webaudio/audiobuffer-neuter.html

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<head>
3-
<script src="../resources/js-test-pre.js"></script>
3+
<script src="../resources/js-test.js"></script>
44
<script src="resources/audio-testing.js"></script>
55
<script src="resources/audiobuffersource-testing.js"></script>
66
<script>
@@ -12,10 +12,7 @@
1212

1313
function runTest()
1414
{
15-
if (window.testRunner) {
16-
testRunner.dumpAsText();
17-
testRunner.waitUntilDone();
18-
}
15+
jsTestIsAsync = true;
1916

2017
var numberOfFrames = sampleRate * lengthInSeconds;
2118
context = new webkitOfflineAudioContext(1, numberOfFrames, sampleRate);
@@ -58,15 +55,11 @@
5855
if (expectedData[i] != renderedData[i]) {
5956
testFailed('expected: ' + expectedData[i] + ' actual: ' + renderedData[i]);
6057
finishJSTest();
61-
if (window.testRunner)
62-
testRunner.notifyDone();
6358
}
6459
}
6560

6661
testPassed('Output matches expectations.');
6762
finishJSTest();
68-
if (window.testRunner)
69-
testRunner.notifyDone();
7063
}
7164

7265
</script>

LayoutTests/webaudio/audiobuffersource-channels.html

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<html>
44
<head>
5-
<script src="../resources/js-test-pre.js"></script>
5+
<script src="../resources/js-test.js"></script>
66
<script type="text/javascript" src="resources/audio-testing.js"></script>
77
</head>
88

@@ -17,11 +17,6 @@
1717
var source;
1818

1919
function runTest() {
20-
if (window.testRunner) {
21-
testRunner.dumpAsText();
22-
testRunner.waitUntilDone();
23-
}
24-
2520
window.jsTestIsAsync = true;
2621

2722
context = new webkitAudioContext();
@@ -75,7 +70,5 @@
7570
runTest();
7671

7772
</script>
78-
79-
<script src="../resources/js-test-post.js"></script>
8073
</body>
8174
</html>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
Tests that AudioBufferSourceNode calls its onended EventListener.
22
PASS source.onended called.
3+
PASS successfullyParsed is true
4+
5+
TEST COMPLETE
36

LayoutTests/webaudio/audiobuffersource-ended.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<head>
3-
<script src="../resources/js-test-pre.js"></script>
3+
<script src="../resources/js-test.js"></script>
44
<script src="resources/audio-testing.js"></script>
55
<script src="resources/audiobuffersource-testing.js"></script>
66
<script>
@@ -9,10 +9,7 @@
99

1010
function runTest()
1111
{
12-
if (window.testRunner) {
13-
testRunner.dumpAsText();
14-
testRunner.waitUntilDone();
15-
}
12+
jsTestIsAsync = true;
1613

1714
var sampleRate = 44100.0;
1815
var numberOfFrames = 32;
@@ -23,8 +20,7 @@
2320
source.onended = function()
2421
{
2522
testPassed("source.onended called.");
26-
if (window.testRunner)
27-
testRunner.notifyDone();
23+
finishJSTest();
2824
}
2925
source.start(0);
3026
context.startRendering();

LayoutTests/webaudio/audiobuffersource-exception.html

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<html>
44
<head>
5-
<script src="../resources/js-test-pre.js"></script>
5+
<script src="../resources/js-test.js"></script>
66
<script src="resources/audio-testing.js"></script>
77
<script src="resources/audiobuffersource-testing.js"></script>
88
</head>
@@ -18,11 +18,6 @@
1818
var bufferSource;
1919

2020
function runTest() {
21-
if (window.testRunner) {
22-
testRunner.dumpAsText();
23-
testRunner.waitUntilDone();
24-
}
25-
2621
window.jsTestIsAsync = true;
2722

2823
var sampleRate = 44100.0;
@@ -50,7 +45,5 @@
5045
runTest();
5146

5247
</script>
53-
54-
<script src="../resources/js-test-post.js"></script>
5548
</body>
5649
</html>

LayoutTests/webaudio/audiobuffersource-loop-comprehensive-expected.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ PASS illegal loop: loopStartFrame > loopEndFrame
1515
PASS illegal loop: loopStartFrame == loopEndFrame
1616
PASS illegal loop: loopStartFrame < 0
1717
PASS illegal loop: loopEndFrame > bufferLength
18+
PASS successfullyParsed is true
19+
20+
TEST COMPLETE
1821

0 commit comments

Comments
 (0)