| 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('Test the late call of start(0) of BufferSource.'); | |
| 13 window.jsTestIsAsync = true; | |
| 14 | 13 |
| 15 var renderQuantum = 128; | 14 var renderQuantum = 128; |
| 16 | 15 |
| 17 var sampleRate = 44100; | 16 var sampleRate = 44100; |
| 18 var renderDuration = 0.25; | 17 var renderDuration = 0.25; |
| 19 var startTime = 0.5 * renderDuration; | 18 var startTime = 0.5 * renderDuration; |
| 20 | 19 |
| 21 var audit = Audit.createTaskRunner(); | 20 var audit = Audit.createTaskRunner(); |
| 22 | 21 |
| 23 // Calculate the index for actual start time. | 22 // Calculate the index for actual start time. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 context.startRendering().then(function (buffer) { | 61 context.startRendering().then(function (buffer) { |
| 63 | 62 |
| 64 var channelData = buffer.getChannelData(0); | 63 var channelData = buffer.getChannelData(0); |
| 65 var startIndex = getStartIndex(startTime); | 64 var startIndex = getStartIndex(startTime); |
| 66 var nonZeroValueIndex = getValueChangeIndex(channelData, 1.0); | 65 var nonZeroValueIndex = getValueChangeIndex(channelData, 1.0); |
| 67 | 66 |
| 68 Should('The output', channelData).containValues([0, 1]); | 67 Should('The output', channelData).containValues([0, 1]); |
| 69 Should('The index of value change', nonZeroValueIndex) | 68 Should('The index of value change', nonZeroValueIndex) |
| 70 .beEqualTo(startIndex); | 69 .beEqualTo(startIndex); |
| 71 | 70 |
| 72 if (nonZeroValueIndex === 0) | 71 Should('The index of the first non-zero sample', nonZeroValueIndex) |
| 73 testFailed('The first sample was non-zero value. It should be zero.'); | 72 .notBeEqualTo(0) |
| 74 else | 73 |
| 75 testPassed('The rendered buffer contains non-zero values after the fir
st sample.'); | |
| 76 | |
| 77 }).then(done); | 74 }).then(done); |
| 78 }); | 75 }); |
| 79 | 76 |
| 80 audit.defineTask('finish-test', function (done) { | 77 audit.defineTask('finish-test', function (done) { |
| 81 done(); | 78 done(); |
| 82 finishJSTest(); | |
| 83 }); | 79 }); |
| 84 | 80 |
| 85 audit.runTasks(); | 81 audit.runTasks(); |
| 86 | 82 |
| 87 successfullyParsed = true; | 83 successfullyParsed = true; |
| 88 </script> | 84 </script> |
| 89 </body> | 85 </body> |
| 90 | 86 |
| 91 </html> | 87 </html> |
| OLD | NEW |