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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Oscillator/oscillator-late-start.html

Issue 2810413004: Move late-start-testing.js to only user (Closed)
Patch Set: Remove file 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/resources/late-start-testing.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 3
4 <head> 4 <head>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
8 <script src="../resources/audit.js"></script> 8 <script src="../resources/audit.js"></script>
9 <script src="../resources/late-start-testing.js"></script>
10 </head> 9 </head>
11 10
12 <body> 11 <body>
13 <script> 12 <script>
14 var audit = Audit.createTaskRunner(); 13 let audit = Audit.createTaskRunner();
15 14
16 var sampleRate = 44100; 15 let sampleRate = 44100;
16 let renderLength = 1;
17 17
18 var renderLength = 1; 18 let context;
19 19 let node;
20 var context = new OfflineAudioContext(1, sampleRate * renderLength, sampleRa te);
21 var osc = context.createOscillator();
22 20
23 // Test the oscillator node is rendered correctly when the start time of sta rt() 21 // Test the oscillator node is rendered correctly when the start time of
24 // call is in the past in terms of the context time. 22 // start() call is in the past in terms of the context time.
25 runLateStartTest(audit, context, osc); 23 audit.define('initialize', (task, should) => {
24 should(
25 () => context =
26 new OfflineAudioContext(1, sampleRate * renderLength, sampleRate),
27 'Creating offline context for testing')
28 .notThrow();
29 should(() => {
30 // Set up a dummy signal path to keep the audio context running and
31 // spend processing time before calling start(0).
32 let osc = context.createOscillator();
33 let silent = context.createGain();
34
35 osc.connect(silent);
36 silent.connect(context.destination);
37 silent.gain.setValueAtTime(0.0, 0);
38 osc.start();
39
40 node = context.createOscillator();
41 node.connect(context.destination);
42 }, 'Creating graph for testing').notThrow();
43 task.done();
44 });
45
46 audit.define('test-late-start', (task, should) => {
47 // The node's start time will be clamped to the render quantum boundary
48 // >0.1 sec. Thus the rendered buffer will have non-zero frames.
49 // See issue: crbug.com/462167
50 let suspendTime = 0.1;
51 let suspendFrame = 128 * Math.floor(0.1 * context.sampleRate / 128);
52
53 context.suspend(suspendTime).then(() => {
54 node.start(0);
55 context.resume();
56 });
57
58 // Start rendering and verify result: this verifies if 1) the rendered
59 // buffer contains at least one non-zero value and 2) the non-zero value
60 // is found later than the first output sample.
61 context.startRendering()
62 .then(buffer => {
63 let channelData = buffer.getChannelData(0);
64 let nonZeroValueIndex = channelData.findIndex(x => x != 0);
65
66 should(
67 nonZeroValueIndex,
68 'The index (' + nonZeroValueIndex +
69 ') of first non-zero output value')
70 .beGreaterThanOrEqualTo(suspendFrame);
71
72 should(
73 channelData.slice(0, suspendFrame),
74 'Output[0:' + (suspendFrame - 1) + ']')
75 .beConstantValueOf(0);
76 })
77 .then(() => task.done());
78 ;
79 });
80
81 audit.run();
26 </script> 82 </script>
27 </body> 83 </body>
28 84
29 </html> 85 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/resources/late-start-testing.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698