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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/constructor/waveshaper.html

Issue 2833863002: Convert constructor/waveshaper.html to use new Audit (Closed)
Patch Set: Rebase 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/webaudio/constructor/waveshaper.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/constructor/waveshaper.html b/third_party/WebKit/LayoutTests/webaudio/constructor/waveshaper.html
index 2968b1c6115a9ba788aa546608eddda12828b8fb..ea5865814225871fbe9fd708b8bef6a659ad5e62 100644
--- a/third_party/WebKit/LayoutTests/webaudio/constructor/waveshaper.html
+++ b/third_party/WebKit/LayoutTests/webaudio/constructor/waveshaper.html
@@ -5,8 +5,8 @@
<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="audionodeoptions.js"></script>
+ <script src="../resources/audit.js"></script>
+ <script src="new-audionodeoptions.js"></script>
</head>
<body>
@@ -15,99 +15,57 @@
var audit = Audit.createTaskRunner();
- audit.defineTask("initialize", function (taskDone) {
- Should("Construct Offline context", function () {
- context = new OfflineAudioContext(1, 1, 48000);
- }).notThrow();
- taskDone();
+ audit.define('initialize', (task, should) => {
+ context = initializeContext(should);
+ task.done();
});
- audit.defineTask("incorrect construction", function (taskDone) {
- var success = true;
-
- success = Should("new WaveShaperNode()", function () {
- new WaveShaperNode();
- }).throw("TypeError");
- success = Should("new WaveShaperNode(1)", function () {
- new WaveShaperNode(1);
- }).throw("TypeError") && success;
- success = Should("new WaveShaperNode(context, 42)", function () {
- new WaveShaperNode(context, 42);
- }).throw("TypeError") && success;
-
- success = Should("Invalid constructors", success)
- .summarize(
- "correctly threw errors",
- "did not throw errors in all cases");
- taskDone();
+ audit.define('incorrect construction', (task, should) => {
+ testInvalidConstructor(should, 'WaveShaperNode', context);
+ task.done();
});
- audit.defineTask("valid default construction", function (taskDone) {
- var node;
-
- success = Should("node0 = new WaveShaperNode(context)", function () {
- node = new WaveShaperNode(context);
- }).notThrow();
- success = Should("node0.curve", node.curve).beEqualTo(null) && success;
- success = Should("node0.oversample", node.oversample).beEqualTo("none") && success;
-
- success = Should("node0.channelCount", node.channelCount)
- .beEqualTo(2) && success;
- success = Should("node0.channelCountMode", node.channelCountMode)
- .beEqualTo("max") && success;
- success = Should("node0.channelInterpretation", node.channelInterpretation)
- .beEqualTo("speakers") && success;
+ audit.define('valid default construction', (task, should) => {
+ let prefix = 'node0';
+ let node = testDefaultConstructor(should, 'WaveShaperNode', context, {
+ prefix: prefix,
+ numberOfInputs: 1,
+ numberOfOutputs: 1,
+ channelCount: 2,
+ channelCountMode: 'max',
+ channelInterpretation: 'speakers'
+ });
- Should("new WaveShaperNode(context)", success)
- .summarize(
- "constructed node with correct attributes",
- "did not construct correct node correctly")
+ testDefaultAttributes(should, node, prefix, [
+ {name: 'curve', value: null}, {name: 'oversample', value: 'none'}
+ ]);
- taskDone();
+ task.done();
});
- audit.defineTask("test AudioNodeOptions", function (taskDone) {
- testAudioNodeOptions(context, "WaveShaperNode");
- taskDone();
+ audit.define('test AudioNodeOptions', (task, should) => {
+ testAudioNodeOptions(should, context, 'WaveShaperNode');
+ task.done();
});
- audit.defineTask("valid non-default", function (taskDone) {
+ audit.define('valid non-default', (task, should) => {
// Construct an WaveShaperNode with options
- var options = {
- curve: Float32Array.from([1,2,3]),
- oversample: "4x"
- };
+ var options = {curve: Float32Array.from([1, 2, 3]), oversample: '4x'};
var node;
- var message = "node1 = new WaveShaperNode(, " + JSON.stringify(options) + ")";
- success = Should(message, function () {
- node = new WaveShaperNode(context, options);
- }).notThrow();
- success = Should("node1.curve", node.curve)
- .beEqualToArray(options.curve) && success;
- success = Should("node1.oversample", node.oversample)
- .beEqualTo(options.oversample) && success;
-
- Should("new WaveShaper() with options", success)
- .summarize(
- "constructed with correct attributes",
- "was not constructed correctly");
+ var message =
+ 'node1 = new WaveShaperNode(, ' + JSON.stringify(options) + ')';
+ should(() => {
+ node = new WaveShaperNode(context, options);
+ }, message).notThrow();
+ should(node.curve, 'node1.curve').beEqualToArray(options.curve);
+ should(node.oversample, 'node1.oversample')
+ .beEqualTo(options.oversample);
- taskDone();
+ task.done();
});
- if (window.SharedArrayBuffer) {
- audit.defineTask("invalid setCurve", function (taskDone) {
- var node = new WaveShaperNode(context);
-
- Should("WaveShaper.curve = SharedArrayBuffer view", function () {
- node.curve = new Float32Array(new SharedArrayBuffer(16));
- }).throw("TypeError");
- taskDone();
- });
- }
-
- audit.runTasks();
+ audit.run();
</script>
</body>
</html>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698