blob: ad6916fa6878c1c698e2a79727d4187985bd5664 [file] [log] [blame]
Andrew Top61a84952019-04-30 15:07:33 -07001<!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='http://www.w3.org/TR/vibration/#methods'/>
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 <link rel='stylesheet' href='/resources/testharness.css' media='all'/>
11 </head>
12 <body>
13 <h1>Description</h1>
14 <p>
15 <strong>This test is only useful on devices that do not have vibration capability</strong>.
16 If your device supports vibration, then <strong>skip</strong> this test. An implementation
17 supporting this API but running on a device that cannot vibrate must silently ignore the
18 call (we test that it doesn't throw).
19 </p>
20 <div id='log'></div>
21 <script src='/resources/testharness.js'></script>
22 <script src='/resources/testharnessreport.js'></script>
23 <script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script>
24 <script>
25 if (undefined !== navigator.vibrate) {
26 test(function () {
27 assert_true(navigator.vibrate(1000), "vibrate() returns true when vibration is not supported");
28 }, "Calling vibrate returns true");
29 }
30 </script>
31 </body>
32</html>