summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/orientation-event/motion/page-visibility-manual.https.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/orientation-event/motion/page-visibility-manual.https.html')
-rw-r--r--testing/web-platform/tests/orientation-event/motion/page-visibility-manual.https.html28
1 files changed, 28 insertions, 0 deletions
diff --git a/testing/web-platform/tests/orientation-event/motion/page-visibility-manual.https.html b/testing/web-platform/tests/orientation-event/motion/page-visibility-manual.https.html
new file mode 100644
index 0000000000..37e48ce979
--- /dev/null
+++ b/testing/web-platform/tests/orientation-event/motion/page-visibility-manual.https.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<meta name="timeout" content="long">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+'use strict';
+
+promise_test(t => {
+ return new Promise((resolve, reject) => {
+ document.addEventListener("visibilitychange", () => {
+ assert_true(document.hidden, "document is hidden");
+ window.addEventListener(
+ 'devicemotion',
+ event => {
+ if (document.hidden) {
+ reject();
+ } else {
+ resolve();
+ }
+ },
+ { once: true });
+ }, { once: true });
+ });
+}, 'Tests to check that devicemotion events are not fired when the page is not visible.');
+</script>
+
+<p>Switch the page to the background, then switch back to it.</p>