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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.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-processing.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html
index f6eb35c7990ff44d2f8f5f921a81f9e6c861dd21..4b3fb70ddd358c62b843cf1f02260d607a97f9c4 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html
@@ -4,7 +4,7 @@
<title>Test Processing Of AudioParams of Disconnected AudioNodes</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
- <script src="../resources/audio-testing.js"></script>
+ <script src="../resources/audit.js"></script>
</head>
<body>
@@ -26,189 +26,189 @@
// Source nodes are not included in this because the AudioParams for the
// source nodes only process when the node has been started.
- audit.defineTask("BiquadFilterNode", function (taskDone) {
+ audit.define("BiquadFilterNode", (task, should) => {
var nodeName = "BiquadFilterNode"
Promise.all([
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "Q",
initialValue: 2,
rampFinalValue: 5
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "detune",
initialValue: 1,
rampFinalValue: 0.5
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "frequency",
initialValue: 1000,
rampFinalValue: 100
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "gain",
initialValue: -3,
rampFinalValue: 3
}),
- ]).then(taskDone);
+ ]).then(() => task.done());
});
- audit.defineTask("DelayNode", function (taskDone) {
- testParamAutomation({
+ audit.define("DelayNode", (task, should) => {
+ testParamAutomation(should, {
nodeName: "DelayNode",
paramName: "delayTime",
initialValue: 0.25,
rampFinalValue: 0.5
- }).then(taskDone);
+ }).then(() => task.done());
});
- audit.defineTask("DynamicsCompressorNode", function (taskDone) {
+ audit.define("DynamicsCompressorNode", (task, should) => {
var nodeName = "DynamicsCompressorNode";
Promise.all([
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "attack",
initialValue: 0.1,
rampFinalValue: 0.5
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "knee",
initialValue: 0,
rampFinalValue: 25
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "ratio",
initialValue: 1,
rampFinalValue: 15
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "release",
initialValue: 0,
rampFinalValue: 0.75
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "threshold",
initialValue: -50,
rampFinalValue: -10
})
- ]).then(taskDone);
+ ]).then(() => task.done());
});
- audit.defineTask("GainNode", function (taskDone) {
- testParamAutomation({
+ audit.define("GainNode", (task, should) => {
+ testParamAutomation(should, {
nodeName: "GainNode",
paramName: "gain",
initialValue: 1,
rampFinalValue: 0.5
- }).then(taskDone);
+ }).then(() => task.done());
});
- audit.defineTask("PannerNode", function (taskDone) {
+ audit.define("PannerNode", (task, should) => {
var nodeName = "PannerNode";
Promise.all([
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "positionX",
initialValue: 0.1,
rampFinalValue: 0.5
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "positionY",
initialValue: 2,
rampFinalValue: 30
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "positionZ",
initialValue: 1,
rampFinalValue: 15
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "orientationX",
initialValue: 0.1,
rampFinalValue: 0.5
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "orientationY",
initialValue: 2,
rampFinalValue: 30
}),
- testParamAutomation({
+ testParamAutomation(should, {
nodeName: nodeName,
paramName: "orientationZ",
initialValue: 1,
rampFinalValue: 15
}),
- ]).then(taskDone);
+ ]).then(() => task.done());
});
- audit.defineTask("StereoPannerNode", function (taskDone) {
- testParamAutomation({
+ audit.define("StereoPannerNode", (task, should) => {
+ testParamAutomation(should, {
nodeName: "StereoPannerNode",
paramName: "pan",
initialValue: 1,
rampFinalValue: 0.5
- }).then(taskDone);
+ }).then(() => task.done());
});
- audit.defineTask("AudioListener", function (taskDone) {
+ audit.define("AudioListener", (task, should) => {
Promise.all([
- testAudioListener({
+ testAudioListener(should, {
paramName: "positionX",
initialValue: 1,
rampFinalValue: 100
}),
- testAudioListener({
+ testAudioListener(should, {
paramName: "positionY",
initialValue: 1,
rampFinalValue: 200
}),
- testAudioListener({
+ testAudioListener(should, {
paramName: "positionZ",
initialValue: 1,
rampFinalValue: 300
}),
- testAudioListener({
+ testAudioListener(should, {
paramName: "forwardX",
initialValue: 1,
rampFinalValue: -100
}),
- testAudioListener({
+ testAudioListener(should, {
paramName: "forwardY",
initialValue: 1,
rampFinalValue: -200
}),
- testAudioListener({
+ testAudioListener(should, {
paramName: "forwardZ",
initialValue: 1,
rampFinalValue: -300
}),
- testAudioListener({
+ testAudioListener(should, {
paramName: "upX",
initialValue: 1,
rampFinalValue: 99
}),
- testAudioListener({
+ testAudioListener(should, {
paramName: "upY",
initialValue: 1,
rampFinalValue: 42
}),
- testAudioListener({
+ testAudioListener(should, {
paramName: "upZ",
initialValue: 1,
rampFinalValue: 137
}),
- ]).then(taskDone);
+ ]).then(() => task.done());
});
// Run test of automation processing. |options| is a dictionary that
@@ -230,7 +230,7 @@
// Processing is started and after some number of frames, the |.value| of
// the AudioParam is obtained and compared against the final value. These
// should match exactly.
- function testParamAutomation(options) {
+ function testParamAutomation(should, options) {
var context = new OfflineAudioContext(1, renderFrames, sampleRate);
// Create the node to be tested
@@ -250,19 +250,18 @@
// Sanity check: the given ramp final value must not be the default
// value, otherwise we can't easily tell if the automation was
// actually run.
- Should(options.nodeName + "." + options.paramName + " ramp final value",
- options.rampFinalValue)
+ should(options.rampFinalValue,
+ options.nodeName + "." + options.paramName + " ramp final value")
.notBeEqualTo(node[options.paramName].defaultValue);
// The actual AudioParam value should be the rampe final value.
- Should(options.nodeName + "." + options.paramName +
- ".value",
- node[options.paramName].value)
+ should(node[options.paramName].value,
+ options.nodeName + "." + options.paramName + ".value")
.beEqualTo(options.rampFinalValue);
});
}
- function testAudioListener(options) {
+ function testAudioListener(should, options) {
var context = new OfflineAudioContext(1, renderFrames, sampleRate);
// Create the node to be tested
@@ -282,19 +281,18 @@
// Sanity check: the given ramp final value must not be the default
// value, otherwise we can't easily tell if the automation was
// actually run.
- Should("AudioListener." + options.paramName + " ramp final value",
- options.rampFinalValue)
+ should(options.rampFinalValue,
+ "AudioListener." + options.paramName + " ramp final value")
.notBeEqualTo(context.listener[options.paramName].defaultValue);
// The actual AudioParam value should be the rampe final value.
- Should("AudioListener." + options.paramName +
- ".value",
- context.listener[options.paramName].value)
+ should(context.listener[options.paramName].value,
+ "AudioListener." + options.paramName + ".value")
.beEqualTo(options.rampFinalValue);
});
}
- audit.runTasks();
+ audit.run();
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698