| 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-util.js"></script> | 6 <script src="../resources/audit-util.js"></script> |
| 7 <script src="../resources/audit.js"></script> | 7 <script src="../resources/audit.js"></script> |
| 8 <title>OfflineAudioContext.startRendering Promise with oncomplete</title> | 8 <title>OfflineAudioContext.startRendering Promise with oncomplete</title> |
| 9 </head> | 9 </head> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 renderedData = event.renderedBuffer; | 35 renderedData = event.renderedBuffer; |
| 36 promise.then(function (result) { | 36 promise.then(function (result) { |
| 37 promiseData = result; | 37 promiseData = result; |
| 38 compareData(should); | 38 compareData(should); |
| 39 task.done(); | 39 task.done(); |
| 40 }); | 40 }); |
| 41 } | 41 } |
| 42 | 42 |
| 43 // Create an offline context and verify that both the oncomplete and | 43 // Create an offline context and verify that both the oncomplete and |
| 44 // promise are returned with the same stuff. | 44 // promise are returned with the same stuff. |
| 45 audit.define("test", (task, should) => { | 45 audit.define( |
| 46 task.describe( | 46 { |
| 47 "OfflineAudioContext.startRendering Promise with oncomplete"); | 47 label: 'test', |
| 48 context = new OfflineAudioContext(contextChannels, renderFrames, | 48 description: |
| 49 sampleRate); | 49 'OfflineAudioContext.startRendering Promise with oncomplete' |
| 50 }, |
| 51 (task, should) => { |
| 52 context = new OfflineAudioContext( |
| 53 contextChannels, renderFrames, sampleRate); |
| 50 | 54 |
| 51 var buffer = context.createBuffer(contextChannels, renderFrames, | 55 var buffer = |
| 52 sampleRate); | 56 context.createBuffer(contextChannels, renderFrames, sampleRate); |
| 53 for (var k = 0; k < renderFrames; ++k) { | 57 for (var k = 0; k < renderFrames; ++k) { |
| 54 buffer.getChannelData(0)[k] = 1; | 58 buffer.getChannelData(0)[k] = 1; |
| 55 buffer.getChannelData(1)[k] = 2; | 59 buffer.getChannelData(1)[k] = 2; |
| 56 } | 60 } |
| 57 | 61 |
| 58 var source = context.createBufferSource(); | 62 var source = context.createBufferSource(); |
| 59 source.buffer = buffer; | 63 source.buffer = buffer; |
| 60 source.connect(context.destination); | 64 source.connect(context.destination); |
| 61 source.start(); | 65 source.start(); |
| 62 | 66 |
| 63 context.oncomplete = (event) => { | 67 context.oncomplete = (event) => { |
| 64 checkResult(task, should, event); | 68 checkResult(task, should, event); |
| 65 }; | 69 }; |
| 66 | 70 |
| 67 promise = context.startRendering(); | 71 promise = context.startRendering(); |
| 68 | 72 |
| 69 }); | 73 }); |
| 70 | 74 |
| 71 audit.run(); | 75 audit.run(); |
| 72 </script> | 76 </script> |
| 73 | 77 |
| 74 </body> | 78 </body> |
| 75 </html> | 79 </html> |
| OLD | NEW |