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

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: 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 function checkResult(e, task, should) {
17 var renderLengthInFrames = 512; 19 should(true, 'ScriptProcessorNode accepts 0 input channels').beTrue();
18 var bufferSize = 512; 20 task.done();
hongchan 2017/02/24 23:12:46 These two lines can go into the line 51. Then we c
Raymond Toy 2017/02/27 17:31:22 Done.
19
20 function checkResult(e)
21 {
22 testPassed("ScriptProcessorNode accepts 0 input channels.");
23
24 finishJSTest();
25 } 21 }
26 22
27 function runTest() 23 audit.define(
28 { 24 {
29 if (window.testRunner) { 25 label: 'test',
30 testRunner.dumpAsText(); 26 description: 'Tests that ScriptProcessorNode accepts 0 input channels'
31 testRunner.waitUntilDone(); 27 },
32 } 28 (task, should) => {
29 let context =
30 new OfflineAudioContext(1, renderLengthInFrames, sampleRate);
33 31
34 window.jsTestIsAsync = true; 32 let node;
35 33
36 var context = new OfflineAudioContext(1, renderLengthInFrames, sampleRate); 34 should(() => {
35 node = context.createScriptProcessor(bufferSize, 0, 1);
36 }, 'node = context.createScriptProcessor(bufferSize, 0, 1)').notThrow();
37 let source = context.createBufferSource();
38 source.buffer = createImpulseBuffer(context, bufferSize);
37 39
38 var node; 40 // The onaudioprocess function doesn't need to do anything. We just need
41 // the process to start to test that implementation accepts 0 input
42 // channels.
43 //
44 // FIXME: check the .inputBuffer attribute of the AudioProcessingEvent.
45 node.onaudioprocess = function(e) {};
46 source.connect(node);
47 node.connect(context.destination);
48 source.start(0);
39 49
40 try { 50 context.oncomplete = event => {
41 node = context.createScriptProcessor(bufferSize, 0, 1); 51 checkResult(event, task, should);
42 testPassed("Successfully created ScriptProcessorNode."); 52 };
43 } catch (e) { 53 ;
44 testFailed("Failed to create ScriptProcessorNode."); 54 context.startRendering();
45 } 55 });
46 56
47 var source = context.createBufferSource(); 57 audit.run();
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> 58 </script>
66 59
67 </body> 60 </body>
68 </html> 61 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698