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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-duration.html

Issue 2780433005: Convert AudioParam tests to new Audit (Closed)
Patch Set: Address review comments Created 3 years, 8 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> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/testharness.js"></script> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script> 5 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../resources/audit-util.js"></script> 6 <script src="../resources/audit-util.js"></script>
7 <script src="../resources/audio-testing.js"></script> 7 <script src="../resources/audit.js"></script>
8 <script src="../resources/audioparam-testing.js"></script> 8 <script src="../resources/audioparam-testing.js"></script>
9 <title>Test setValueCurveAtTime with Huge Duration</title> 9 <title>Test setValueCurveAtTime with Huge Duration</title>
10 </head> 10 </head>
11 11
12 <body> 12 <body>
13 <script> 13 <script>
14 14
15 var sampleRate = 48000; 15 var sampleRate = 48000;
16 var renderFrames = 1000; 16 var renderFrames = 1000;
17 17
18 var audit = Audit.createTaskRunner(); 18 var audit = Audit.createTaskRunner();
19 19
20 audit.defineTask("long duration", function (done) { 20 audit.define("long duration", (task, should) => {
21 // We only need to generate a small number of frames for this test. 21 // We only need to generate a small number of frames for this test.
22 var context = new OfflineAudioContext(1, renderFrames, sampleRate); 22 var context = new OfflineAudioContext(1, renderFrames, sampleRate);
23 var src = context.createBufferSource(); 23 var src = context.createBufferSource();
24 24
25 // Constant source of amplitude 1, looping. 25 // Constant source of amplitude 1, looping.
26 src.buffer = createConstantBuffer(context, 1, 1); 26 src.buffer = createConstantBuffer(context, 1, 1);
27 src.loop = true; 27 src.loop = true;
28 28
29 // Automate the gain with a setValueCurve with a very long duration. Th e duration should 29 // Automate the gain with a setValueCurve with a very long duration. Th e duration should
30 // produce a frame number greater than 2^64 (larger than the largest siz e_t value). 30 // produce a frame number greater than 2^64 (larger than the largest siz e_t value).
(...skipping 12 matching lines...) Expand all
43 var max = Math.max.apply(null, result.getChannelData(0)); 43 var max = Math.max.apply(null, result.getChannelData(0));
44 44
45 // The automation does linear interpolation between 0 and 1 from time 0 to duration. 45 // The automation does linear interpolation between 0 and 1 from time 0 to duration.
46 // Hence the max value of the interpolation occurs at the end of the rendering. Compute 46 // Hence the max value of the interpolation occurs at the end of the rendering. Compute
47 // this value. 47 // this value.
48 48
49 var expectedMax = (renderFrames / sampleRate) * (1 / duration); 49 var expectedMax = (renderFrames / sampleRate) * (1 / duration);
50 50
51 var message = "setValueCurve([" + curve + "], 0, " + duration + ")"; 51 var message = "setValueCurve([" + curve + "], 0, " + duration + ")";
52 52
53 success = Should("Max amplitude of " + message, max, { 53 should(max, "Max amplitude of " + message)
54 brief: true 54 .beLessThanOrEqualTo(expectedMax);
55 }).beLessThanOrEqualTo(expectedMax); 55 }).then(() => task.done());
56
57 Should(message, success)
58 .summarize("correctly rounded",
59 "incorrectly rendered with a peak value of " + max);
60 }).then(done);
61 }); 56 });
62 57
63 audit.defineTask("finish", function (done) { 58 audit.run();
64 done();
65 });
66
67 audit.runTasks();
68 </script> 59 </script>
69 </body> 60 </body>
70 </html> 61 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698