OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 | 3 |
4 <head> | 4 <head> |
5 <script src="../../resources/js-test.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
6 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
7 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audio-testing.js"></script> |
8 </head> | 9 </head> |
9 | 10 |
10 <body> | 11 <body> |
11 <script> | 12 <script> |
12 description('AudioBufferSourceNode: test the "zero" playbackRate.'); | |
13 window.jsTestIsAsync = true; | |
14 | 13 |
15 // Sample rate should be power of 128 to observe the change of AudioParam at | 14 // Sample rate should be power of 128 to observe the change of AudioParam at |
16 // the beginning of rendering quantum. (playbackRate is k-rate) This is the | 15 // the beginning of rendering quantum. (playbackRate is k-rate) This is the |
17 // minimum sample rate in the valid sample rate range. | 16 // minimum sample rate in the valid sample rate range. |
18 var sampleRate = 4096; | 17 var sampleRate = 4096; |
19 | 18 |
20 // The render duration in seconds, and the length in samples. | 19 // The render duration in seconds, and the length in samples. |
21 var renderDuration = 1.0; | 20 var renderDuration = 1.0; |
22 var renderLength = renderDuration * sampleRate; | 21 var renderLength = renderDuration * sampleRate; |
23 | 22 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 55 } |
57 } else { | 56 } else { |
58 // From the half position, the actual value should not change. | 57 // From the half position, the actual value should not change. |
59 if (data[i] !== rampData[half]) { | 58 if (data[i] !== rampData[half]) { |
60 passed = false; | 59 passed = false; |
61 break; | 60 break; |
62 } | 61 } |
63 } | 62 } |
64 } | 63 } |
65 | 64 |
66 if (passed) { | 65 Should('The zero playbackRate', passed) |
67 testPassed('The zero playbackRate held the sample value correctly.'); | 66 .summarize( |
68 } else { | 67 'held the sample value correctly', |
69 testFailed('The zero playbackRate should hold the sample value. ' + | 68 'should hold the sample value. ' + 'Expected ' + rampData[half] + |
70 'Expected ' + rampData[half] + ' but got ' + data[i] + ' at the inde
x ' + | 69 ' but got ' + data[i] + ' at the index ' + i); |
71 i + '.'); | |
72 } | |
73 }).then(done); | 70 }).then(done); |
74 }); | 71 }); |
75 | 72 |
76 audit.defineTask('finish', function (done) { | 73 audit.defineTask('finish', function (done) { |
77 finishJSTest(); | |
78 done(); | 74 done(); |
79 }); | 75 }); |
80 | 76 |
81 audit.runTasks( | 77 audit.runTasks( |
82 'synthesize-verify', | 78 'synthesize-verify', |
83 'finish' | 79 'finish' |
84 ); | 80 ); |
85 | 81 |
86 successfullyParsed = true; | 82 successfullyParsed = true; |
87 </script> | 83 </script> |
88 </body> | 84 </body> |
89 | 85 |
90 </html> | 86 </html> |
OLD | NEW |