Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / webaudio / audioparam-exponentialRampToValueAtTime.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3   <head>
4     <script src="resources/audio-testing.js"></script>
5     <script src="resources/audioparam-testing.js"></script>
6     <script src="../resources/js-test-pre.js"></script>
7   </head>
8
9   <body>
10     <div id="description"></div>
11     <div id="console"></div>
12
13     <script>
14       description("Test AudioParam exponentialRampToValueAtTime() functionality.");
15
16       // Play a long DC signal out through an AudioGainNode, and call setValueAtTime() and
17       // exponentialRampToValueAtTime() at regular intervals to set the starting and ending values
18       // for an exponential ramp.  Each time interval has a ramp with a different starting and
19       // ending value so that there is a discontinuity at each time interval boundary.  The
20       // discontinuity is for testing timing.  Also, we alternate between an increasing and
21       // decreasing ramp for each interval.
22
23       // Number of tests to run.
24       var numberOfTests = 100;
25
26       // Max allowed difference between the rendered data and the expected result.
27       var maxAllowedError = 6.75e-4;
28
29       // The AudioGainNode starts with this value instead of the default value.
30       var initialValue = 100;
31
32       // Set the gain node value to the specified value at the specified time.
33       function setValue(value, time)
34       {
35           gainNode.gain.setValueAtTime(value, time);
36       }
37
38       // Generate an exponential ramp ending at time |endTime| with an ending value of |value|.
39       function generateRamp(value, startTime, endTime)
40       {
41           // |startTime| is ignored because the exponential ramp
42           // uses the value from the setValueAtTime() call above.
43           gainNode.gain.exponentialRampToValueAtTime(value, endTime)
44       }
45       
46       function runTest()
47       {
48           createAudioGraphAndTest(numberOfTests,
49                                   initialValue,
50                                   setValue,
51                                   generateRamp,
52                                   "exponentialRampToValueAtTime()",
53                                   maxAllowedError,
54                                   createExponentialRampArray);
55
56       }
57
58       runTest();
59       successfullyParsed = true;
60       
61     </script>
62
63     <script src="../resources/js-test-post.js"></script>
64   </body>
65 </html>