summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/vibration/silent-ignore.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/vibration/silent-ignore.html
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/vibration/silent-ignore.html')
-rw-r--r--testing/web-platform/tests/vibration/silent-ignore.html37
1 files changed, 37 insertions, 0 deletions
diff --git a/testing/web-platform/tests/vibration/silent-ignore.html b/testing/web-platform/tests/vibration/silent-ignore.html
new file mode 100644
index 0000000000..a04c648bd1
--- /dev/null
+++ b/testing/web-platform/tests/vibration/silent-ignore.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset='utf-8'/>
+ <title>Vibration API: test that calls to vibrate() are silently ignored when the device cannot vibrate</title>
+ <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/>
+ <link rel='help' href='https://w3c.github.io/vibration/#dfn-perform-vibration'/>
+ <meta name='flags' content='dom, no-vibrator'/>
+ <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.'/>
+ </head>
+ <body>
+ <h1>Description</h1>
+ <p>
+ <strong>This test is only useful on devices that do not have vibration capability</strong>.
+ If your device supports vibration, then <strong>skip</strong> this test. An implementation
+ supporting this API but running on a device that cannot vibrate must silently ignore the
+ call (we test that it doesn't throw).
+ </p>
+ <button type="button" id="button">Click here if the device doesn't support vibration</button>
+ <div id='log'></div>
+ <script src='/resources/testharness.js'></script>
+ <script src='/resources/testharnessreport.js'></script>
+ <script src='/resources/testdriver.js'></script>
+ <script src='/resources/testdriver-vendor.js'></script>
+ <script>
+ if (undefined !== navigator.vibrate) {
+ async_test(function (t) {
+ var target = document.getElementById('button');
+ target.addEventListener("click", t.step_func_done(function() {
+ assert_true(navigator.vibrate(1000), "vibrate() returns true when vibration is not supported");
+ }));
+ test_driver.click(target).catch(t.unreached_func("click failed"));
+ }, "Calling vibrate returns true");
+ }
+ </script>
+ </body>
+</html>