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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-sampling.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-setTargetAtTime-sampling.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-sampling.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-sampling.html
index e47052efc96fbb254a7ae2dac6bea0ab14a4276f..50e000a0a56d85d1713717e4c2758720cfbe9eb4 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-sampling.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-sampling.html
@@ -4,7 +4,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>Test Sampling for SetTargetAtTime</title>
</head>
@@ -26,7 +26,7 @@
// Test sampling of setTargetAtTime that starts at |startFrame|. A gain node is used for
// testing. |initializeGainFunction| initializes the gain value.
- function doTest(message, startFrame, threshold, initializeGainFunction) {
+ function doTest(should, message, startFrame, threshold, initializeGainFunction) {
var context = new OfflineAudioContext(1, 256, sampleRate);
var source = context.createBufferSource();
var b = context.createBuffer(1, 1, sampleRate);
@@ -52,7 +52,10 @@
// rendered result is within |threshold| of the expected value.
var frame = Math.ceil(startFrame);
var v = 10000 * Math.exp(-(frame / sampleRate - startFrame / sampleRate) / timeConstant);
- Should(message + ": Target value at frame " + frame, resultData[frame]).beCloseTo(v, threshold);
+ should(resultData[frame], message + ": Target value at frame " +
+ frame).beCloseTo(v, {
+ threshold: threshold
+ });
});
}
@@ -64,37 +67,42 @@
g.gain.setValueAtTime(initialGain, 0);
}
- audit.defineTask("setValue;128.1", function (done) {
- doTest("Initialize by setValueAtTime", 128.1, 3.6029e-8, initializeGainBySetValue).then(done);
+ audit.define("setValue;128.1", (task, should) => {
+ doTest(should, "Initialize by setValueAtTime", 128.1, 3.6029e-8,
+ initializeGainBySetValue)
+ .then(() => task.done());
});
- audit.defineTask("setValue;0.1", function (done) {
- doTest("Initialize by setValueAtTime", 0.1, 3.6029e-8, initializeGainBySetValue).then(done);
+ audit.define("setValue;0.1", (task, should) => {
+ doTest(should, "Initialize by setValueAtTime", 0.1, 3.6029e-8,
+ initializeGainBySetValue)
+ .then(() => task.done());
});
- audit.defineTask("setValue;0.0", function (done) {
- doTest("Initialize by setValueAtTime", 0, 3.6029e-8, initializeGainBySetValue).then(done);
+ audit.define("setValue;0.0", (task, should) => {
+ doTest(should, "Initialize by setValueAtTime", 0, 3.6029e-8,
+ initializeGainBySetValue)
+ .then(() => task.done());
});
- audit.defineTask("setter;128.1", function (done) {
- doTest("Initialize by setter", 128.1, 3.6029e-8, initializeGainBySetter).then(done);
+ audit.define("setter;128.1", (task, should) => {
+ doTest(should, "Initialize by setter", 128.1, 3.6029e-8,
+ initializeGainBySetter)
+ .then(() => task.done());
});
- audit.defineTask("setter;0.1", function (done) {
- doTest("Initialize by setter", 0.1, 3.6029e-8, initializeGainBySetter).then(done);
+ audit.define("setter;0.1", (task, should) => {
+ doTest(should, "Initialize by setter", 0.1, 3.6029e-8,
+ initializeGainBySetter)
+ .then(() => task.done());
});
- audit.defineTask("setter;0.0", function (done) {
- doTest("Initialize by setter", 0, 0, initializeGainBySetter).then(done);
+ audit.define("setter;0.0", (task, should) => {
+ doTest(should, "Initialize by setter", 0, 0, initializeGainBySetter)
+ .then(() => task.done());
});
-
- audit.defineTask("finish", function (done) {
- done();
- });
-
- audit.runTasks();
- successfullyParsed = true;
+ audit.run();
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698