summaryrefslogtreecommitdiffstats
path: root/toolkit/components/pictureinpicture/tests/browser_disableSwipeGestures.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/pictureinpicture/tests/browser_disableSwipeGestures.js')
-rw-r--r--toolkit/components/pictureinpicture/tests/browser_disableSwipeGestures.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/toolkit/components/pictureinpicture/tests/browser_disableSwipeGestures.js b/toolkit/components/pictureinpicture/tests/browser_disableSwipeGestures.js
new file mode 100644
index 0000000000..b8eddf33f2
--- /dev/null
+++ b/toolkit/components/pictureinpicture/tests/browser_disableSwipeGestures.js
@@ -0,0 +1,47 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js",
+ this
+);
+
+add_task(async () => {
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: TEST_PAGE,
+ },
+ async browser => {
+ let pipWin = await triggerPictureInPicture(browser, "with-controls");
+
+ let receivedSwipeGestureEvents = false;
+ pipWin.addEventListener("MozSwipeGestureMayStart", () => {
+ receivedSwipeGestureEvents = true;
+ });
+
+ const wheelEventPromise = BrowserTestUtils.waitForEvent(pipWin, "wheel");
+
+ // Try swiping left to right.
+ await panLeftToRightBegin(pipWin, 100, 100, 100);
+ await panLeftToRightEnd(pipWin, 100, 100, 100);
+
+ // Wait a wheel event and a couple of frames to give a chance to receive
+ // the MozSwipeGestureMayStart event.
+ await wheelEventPromise;
+ await new Promise(resolve => requestAnimationFrame(resolve));
+ await new Promise(resolve => requestAnimationFrame(resolve));
+
+ Assert.ok(
+ !receivedSwipeGestureEvents,
+ "No swipe gesture events observed"
+ );
+
+ let pipClosed = BrowserTestUtils.domWindowClosed(pipWin);
+ pipWin.close();
+ await pipClosed;
+ }
+ );
+});