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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/ScriptProcessor/scriptprocessornode-zero-input-channels.html

Issue 2718563004: Convert more ScriptProcessorNode tests to testharness (Closed)
Patch Set: Address review comments. Created 3 years, 9 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 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../resources/audit-util.js"></script> 6 <script src="../resources/audit-util.js"></script>
6 <script src="../resources/audio-testing.js"></script> 7 <script src="../resources/audit.js"></script>
7 </head> 8 </head>
8 9
9 <body> 10 <body>
10 <div id="description"></div> 11 <script>
11 <div id="console"></div> 12 let audit = Audit.createTaskRunner();
12 13
13 <script> 14 let sampleRate = 44100.0;
14 description("Tests that ScriptProcessorNode accepts 0 input channels."); 15 let renderLengthInFrames = 512;
16 let bufferSize = 512;
15 17
16 var sampleRate = 44100.0; 18 audit.define(
17 var renderLengthInFrames = 512; 19 {
18 var bufferSize = 512; 20 label: 'test',
21 description: 'Tests that ScriptProcessorNode accepts 0 input channels'
22 },
23 (task, should) => {
24 let context =
25 new OfflineAudioContext(1, renderLengthInFrames, sampleRate);
19 26
20 function checkResult(e) 27 let node;
21 {
22 testPassed("ScriptProcessorNode accepts 0 input channels.");
23 28
24 finishJSTest(); 29 should(() => {
25 } 30 node = context.createScriptProcessor(bufferSize, 0, 1);
31 }, 'node = context.createScriptProcessor(bufferSize, 0, 1)').notThrow();
32 let source = context.createBufferSource();
33 source.buffer = createImpulseBuffer(context, bufferSize);
26 34
27 function runTest() 35 // The onaudioprocess function doesn't need to do anything. We just need
28 { 36 // the process to start to test that implementation accepts 0 input
29 if (window.testRunner) { 37 // channels.
30 testRunner.dumpAsText(); 38 //
31 testRunner.waitUntilDone(); 39 // FIXME: check the .inputBuffer attribute of the AudioProcessingEvent.
32 } 40 node.onaudioprocess = function(e) {};
41 source.connect(node);
42 node.connect(context.destination);
43 source.start(0);
33 44
34 window.jsTestIsAsync = true; 45 context.oncomplete = event => {
46 should(true, 'ScriptProcessorNode accepts 0 input channels').beTrue();
47 task.done();
48 };
35 49
36 var context = new OfflineAudioContext(1, renderLengthInFrames, sampleRate); 50 context.startRendering();
51 });
37 52
38 var node; 53 audit.run();
39
40 try {
41 node = context.createScriptProcessor(bufferSize, 0, 1);
42 testPassed("Successfully created ScriptProcessorNode.");
43 } catch (e) {
44 testFailed("Failed to create ScriptProcessorNode.");
45 }
46
47 var source = context.createBufferSource();
48 source.buffer = createImpulseBuffer(context, bufferSize);
49
50 // The onaudioprocess function doesn't need to do anything. We just need th e process to start
51 // to test that implementation accepts 0 input channels.
52 //
53 // FIXME: check the .inputBuffer attribute of the AudioProcessingEvent.
54 node.onaudioprocess = function(e) { };
55 source.connect(node);
56 node.connect(context.destination);
57 source.start(0);
58
59 context.oncomplete = checkResult;
60 context.startRendering();
61 }
62
63 runTest();
64 successfullyParsed = true;
65 </script> 54 </script>
66 55
67 </body> 56 </body>
68 </html> 57 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698