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