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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/note-grain-on-timing.html

Issue 2594183003: Convert note-grain-on tests to testharness (Closed)
Patch Set: Clean up Created 3 years, 11 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>
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 <script src="../resources/note-grain-on-testing.js"></script> 8 <script src="../resources/note-grain-on-testing.js"></script>
8 </head> 9 </head>
9 10
10 <body> 11 <body>
11 <div id="description"></div> 12 <script>
12 <div id="console"></div> 13 let audit = Audit.createTaskRunner();
13 14
14 <script> 15 let squarePulseBuffer;
15 description("Test timing of noteGrainOn.");
16 16
17 var squarePulseBuffer; 17 function checkResult(buffer, should) {
18 renderedData = buffer.getChannelData(0);
19 let nSamples = renderedData.length;
18 20
19 function checkResult(event) { 21 let success = true;
20 var buffer = event.renderedBuffer; 22
21 renderedData = buffer.getChannelData(0); 23 let startEndFrames = findStartAndEndSamples(renderedData);
22 var nSamples = renderedData.length;
23 24
24 var success = true; 25 success = success && verifyStartAndEndFrames(startEndFrames, should);
hongchan 2017/01/18 18:19:03 Hmm. Why do we need 'success'? The new Audit task
Raymond Toy 2017/01/18 19:33:30 Not needed anymore. It was previously used to pri
25
26 var startEndFrames = findStartAndEndSamples(renderedData);
27
28 success = success && verifyStartAndEndFrames(startEndFrames);
29
30 if (success) {
31 testPassed("noteGrainOn timing tests passed.");
32 } else {
33 testFailed("noteGrainOn timing tests failed.");
34 }
35
36 finishJSTest();
37 } 26 }
38 27
39 function runTest() { 28 audit.define("Test timing of noteGrainOn", function (task, should) {
40 if (window.testRunner) {
41 testRunner.dumpAsText();
42 testRunner.waitUntilDone();
43 }
44
45 window.jsTestIsAsync = true;
46
47 // Create offline audio context. 29 // Create offline audio context.
48 context = new OfflineAudioContext(2, sampleRate * renderTime, sampleRa te); 30 context = new OfflineAudioContext(2, sampleRate * renderTime, sampleRa te);
49 31
50 squarePulseBuffer = createSignalBuffer(context, function (k) { return 1 }); 32 squarePulseBuffer = createSignalBuffer(context, function (k) { return 1 });
51 33
52 playAllGrains(context, squarePulseBuffer, numberOfTests); 34 playAllGrains(context, squarePulseBuffer, numberOfTests);
53 35
54 context.oncomplete = checkResult; 36 context.startRendering()
55 context.startRendering(); 37 .then(function (audioBuffer) {
56 } 38 checkResult(audioBuffer, should);
39 })
40 .then(task.done.bind(task));;
41 });
57 42
58 runTest(); 43 audit.run();
59 successfullyParsed = true;
60
61 </script> 44 </script>
62 45
63 </body> 46 </body>
64 </html> 47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698