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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/resources/late-start-testing.js

Issue 1488693006: Fix flaky WebAudio layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/resources/late-start-testing.js
diff --git a/third_party/WebKit/LayoutTests/webaudio/resources/late-start-testing.js b/third_party/WebKit/LayoutTests/webaudio/resources/late-start-testing.js
deleted file mode 100644
index 96f709b1285e757504e96ddeddc592f981fa00bf..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/webaudio/resources/late-start-testing.js
+++ /dev/null
@@ -1,69 +0,0 @@
-function runLateStartTest(audit, context, node) {
-
- // Set up a dummy signal path to keep the audio context running and spend
- // processing time before calling start(0).
- var osc = context.createOscillator();
- var silent = context.createGain();
-
- osc.connect(silent);
- silent.connect(context.destination);
- silent.gain.setValueAtTime(0.0, 0);
- osc.start();
-
- node.connect(context.destination);
-
- // Task: define |onstatechange| and start rendering.
- audit.defineTask('test-late-start', function (done) {
-
- // Trigger playback at 0 second. The assumptions are:
- //
- // 1) The specified timing of start() call is already passed in terms of
- // the context time. So the argument |0| will be clamped to the current
- // context time.
- // 2) The |onstatechange| event will be fired later than the 0 second
- // context time.
- //
- // See issue: crbug.com/462167
- context.onstatechange = function () {
- if (context.state === 'running') {
- node.start(0);
- }
- };
-
- // Start rendering and verify result: this verifies if 1) the rendered
- // buffer contains at least one non-zero value and 2) the non-zero value is
- // found later than the first output sample.
- context.startRendering().then(function (buffer) {
-
- var nonZeroValueIndex = -1;
- var channelData = buffer.getChannelData(0);
- for (var i = 0; i < channelData.length; i++) {
- if (channelData[i] !== 0) {
- nonZeroValueIndex = i;
- break;
- }
- }
-
- if (nonZeroValueIndex === -1) {
- testFailed('The rendered buffer was all zeros.');
- } else if (nonZeroValueIndex === 0) {
- testFailed('The first sample was non-zero value. It should be zero.');
- } else {
- testPassed('The rendered buffer contains non-zero values after the first sample.');
- }
-
- done();
- });
- });
-
- audit.defineTask('finish-test', function (done) {
- done();
- finishJSTest();
- });
-
- audit.runTasks(
- 'test-late-start',
- 'finish-test'
- );
-
-}

Powered by Google App Engine
This is Rietveld 408576698