tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

channel-mode-interp-basic.html (2324B)


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