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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-initial-event.html

Issue 2780433005: Convert AudioParam tests to new Audit (Closed)
Patch Set: Address review comments Created 3 years, 8 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/AudioParam/audioparam-initial-event.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-initial-event.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-initial-event.html
index c6399fd68f5bd34938408128c1476938220a18d5..33943d0b4c15f1ec9586318220fb8a57b231d520 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-initial-event.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-initial-event.html
@@ -5,7 +5,7 @@
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audit-util.js"></script>
- <script src="../resources/audio-testing.js"></script>
+ <script src="../resources/audit.js"></script>
<script src="../resources/audioparam-testing.js"></script>
<title>AudioParam Initial Events </title>
</head>
@@ -25,76 +25,72 @@
// The following tests start a ramp automation without an initial event. This should cause an
// initial event to be added implicitly to give a starting point.
- audit.defineTask("linear-ramp", function (done) {
- runTest("Linear ramp", {
+ audit.define("linear-ramp", (task, should) => {
+ runTest("Linear ramp", should, {
automationFunction: function (node, value, time) {
node.gain.linearRampToValueAtTime(value, time);
},
referenceFunction: linearRamp,
// Experimentally determined threshold
- threshold: 6.0003e-8,
+ threshold: { absoluteThreshold: 6.0003e-8 },
// The starting value of the gain node
v0: 0.5,
// The target value of the automation
v1: 0,
})
- .then(done);
+ .then(() => task.done());
});
- audit.defineTask("exponential-ramp", function (done) {
- runTest("Exponential ramp", {
+ audit.define("exponential-ramp", (task, should) => {
+ runTest("Exponential ramp", should, {
automationFunction: function (node, value, time) {
node.gain.exponentialRampToValueAtTime(value, time);
},
referenceFunction: exponentialRamp,
- threshold: 2.3842e-6,
+ threshold: { absoluteThreshold: 2.3842e-6 },
v0: 0.5,
v1: 2,
})
- .then(done);
+ .then(() => task.done());
});
// Same tests as above, but we delay the call to the automation function. This is to verify that
// the we still do the right thing after the context has started.
- audit.defineTask("delayed-linear-ramp", function (done) {
- runTest("Delayed linear ramp", {
+ audit.define("delayed-linear-ramp", (task, should) => {
+ runTest("Delayed linear ramp", should, {
automationFunction: function (node, value, time) {
node.gain.linearRampToValueAtTime(value, time);
},
referenceFunction: linearRamp,
// Experimentally determined threshold
- threshold: 9.87968e-8,
+ threshold: { absoluteThreshold: 9.87968e-8 },
// The starting value of the gain node
v0: 0.5,
// The target value of the automation
v1: 0,
delay: quantumFrames / sampleRate
})
- .then(done);
+ .then(() => task.done());
});
- audit.defineTask("delayed-exponential-ramp", function (done) {
- runTest("Delayed exponential ramp", {
+ audit.define("delayed-exponential-ramp", (task, should) => {
+ runTest("Delayed exponential ramp", should, {
automationFunction: function (node, value, time) {
node.gain.exponentialRampToValueAtTime(value, time);
},
referenceFunction: exponentialRamp,
// Experimentally determined threshold
- threshold: 1.3948e-5,
+ threshold: { absoluteThreshold: 1.3948e-5 },
// The starting value of the gain node
v0: 0.5,
// The target value of the automation
v1: 2,
delay: quantumFrames / sampleRate
})
- .then(done);
+ .then(() => task.done());
});
- audit.defineTask("finish", function (done) {
- done();
- });
-
- audit.runTasks();
+ audit.run();
// Generate the expected waveform for a linear ramp starting from the value |v0|, ramping to
// |v1| at time |endTime|. The time of |v0| is assumed to be 0. |nFrames| is how many frames
@@ -126,7 +122,7 @@
// threshold - comparison threshold
// v0 - starting value
// v1 - end value for automation
- function runTest(message, options) {
+ function runTest(message, should, options) {
var automationFunction = options.automationFunction;
var referenceFunction = options.referenceFunction;
var threshold = options.threshold;
@@ -164,7 +160,7 @@
.then(function (resultBuffer) {
var result = resultBuffer.getChannelData(0);
var expected = referenceFunction(v0, v1, delay ? delay : 0, automationEndTime, renderFrames);
- Should(message, result).beCloseToArray(expected, threshold);
+ should(result, message).beCloseToArray(expected, threshold);
});
}
</script>

Powered by Google App Engine
This is Rietveld 408576698