Commit 44ff291c authored by Masayuki Nakano's avatar Masayuki Nakano
Browse files

Bug 1691622 - part 6: Merge `synthesizeNativeMouseClick*` with...

Bug 1691622 - part 6: Merge `synthesizeNativeMouseClick*` with `synthesizeNativeMouseEvent*` r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D105760
parent 293d2541
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -36,7 +36,8 @@ add_task(async function test_PanelMultiView_toggle_with_other_popup() {
      // 3. Click the button to which the main menu is anchored. We need a native
      // mouse event to simulate the exact platform behavior with popups.
      let clickFn = () =>
        EventUtils.promiseNativeMouseClickAndWaitForEvent({
        EventUtils.promiseNativeMouseEventAndWaitForEvent({
          type: "click",
          target: document.getElementById("PanelUI-button"),
          atCenter: true,
          eventTypeToWait: "mouseup",
+6 −3
Original line number Diff line number Diff line
@@ -135,7 +135,8 @@ add_task(async function open_empty() {
  promise = promiseEvent(searchPopup, "popuphidden");

  info("Hiding popup");
  await EventUtils.promiseNativeMouseClickAndWaitForEvent({
  await EventUtils.promiseNativeMouseEventAndWaitForEvent({
    type: "click",
    target: searchIcon,
    atCenter: true,
    eventTypeToWait: "mouseup",
@@ -229,7 +230,8 @@ add_task(async function open_empty_hiddenOneOffs() {
  promise = promiseEvent(searchPopup, "popuphidden");

  info("Hiding popup");
  await EventUtils.promiseNativeMouseClickAndWaitForEvent({
  await EventUtils.promiseNativeMouseEventAndWaitForEvent({
    type: "click",
    target: searchIcon,
    atCenter: true,
    eventTypeToWait: "mouseup",
@@ -572,7 +574,8 @@ add_task(async function dont_consume_clicks() {
  is(textbox.selectionEnd, 3, "Should have selected all of the text");

  promise = promiseEvent(searchPopup, "popuphidden");
  await EventUtils.promiseNativeMouseClickAndWaitForEvent({
  await EventUtils.promiseNativeMouseEventAndWaitForEvent({
    type: "click",
    target: gURLBar.inputField,
    atCenter: true,
    eventTypeToWait: "mouseup",
+5 −1
Original line number Diff line number Diff line
@@ -23,7 +23,11 @@ add_task(async function() {
      // Must have at least one test.
      Assert.ok(!!elt, "Found a valid element: " + (elt.id || elt.localName));
      await UrlbarTestUtils.promisePopupClose(window, () =>
        EventUtils.synthesizeNativeMouseClick({ target: elt, atCenter: true })
        EventUtils.synthesizeNativeMouseEvent({
          type: "click",
          target: elt,
          atCenter: true,
        })
      );
    }
  });
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ function runTests() {
      synthesizeNativeMouseMove(target0, 10, 10, () => {
        synthesizeNativeMouseMove(target0, 15, 15, () => {
          synthesizeNativeMouseMove(target0, 20, 20, () => {
            synthesizeNativeMouseClick({ target: target0, offsetX: 20, offsetY: 20 });
            synthesizeNativeMouseEvent({ type: "click", target: target0, offsetX: 20, offsetY: 20 });
          });
        });
      });
+5 −3
Original line number Diff line number Diff line
@@ -59,10 +59,11 @@ add_task(async () => {
  });

  // NOTE: synthesizeMouseAtCenter doesn't work for OOP iframes (bug 1528935),
  // so we use promiseNativeMouseClick instead.
  // so we use promiseNativeMouseEvent instead.
  const [expectedScreenXInSameOrigin, expectedScreenYInSameOrigin] =
    getScreenPosition(iframes[0], 10, 10);
  await promiseNativeMouseClick({
  await promiseNativeMouseEvent({
    type: "click",
    target: iframes[0],
    screenX: expectedScreenXInSameOrigin,
    screenY: expectedScreenYInSameOrigin,
@@ -76,7 +77,8 @@ add_task(async () => {

  const [expectedScreenXInCrossOrigin, expectedScreenYInCrossOrigin] =
    getScreenPosition(iframes[1], 10, 10);
  await promiseNativeMouseClick({
  await promiseNativeMouseEvent({
    type: "click",
    target: iframes[0],
    screenX: expectedScreenXInCrossOrigin,
    screenY: expectedScreenYInCrossOrigin,
Loading