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

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

Issue 2672053002: Convert Oscillator Audit tests to testharness (Closed)
Patch Set: Minor cleanups Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 function runLateStartTest(audit, context, node) { 1 function runLateStartTest(audit, context, node) {
hongchan 2017/02/14 17:58:41 Ditto. Please rebase this file.
2 2
3 // Set up a dummy signal path to keep the audio context running and spend 3 // Set up a dummy signal path to keep the audio context running and spend
4 // processing time before calling start(0). 4 // processing time before calling start(0).
5 var osc = context.createOscillator(); 5 var osc = context.createOscillator();
6 var silent = context.createGain(); 6 var silent = context.createGain();
7 7
8 osc.connect(silent); 8 osc.connect(silent);
9 silent.connect(context.destination); 9 silent.connect(context.destination);
10 silent.gain.setValueAtTime(0.0, 0); 10 silent.gain.setValueAtTime(0.0, 0);
11 osc.start(); 11 osc.start();
(...skipping 25 matching lines...) Expand all
37 37
38 var nonZeroValueIndex = -1; 38 var nonZeroValueIndex = -1;
39 var channelData = buffer.getChannelData(0); 39 var channelData = buffer.getChannelData(0);
40 for (var i = 0; i < channelData.length; i++) { 40 for (var i = 0; i < channelData.length; i++) {
41 if (channelData[i] !== 0) { 41 if (channelData[i] !== 0) {
42 nonZeroValueIndex = i; 42 nonZeroValueIndex = i;
43 break; 43 break;
44 } 44 }
45 } 45 }
46 46
47 if (nonZeroValueIndex === -1) { 47 Should("The rendered buffer should not be all zeroes",
48 testFailed('The rendered buffer was all zeros.'); 48 nonZeroValueIndex !== -1)
49 } else if (nonZeroValueIndex === 0) { 49 .beEqualTo(true);
50 testFailed('The first sample was non-zero value. It should be zero.'); 50 Should("The first sample",
51 } else { 51 channelData[0])
52 testPassed('The rendered buffer contains non-zero values after the first sample.'); 52 .beEqualTo(0);
53 } 53 Should("The rendered buffer contains non-zero values after the first sampl e",
54 nonZeroValueIndex > 0)
55 .beEqualTo(true);
54 56
55 done(); 57 done();
56 }); 58 });
57 }); 59 });
58 60
59 audit.defineTask('finish-test', function (done) { 61 audit.runTasks();
60 done(); 62 }
61 finishJSTest();
62 });
63
64 audit.runTasks(
65 'test-late-start',
66 'finish-test'
67 );
68
69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698