tor-browser

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

silent-ignore.html (1853B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <meta charset='utf-8'/>
      5    <title>Vibration API: test that calls to vibrate() are silently ignored when the device cannot vibrate</title>
      6    <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/>
      7    <link rel='help' href='https://w3c.github.io/vibration/#dfn-perform-vibration'/>
      8    <meta name='flags' content='dom, no-vibrator'/>
      9    <meta name='assert' content='If the device does not provide a vibration mechanism, or it is disabled, the user agent must silently ignore any invocations of the vibrate() method.'/>
     10  </head>
     11  <body>
     12    <h1>Description</h1>
     13    <p>
     14      <strong>This test is only useful on devices that do not have vibration capability</strong>.
     15      If your device supports vibration, then <strong>skip</strong> this test. An implementation
     16      supporting this API but running on a device that cannot vibrate must silently ignore the
     17      call (we test that it doesn't throw).
     18    </p>
     19    <button type="button" id="button">Click here if the device doesn't support vibration</button>
     20    <div id='log'></div>
     21    <script src='/resources/testharness.js'></script>
     22    <script src='/resources/testharnessreport.js'></script>
     23    <script src='/resources/testdriver.js'></script>
     24    <script src='/resources/testdriver-vendor.js'></script>
     25    <script>
     26      if (undefined !== navigator.vibrate) {
     27          async_test(function (t) {
     28              var target = document.getElementById('button');
     29              target.addEventListener("click", t.step_func_done(function() {
     30                  assert_true(navigator.vibrate(1000), "vibrate() returns true when vibration is not supported");
     31              }));
     32              test_driver.click(target).catch(t.unreached_func("click failed"));
     33          }, "Calling vibrate returns true");
     34      }
     35    </script>
     36  </body>
     37 </html>