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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-limit.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-limit.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-limit.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-limit.html
index 58a59e9725ff99b3a7681749551d6c0aeada0fbc..2106a7f49e492356cbff32182d32798952aa4f0f 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-limit.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-limit.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>
</head>
@@ -14,7 +14,7 @@
var audit = Audit.createTaskRunner();
- audit.defineTask("approach 1", function(done) {
+ audit.define("approach 1", (task, should) => {
var sampleRate = 48000;
// A really short time constant so that setTargetAtTime approaches the limiting value well
@@ -27,7 +27,7 @@
// (which uses a filter and not the formula.)
var limitThreshold = 1e-7;
- runTest({
+ runTest(should, {
sampleRate: sampleRate,
v0: 0,
v1: 1,
@@ -35,10 +35,10 @@
eps: limitThreshold,
// Experimentally determined
threshold: 2.4e-5
- }).then(done);
+ }).then(() => task.done());
})
- audit.defineTask("approach 0", function(done) {
+ audit.define("approach 0", (task, should) => {
// Use the equation for setTargetAtTime to figure out when we are close to 0:
//
// v(t) = exp(-t/tau)
@@ -59,7 +59,7 @@
// (which uses a filter and not the formula.)
var limitThreshold = 1e-21;
- runTest({
+ runTest(should, {
sampleRate: sampleRate,
v0: 1,
v1: 0,
@@ -67,7 +67,7 @@
eps: limitThreshold,
// Experimentally determined
threshold: 1.3e-7
- }).then(done);
+ }).then(() => task.done());
});
function findLimitTime(v0, v1, timeConstant, eps) {
@@ -99,7 +99,7 @@
return timeConstant * Math.log(v0/eps);
}
- function runTest(options) {
+ function runTest(should, options) {
var renderLength = 1;
var context = new OfflineAudioContext(1, renderLength * sampleRate, options.sampleRate);
@@ -131,26 +131,18 @@
var tailTime = findLimitTime(options.v0, options.v1, options.timeConstant, options.eps);
var tailFrame = Math.ceil(tailTime * options.sampleRate);
- var success = true;
- success = Should("Initial output of " + tailFrame + " samples for " + message,
- actual.slice(0, tailFrame), { numberOfArrayLog: 8 })
- .beCloseToArray(expected.slice(0, tailFrame), options.threshold) && success;
+ should(actual.slice(0, tailFrame),
+ "Initial output of " + tailFrame + " samples for " + message)
+ .beCloseToArray(expected.slice(0, tailFrame), {
+ absoluteThreshold: options.threshold
+ });
- success = Should("Tail output for " + message,
- actual.slice(tailFrame))
- .containValues([options.v1]) && success;
-
- Should(message, success)
- .summarize("had the expected values",
- "did not have the expected values");
+ should(actual.slice(tailFrame), "Tail output for " + message)
+ .containValues([options.v1]);
});
}
- audit.defineTask("finish", function (done) {
- done();
- });
-
- audit.runTasks();
+ audit.run();
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698