Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 <script src="resources/audio-testing.js"/> | |
| 6 <script src="resources/compatibility.js"></script> | 5 <script src="resources/compatibility.js"></script> |
| 6 <script src="resources/audio-testing.js"></script> | |
|
Raymond Toy
2015/02/20 21:35:14
Does the order matter?
hongchan
2015/02/20 22:20:09
Just to make it consistent and by the order of sco
| |
| 7 <title>OfflineAudioContext.startRendering Promise with oncomplete</title> | 7 <title>OfflineAudioContext.startRendering Promise with oncomplete</title> |
| 8 </head> | 8 </head> |
| 9 | 9 |
| 10 <body> | 10 <body> |
| 11 <script> | 11 <script> |
| 12 description("Test OfflineAudioContext.startRendering Promise with oncomple te") | 12 description("Test OfflineAudioContext.startRendering Promise with oncomple te"); |
| 13 | 13 |
| 14 var context; | 14 var context; |
| 15 var promise; | 15 var promise; |
| 16 var renderedData; | 16 var renderedData; |
| 17 var promiseData; | 17 var promiseData; |
| 18 | 18 |
| 19 var sampleRate = 48000; | 19 var sampleRate = 48000; |
| 20 var renderSeconds = 1; | 20 var renderSeconds = 1; |
| 21 var renderFrames = sampleRate * renderSeconds; | 21 var renderFrames = sampleRate * renderSeconds; |
| 22 var contextChannels = 2; | 22 var contextChannels = 2; |
| 23 | 23 |
| 24 function compareData() { | 24 function compareData() { |
| 25 // The spec implies that the same buffer is returned by both oncomplete and the promise. | 25 // The spec implies that the same buffer is returned by both oncomplete and the promise. |
| 26 // Check that they are identical. | 26 // Check that they are identical. |
| 27 if (renderedData === promiseData) { | 27 if (renderedData === promiseData) { |
| 28 testPassed("AudioBuffer returned by oncomplete and promise are identic al"); | 28 testPassed("AudioBuffer returned by oncomplete and promise are identic al"); |
| 29 } else { | 29 } else { |
| 30 testPassed("AudioBuffer returned by oncomplete and promise are NOT ide ntical"); | 30 testFailed("AudioBuffer returned by oncomplete and promise are NOT ide ntical"); |
|
Raymond Toy
2015/02/20 21:35:14
I don't think this change should be part of this C
hongchan
2015/02/20 22:20:09
Will do!
| |
| 31 } | 31 } |
| 32 finishJSTest(); | 32 finishJSTest(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 function checkResult (event) | 35 function checkResult (event) |
| 36 { | 36 { |
| 37 renderedData = event.renderedBuffer; | 37 renderedData = event.renderedBuffer; |
| 38 promise.then(function (result) { | 38 promise.then(function (result) { |
| 39 promiseData = result; | 39 promiseData = result; |
| 40 compareData(); | 40 compareData(); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 64 promise = context.startRendering(); | 64 promise = context.startRendering(); |
| 65 | 65 |
| 66 } | 66 } |
| 67 | 67 |
| 68 runTest(); | 68 runTest(); |
| 69 successfullyParsed = true; | 69 successfullyParsed = true; |
| 70 </script> | 70 </script> |
| 71 | 71 |
| 72 </body> | 72 </body> |
| 73 </html> | 73 </html> |
| OLD | NEW |