summaryrefslogtreecommitdiffstats
path: root/toolkit/components/pictureinpicture/tests/browser_keyboardToggle.js
blob: a70100de85b148a6d9fc368e7c684331e7fb04be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

/**
 * Tests to ensure that tabbing to the pip button and pressing space works
 * to open the picture-in-picture window.
 */
add_task(async () => {
  let videoID = "with-controls";

  await BrowserTestUtils.withNewTab(
    {
      url: TEST_PAGE,
      gBrowser,
    },
    async browser => {
      await ensureVideosReady(browser);

      // Open the video in PiP
      let pipWin = await triggerPictureInPicture(browser, videoID, () => {
        EventUtils.synthesizeKey("KEY_Tab", {}); // play button
        EventUtils.synthesizeKey("KEY_Tab", {}); // pip button
        EventUtils.synthesizeKey(" ", {});
      });
      ok(pipWin, "Got Picture-in-Picture window.");

      await BrowserTestUtils.closeWindow(pipWin);
    }
  );
});