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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/BiquadFilter/biquad-tail.html

Issue 2667173002: Convert BiquadFilter getFrequencyResponse and tail test to testharness (Closed)
Patch Set: Address nits 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/webaudio/BiquadFilter/biquad-tail.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/BiquadFilter/biquad-tail.html b/third_party/WebKit/LayoutTests/webaudio/BiquadFilter/biquad-tail.html
index 387958b8e55754fdf674d5e23e27263648acbb32..e87539068a8f0b8dd2b60d860e758a116613c5e8 100644
--- a/third_party/WebKit/LayoutTests/webaudio/BiquadFilter/biquad-tail.html
+++ b/third_party/WebKit/LayoutTests/webaudio/BiquadFilter/biquad-tail.html
@@ -2,29 +2,30 @@
<html>
<head>
<title>Test Biquad Tail Output</title>
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/js-test.js"></script>
<script src="../resources/audit-util.js"></script>
- <script src="../resources/audio-testing.js"></script>
+ <script src="../resources/audit.js"></script>
</head>
<body>
<script>
- description("Test Biquad Tail Output");
- window.jsTestIsAsync = true;
+ let audit = Audit.createTaskRunner();
// A high sample rate shows the issue more clearly.
- var sampleRate = 192000;
+ let sampleRate = 192000;
// Some short duration because we don't need to run the test for very long.
- var testDurationSec = 0.5;
- var testDurationFrames = testDurationSec * sampleRate;
+ let testDurationSec = 0.5;
+ let testDurationFrames = testDurationSec * sampleRate;
// Amplitude experimentally determined to give a biquad output close to 1. (No attempt was
// made to produce exactly 1; it's not needed.)
- var sourceAmplitude = 100;
+ let sourceAmplitude = 100;
// The output of the biquad filter should not change by more than this much between output
// samples. Threshold was determined experimentally.
- var glitchThreshold = 0.012968;
+ let glitchThreshold = 0.012968;
// Test that a Biquad filter doesn't have it's output terminated because the input has gone
// away. Generally, when a source node is finished, it disconnects itself from any downstream
@@ -32,18 +33,19 @@
// generally assumed to output zeroes. This is also desired behavior. However, biquad
// filters have memory so they should not suddenly output zeroes when the input is
// disconnected. This test checks to see if the output doesn't suddenly change to zero.
- function runTest() {
- var context = new OfflineAudioContext(1, testDurationFrames, sampleRate);
+ audit.define("test", function (task, should) {
+ task.describe("Biquad Tail Output");
+ let context = new OfflineAudioContext(1, testDurationFrames, sampleRate);
// Create an impulse source.
- var buffer = context.createBuffer(1, 1, context.sampleRate);
+ let buffer = context.createBuffer(1, 1, context.sampleRate);
buffer.getChannelData(0)[0] = sourceAmplitude;
- var source = context.createBufferSource();
+ let source = context.createBufferSource();
source.buffer = buffer;
// Create the biquad filter. It doesn't really matter what kind, so the default filter type
// and parameters is fine. Connect the source to it.
- var biquad = context.createBiquadFilter();
+ let biquad = context.createBiquadFilter();
source.connect(biquad);
biquad.connect(context.destination);
@@ -51,17 +53,13 @@
context.startRendering().then(function(result) {
// There should be no large discontinuities in the output
- var success = true;
- success = success && Should("Biquad output", result.getChannelData(0)).notGlitch(glitchThreshold);
- if (success)
- testPassed("Biquad tail output correctly completed.");
- else
- testFailed("Biquad tail output not correctly completed.");
- }).then(finishJSTest);
- }
+ should(result.getChannelData(0), "Biquad output")
+ .notGlitch(glitchThreshold);
+ task.done();
+ })
+ });
- runTest();
- successfullyParsed = true;
+ audit.run();
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698