| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test Setting of channelCountMode and channelInterpretation</title> | 4 <title>Test Setting of channelCountMode and channelInterpretation</title> |
| 5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 8 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audit.js"></script> |
| 9 </head> | 9 </head> |
| 10 | 10 |
| 11 <body> | 11 <body> |
| 12 <script> | 12 <script> |
| 13 // Fairly arbitrary sample rate and number of frames, except the number of | 13 // Fairly arbitrary sample rate and number of frames, except the number of |
| 14 // frames should be more than a few render quantums. | 14 // frames should be more than a few render quantums. |
| 15 var sampleRate = 16000; | 15 var sampleRate = 16000; |
| 16 var renderFrames = 10 * 128; | 16 var renderFrames = 10 * 128; |
| 17 | 17 |
| 18 var audit = Audit.createTaskRunner(); | 18 var audit = Audit.createTaskRunner(); |
| 19 | 19 |
| 20 audit.defineTask("interp", function (taskDone) { | 20 audit.define("interp", (task, should) => { |
| 21 var context = new OfflineAudioContext(1, renderFrames, sampleRate); | 21 var context = new OfflineAudioContext(1, renderFrames, sampleRate); |
| 22 var node = context.createGain(); | 22 var node = context.createGain(); |
| 23 | 23 |
| 24 // Set a new interpretation and verify that it changed. | 24 // Set a new interpretation and verify that it changed. |
| 25 node.channelInterpretation = "discrete"; | 25 node.channelInterpretation = "discrete"; |
| 26 var value = node.channelInterpretation; | 26 var value = node.channelInterpretation; |
| 27 Should("node.channelInterpretation", value).beEqualTo("discrete"); | 27 should(value, "node.channelInterpretation").beEqualTo("discrete"); |
| 28 node.connect(context.destination); | 28 node.connect(context.destination); |
| 29 | 29 |
| 30 context.startRendering().then(function (buffer) { | 30 context.startRendering().then(function (buffer) { |
| 31 // After rendering, the value should have been changed. | 31 // After rendering, the value should have been changed. |
| 32 Should("After rendering node.channelInterpretation", | 32 should(node.channelInterpretation, |
| 33 node.channelInterpretation) | 33 "After rendering node.channelInterpretation") |
| 34 .beEqualTo("discrete"); | 34 .beEqualTo("discrete"); |
| 35 }).then(taskDone); | 35 }).then(() => task.done()); |
| 36 }); | 36 }); |
| 37 | 37 |
| 38 audit.defineTask("mode", function (taskDone) { | 38 audit.define("mode", (task, should) => { |
| 39 var context = new OfflineAudioContext(1, renderFrames, sampleRate); | 39 var context = new OfflineAudioContext(1, renderFrames, sampleRate); |
| 40 var node = context.createGain(); | 40 var node = context.createGain(); |
| 41 | 41 |
| 42 // Set a new mode and verify that it changed. | 42 // Set a new mode and verify that it changed. |
| 43 node.channelCountMode = "explicit"; | 43 node.channelCountMode = "explicit"; |
| 44 var value = node.channelCountMode; | 44 var value = node.channelCountMode; |
| 45 Should("node.channelCountMode", value).beEqualTo("explicit"); | 45 should(value, "node.channelCountMode").beEqualTo("explicit"); |
| 46 node.connect(context.destination); | 46 node.connect(context.destination); |
| 47 | 47 |
| 48 context.startRendering().then(function (buffer) { | 48 context.startRendering().then(function (buffer) { |
| 49 // After rendering, the value should have been changed. | 49 // After rendering, the value should have been changed. |
| 50 Should("After rendering node.channelCountMode", | 50 should(node.channelCountMode, |
| 51 node.channelCountMode) | 51 "After rendering node.channelCountMode") |
| 52 .beEqualTo("explicit"); | 52 .beEqualTo("explicit"); |
| 53 }).then(taskDone); | 53 }).then(() => task.done()); |
| 54 }); | 54 }); |
| 55 audit.runTasks(); | 55 |
| 56 audit.run(); |
| 56 </script> | 57 </script> |
| 57 </body> | 58 </body> |
| 58 </html> | 59 </html> |
| OLD | NEW |