| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="../resources/audit.js"></script> | 6 <script src="../resources/audit.js"></script> |
| 7 <title>Test decodeAudioData promises</title> | 7 <title>Test decodeAudioData promises</title> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <script> | 10 <script> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // correctly. | 48 // correctly. |
| 49 audit.define('decode-valid-file', (task, should) => { | 49 audit.define('decode-valid-file', (task, should) => { |
| 50 // Note that the order of completion for each promise is undefined and | 50 // Note that the order of completion for each promise is undefined and |
| 51 // we do not care about it in this test. | 51 // we do not care about it in this test. |
| 52 Promise | 52 Promise |
| 53 .all([ | 53 .all([ |
| 54 // Do not use the original arrayBuffers for decoding; decode a copy | 54 // Do not use the original arrayBuffers for decoding; decode a copy |
| 55 // because decodeAudioData will detach the buffers. | 55 // because decodeAudioData will detach the buffers. |
| 56 should(context.decodeAudioData(validArrayBuffer.slice(0)), | 56 should(context.decodeAudioData(validArrayBuffer.slice(0)), |
| 57 'Decoding a valid audio file') | 57 'Decoding a valid audio file') |
| 58 .beResolved(), | 58 .beResolved() |
| 59 .then(buffer => referenceDecodedAudioBuffer = buffer), |
| 59 should(context.decodeAudioData(invalidArrayBuffer.slice(0)), | 60 should(context.decodeAudioData(invalidArrayBuffer.slice(0)), |
| 60 'Decoding an invalid audio file') | 61 'Decoding an invalid audio file') |
| 61 .beRejectedWith('EncodingError'), | 62 .beRejectedWith('EncodingError'), |
| 62 should(context.decodeAudioData(null), 'Decoding null AudioBuffer') | 63 should(context.decodeAudioData(null), 'Decoding null AudioBuffer') |
| 63 .beRejected() | 64 .beRejected() |
| 64 ]) | 65 ]) |
| 65 .then(() => task.done()); | 66 .then(() => task.done()); |
| 66 }); | 67 }); |
| 67 | 68 |
| 68 // Decode a valid file and verify that the promise is fulfilled and the | 69 // Decode a valid file and verify that the promise is fulfilled and the |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 onlineContext.close() | 166 onlineContext.close() |
| 166 .then(() => { return context.decodeAudioData(validArrayBuffer); }) | 167 .then(() => { return context.decodeAudioData(validArrayBuffer); }) |
| 167 .then(resolveOrReject, resolveOrReject) | 168 .then(resolveOrReject, resolveOrReject) |
| 168 .then(() => { task.done(); }); | 169 .then(() => { task.done(); }); |
| 169 }); | 170 }); |
| 170 | 171 |
| 171 audit.run(); | 172 audit.run(); |
| 172 </script> | 173 </script> |
| 173 </body> | 174 </body> |
| 174 </html> | 175 </html> |
| OLD | NEW |