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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/gain.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/gain.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/gain.html b/third_party/WebKit/LayoutTests/webaudio/gain.html
deleted file mode 100644
index f3c7549c166dfb4ab4e03460ce71de0ba4c79049..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/webaudio/gain.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-
-<!--
-Tests that GainNode is properly scaling the gain.
-We'll render 11 notes, starting at a gain of 1.0, decreasing in gain by 0.1.
-The 11th note will be of gain 0.0, so it should be silent (at the end in the rendered output).
--->
-
-<html>
-<head>
-<script src="resources/audit-util.js"></script>
-<script src="resources/audio-testing.js"></script>
-
-</head>
-<body>
-
-<script>
-
-window.onload = init;
-
-var sampleRate = 44100.0;
-var bufferDurationSeconds = 0.125;
-var numberOfNotes = 11;
-var noteSpacing = bufferDurationSeconds + 0.020; // leave 20ms of silence between each "note"
-var lengthInSeconds = numberOfNotes * noteSpacing;
-
-var context = 0;
-var sinWaveBuffer = 0;
-
-function createSinWaveBuffer(lengthInSeconds, frequency) {
- var audioBuffer = context.createBuffer(2, lengthInSeconds * sampleRate, sampleRate);
-
- var n = audioBuffer.length;
- var channelL = audioBuffer.getChannelData(0);
- var channelR = audioBuffer.getChannelData(1);
-
- for (var i = 0; i < n; ++i) {
- channelL[i] = Math.sin(frequency * 2.0*Math.PI * i / sampleRate);
- channelR[i] = channelL[i];
- }
-
- return audioBuffer;
-}
-
-function playNote(time, gain) {
- var source = context.createBufferSource();
- source.buffer = sinWaveBuffer;
-
- var gainNode = context.createGain();
- gainNode.gain.value = gain;
-
- source.connect(gainNode);
- gainNode.connect(context.destination);
-
- source.start(time);
-}
-
-function init() {
- if (!window.testRunner)
- return;
-
- // Create offline audio context.
- context = new OfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRate);
-
- // Create a buffer for a short "note".
- sinWaveBuffer = createSinWaveBuffer(bufferDurationSeconds, 880.0);
-
- // Render 11 notes, starting at a gain of 1.0, decreasing in gain by 0.1.
- // The last note will be of gain 0.0, so shouldn't be perceptible in the rendered output.
- for (var i = 0; i < numberOfNotes; ++i) {
- var time = i * noteSpacing;
- var gain = 1.0 - i / (numberOfNotes - 1);
- playNote(time, gain);
- }
-
- context.oncomplete = finishAudioTest;
- context.startRendering();
-
- testRunner.waitUntilDone();
-}
-
-</script>
-
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698