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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-sampling.html

Issue 2581463002: Refactor WebAudio test directory (Closed)
Patch Set: Use correct path for wav result files Created 4 years 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-setTargetAtTime-sampling.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-sampling.html b/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-sampling.html
deleted file mode 100644
index 92f0b6c6da7775d46b2dc11ba08961b85ff97656..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-sampling.html
+++ /dev/null
@@ -1,103 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <script src="../resources/js-test.js"></script>
- <script src="resources/compatibility.js"></script>
- <script src="resources/audit-util.js"></script>
- <script src="resources/audio-testing.js"></script>
- <script src="resources/audioparam-testing.js"></script>
- <title>Test Sampling for SetTargetAtTime</title>
- </head>
-
- <body>
- <script>
- description("Test Sampling of SetTargetAtTime");
-
- window.jsTestIsAsync = true;
- // Some slow sample rate, but otherwise arbitrary.
- var sampleRate = 12800;
-
- // Time constant for setTargetValue. Make it short, but is otherwise arbitrary.
- var timeConstant = 10 / sampleRate;
-
- // Defaut initial gain for test. Arbitrary, but we want it large so the changes look large,
- // even if the relative change isn't.
- var initialGain = 10000;
-
- var audit = Audit.createTaskRunner();
-
- // 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) {
- var context = new OfflineAudioContext(1, 256, sampleRate);
- var source = context.createBufferSource();
- var b = context.createBuffer(1, 1, sampleRate);
- b.getChannelData(0)[0] = 1;
- source.buffer = b;
- source.loop = true;
-
- var gain = context.createGain();
- // Initialize the value of the gain node appropriately.
- initializeGainFunction(gain);
- gain.gain.setTargetAtTime(0, startFrame / sampleRate, timeConstant);
-
- source.connect(gain);
- gain.connect(context.destination);
-
- source.start();
-
- return context.startRendering().then(function (resultBuffer) {
- // Verify that the sampling of the setTargetAtTime automation was done correctly. We just
- // look at the sample just past the start of the automation.
- var resultData = resultBuffer.getChannelData(0);
- // Compute the true result at the frame just past startFrame and verify that the actual
- // 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);
- });
- }
-
- function initializeGainBySetter (g) {
- g.gain.value = initialGain;
- }
-
- function initializeGainBySetValue (g) {
- 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.defineTask("setValue;0.1", function (done) {
- doTest("Initialize by setValueAtTime", 0.1, 3.6029e-8, initializeGainBySetValue).then(done);
- });
-
- audit.defineTask("setValue;0.0", function (done) {
- doTest("Initialize by setValueAtTime", 0, 3.6029e-8, initializeGainBySetValue).then(done);
- });
-
- audit.defineTask("setter;128.1", function (done) {
- doTest("Initialize by setter", 128.1, 3.6029e-8, initializeGainBySetter).then(done);
- });
-
- audit.defineTask("setter;0.1", function (done) {
- doTest("Initialize by setter", 0.1, 3.6029e-8, initializeGainBySetter).then(done);
- });
-
- audit.defineTask("setter;0.0", function (done) {
- doTest("Initialize by setter", 0, 0, initializeGainBySetter).then(done);
- });
-
-
- audit.defineTask("finish", function (done) {
- finishJSTest();
- done();
- });
-
- audit.runTasks();
- successfullyParsed = true;
- </script>
- </body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698