Bug 1438157 - part 2: Remove unnecessary second argument of EventUtils.synthesizeKey() r=smaug

Note that this patch also replaces legacy VK_* with KEY_*, and replaces
synthesizeKey() for inputting some characters with sendString() because
it's better and clearer what it does and it sets shiftKey state properly.

MozReview-Commit-ID: De4enbjux3T

--HG--
extra : rebase_source : 2296b84bff8e22f01eeb48cd8614fac5db11136a
This commit is contained in:
Masayuki Nakano 2018-02-15 04:15:39 +09:00
Родитель a10092f7a0
Коммит cf83ee7bb4
489 изменённых файлов: 2931 добавлений и 3227 удалений

Просмотреть файл

@ -15,7 +15,7 @@ add_task(async function testAutocompleteRichResult() {
urlbar.focus();
let urlbarPopup = document.getElementById("PopupAutoCompleteRichResult");
let shown = BrowserTestUtils.waitForEvent(urlbarPopup, "popupshown");
EventUtils.synthesizeKey("a", {});
EventUtils.sendString("a");
await shown;
info("Waiting for accessibility to be created for the richlistbox");

Просмотреть файл

@ -1405,7 +1405,7 @@ function closeCombobox(aComboboxID) {
];
this.invoke = function closeCombobox_invoke() {
synthesizeKey("VK_ESCAPE", { });
synthesizeKey("KEY_Escape");
};
this.getID = function closeCombobox_getID() {
@ -1459,12 +1459,12 @@ function moveToPrevLineEnd(aID, aCaretOffset) {
this.__proto__ = new synthAction(aID, new caretMoveChecker(aCaretOffset, aID));
this.invoke = function moveToPrevLineEnd_invoke() {
synthesizeKey("VK_UP", { });
synthesizeKey("KEY_ArrowUp");
if (MAC)
synthesizeKey("VK_RIGHT", { metaKey: true });
synthesizeKey("Key_ArrowRight", {metaKey: true});
else
synthesizeKey("VK_END", { });
synthesizeKey("KEY_End");
};
this.getID = function moveToPrevLineEnd_getID() {

Просмотреть файл

@ -46,7 +46,7 @@
];
this.invoke = function selectMenuItem_invoke() {
synthesizeKey("VK_DOWN", { });
synthesizeKey("KEY_ArrowDown");
};
this.getID = function selectMenuItem_getID() {
@ -61,7 +61,7 @@
];
this.invoke = function closeContextMenu_invoke() {
synthesizeKey("VK_ESCAPE", { });
synthesizeKey("KEY_Escape");
};
this.getID = function closeContextMenu_getID() {

Просмотреть файл

@ -127,8 +127,8 @@
this.invoke = function removeChar_invoke()
{
synthesizeKey("VK_LEFT", { shiftKey: true });
synthesizeKey("VK_DELETE", {});
synthesizeKey("KEY_ArrowLeft", {shiftKey: true});
synthesizeKey("KEY_Delete");
}
this.getID = function removeChar_getID()
@ -144,7 +144,7 @@
this.invoke = function replaceOnChar_invoke()
{
this.DOMNode.select();
synthesizeKey(aChar, {});
sendString(aChar);
}
this.getID = function replaceOnChar_getID()

Просмотреть файл

@ -32,7 +32,7 @@
this.DOMNode.focus();
this.DOMNode.setSelectionRange(aStart, aEnd);
synthesizeKey("VK_DELETE", {});
synthesizeKey("KEY_Delete");
};
this.getID = function removeTextFromInput_getID() {
@ -60,7 +60,7 @@
range.setEnd(this.textNode, aEnd);
selection.addRange(range);
synthesizeKey("VK_DELETE", {});
synthesizeKey("KEY_Delete");
};
this.getID = function removeTextFromContentEditable_getID() {

Просмотреть файл

@ -27,7 +27,7 @@
this.invoke = function openFileMenu_invoke()
{
synthesizeKey("F", { altKey: true, shiftKey: true });
synthesizeKey("F", {altKey: true, shiftKey: true});
}
this.getID = function openFileMenu_getID()
@ -46,7 +46,7 @@
this.invoke = function openEditMenu_invoke()
{
synthesizeKey("VK_RIGHT", { });
synthesizeKey("KEY_ArrowRight");
}
this.getID = function openEditMenu_getID()
@ -65,7 +65,7 @@
this.invoke = function closeEditMenu_invoke()
{
synthesizeKey("VK_ESCAPE", { });
synthesizeKey("KEY_Escape");
}
this.getID = function closeEditMenu_getID()
@ -83,7 +83,7 @@
this.invoke = function focusFileMenu_invoke()
{
synthesizeKey("VK_ALT", { });
synthesizeKey("KEY_Alt");
}
this.getID = function focusFileMenu_getID()
@ -100,7 +100,7 @@
this.invoke = function focusEditMenu_invoke()
{
synthesizeKey("VK_RIGHT", { });
synthesizeKey("KEY_ArrowRight");
}
this.getID = function focusEditMenu_getID()
@ -118,7 +118,7 @@
this.invoke = function leaveMenubar_invoke()
{
synthesizeKey("VK_ESCAPE", { });
synthesizeKey("KEY_Escape");
}
this.getID = function leaveMenubar_getID()

Просмотреть файл

@ -169,7 +169,7 @@
this.DOMNode.focus();
this.DOMNode.setSelectionRange(aStart, aEnd);
synthesizeKey("VK_DELETE", {});
synthesizeKey("KEY_Delete");
};
this.getID = function removeTextFromInput_getID() {
@ -189,7 +189,7 @@
this.invoke = function insertTextIntoInput_invoke() {
this.DOMNode.focus();
synthesizeKey("a", {});
sendString("a");
};
this.getID = function insertTextIntoInput_getID() {
@ -212,7 +212,7 @@
range.setEnd(this.textNode, aEnd);
selection.addRange(range);
synthesizeKey("VK_DELETE", {});
synthesizeKey("KEY_Delete");
};
this.getID = function removeTextFromEditable_getID() {

Просмотреть файл

@ -107,7 +107,7 @@
var mininp = document.getElementById("minlength");
mininp.focus();
mininp.setSelectionRange(mininp.value.length, mininp.value.length);
synthesizeKey("VK_BACK_SPACE", {});
synthesizeKey("KEY_Backspace");
ok(!mininp.validity.valid,
"input should be invalid after interactive edits");
testStates(mininp, STATE_INVALID);

Просмотреть файл

@ -52,7 +52,7 @@
this.invoke = function selectMenuItem_invoke()
{
synthesizeKey("VK_DOWN", { });
synthesizeKey("KEY_ArrowDown");
}
this.getID = function selectMenuItem_getID()
@ -69,7 +69,7 @@
this.invoke = function openSubMenu_invoke()
{
synthesizeKey("VK_RETURN", { });
synthesizeKey("KEY_Enter");
}
this.finalCheck = function openSubMenu_finalCheck(aEvent)
@ -91,7 +91,7 @@
this.invoke = function closeSubMenu_invoke()
{
synthesizeKey("VK_ESCAPE", { });
synthesizeKey("KEY_Escape");
}
this.getID = function closeSubMenu_getID()
@ -108,7 +108,7 @@
this.invoke = function closeMenu_invoke()
{
synthesizeKey("VK_ESCAPE", { });
synthesizeKey("KEY_Escape");
}
this.getID = function closeMenu_getID()

Просмотреть файл

@ -55,7 +55,7 @@
] };
testAccessibleTree(this.button, tree);
synthesizeKey("VK_ESCAPE", { });
synthesizeKey("KEY_Escape");
}
this.getID = function openMenu_getID()

Просмотреть файл

@ -144,15 +144,15 @@ async function doSelectTests(contentType, content) {
is(selectPopup.childNodes[1].localName, "menuitem", "option is menuitem");
is(selectPopup.childNodes[1].getAttribute("label"), "One", "option label");
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(menulist.menuBoxObject.activeChild, menulist.getItemAtIndex(2), "Select item 2");
is(menulist.selectedIndex, isWindows ? 2 : 1, "Select item 2 selectedIndex");
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(menulist.menuBoxObject.activeChild, menulist.getItemAtIndex(3), "Select item 3");
is(menulist.selectedIndex, isWindows ? 3 : 1, "Select item 3 selectedIndex");
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
// On Windows, one can navigate on disabled menuitems
is(menulist.menuBoxObject.activeChild, menulist.getItemAtIndex(9),
@ -163,7 +163,7 @@ async function doSelectTests(contentType, content) {
is(menulist.getItemAtIndex(i).disabled, i >= 4 && i <= 7, "item " + i + " disabled");
}
EventUtils.synthesizeKey("KEY_ArrowUp", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(menulist.menuBoxObject.activeChild, menulist.getItemAtIndex(3), "Select item 3 again");
is(menulist.selectedIndex, isWindows ? 3 : 1, "Select item 3 selectedIndex");
@ -182,7 +182,7 @@ async function doSelectTests(contentType, content) {
ok(false, "Should not get keypress event");
};
window.addEventListener("keypress", handleKeyPress);
EventUtils.synthesizeKey("VK_BACK_SPACE", { });
EventUtils.synthesizeKey("KEY_Backspace");
window.removeEventListener("keypress", handleKeyPress);
await hideSelectPopup(selectPopup);
@ -198,20 +198,20 @@ async function doSelectTests(contentType, content) {
is((await getInputEvents()), 1, "Open and close with no change - number of input events");
is((await getChangeEvents()), 1, "Open and close with no change - number of change events");
is((await getClickEvents()), 1, "Open and close with no change - number of click events");
EventUtils.synthesizeKey("VK_TAB", { });
EventUtils.synthesizeKey("VK_TAB", { shiftKey: true });
EventUtils.synthesizeKey("KEY_Tab");
EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
is((await getInputEvents()), 1, "Tab away from select with no change - number of input events");
is((await getChangeEvents()), 1, "Tab away from select with no change - number of change events");
is((await getClickEvents()), 1, "Tab away from select with no change - number of click events");
await openSelectPopup(selectPopup, "click");
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
await hideSelectPopup(selectPopup, "escape");
is((await getInputEvents()), isWindows ? 2 : 1, "Open and close with change - number of input events");
is((await getChangeEvents()), isWindows ? 2 : 1, "Open and close with change - number of change events");
is((await getClickEvents()), 2, "Open and close with change - number of click events");
EventUtils.synthesizeKey("VK_TAB", { });
EventUtils.synthesizeKey("VK_TAB", { shiftKey: true });
EventUtils.synthesizeKey("KEY_Tab");
EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
is((await getInputEvents()), isWindows ? 2 : 1, "Tab away from select with change - number of input events");
is((await getChangeEvents()), isWindows ? 2 : 1, "Tab away from select with change - number of change events");
is((await getClickEvents()), 2, "Tab away from select with change - number of click events");
@ -435,7 +435,7 @@ add_task(async function test_event_order() {
});
});
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
await hideSelectPopup(selectPopup, mode);
await eventsPromise;
}
@ -637,22 +637,22 @@ async function performSelectSearchTests(win) {
is(selectPopup.childNodes[4].hidden, true, "Third option should be hidden");
is(selectPopup.childNodes[1].hidden, true, "First group header should be hidden");
EventUtils.synthesizeKey("VK_BACK_SPACE", {}, win);
EventUtils.synthesizeKey("KEY_Backspace", {}, win);
is(selectPopup.childNodes[4].hidden, false, "Third option should be visible");
EventUtils.synthesizeKey("VK_BACK_SPACE", {}, win);
EventUtils.synthesizeKey("KEY_Backspace", {}, win);
is(selectPopup.childNodes[5].hidden, false, "Second group header should be visible");
EventUtils.synthesizeKey("VK_BACK_SPACE", {}, win);
EventUtils.synthesizeKey("KEY_Backspace", {}, win);
EventUtils.synthesizeKey("O", {}, win);
EventUtils.synthesizeKey("5", {}, win);
is(selectPopup.childNodes[5].hidden, false, "Second group header should be visible");
is(selectPopup.childNodes[1].hidden, true, "First group header should be hidden");
EventUtils.synthesizeKey("VK_BACK_SPACE", {}, win);
EventUtils.synthesizeKey("KEY_Backspace", {}, win);
is(selectPopup.childNodes[1].hidden, false, "First group header should be shown");
EventUtils.synthesizeKey("VK_BACK_SPACE", {}, win);
EventUtils.synthesizeKey("KEY_Backspace", {}, win);
is(selectPopup.childNodes[8].hidden, true, "Option hidden by content should remain hidden");
await hideSelectPopup(selectPopup, "escape", win);

Просмотреть файл

@ -203,7 +203,7 @@ function testOptionColors(index, item, menulist) {
// Press Down to move the selected item to the next item in the
// list and check the colors of this item when it's not selected.
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
if (expected.end) {
return;

Просмотреть файл

@ -2,15 +2,15 @@
function invokeUsingCtrlD(phase) {
switch (phase) {
case 1:
EventUtils.synthesizeKey("d", { accelKey: true });
EventUtils.synthesizeKey("d", {accelKey: true});
break;
case 2:
case 4:
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
break;
case 3:
EventUtils.synthesizeKey("d", { accelKey: true });
EventUtils.synthesizeKey("d", { accelKey: true });
EventUtils.synthesizeKey("d", {accelKey: true});
EventUtils.synthesizeKey("d", {accelKey: true});
break;
}
}
@ -22,7 +22,7 @@ function invokeUsingStarButton(phase) {
break;
case 2:
case 4:
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
break;
case 3:
EventUtils.synthesizeMouseAtCenter(BookmarkingUI.star,

Просмотреть файл

@ -694,7 +694,7 @@ async function test_urlBar() {
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
gURLBar.value = TESTROOT + "amosigned.xpi";
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
await progressPromise;
let installDialog = await dialogPromise;

Просмотреть файл

@ -49,5 +49,5 @@
gBrowser.tabContainer.addEventListener("TabSelect", onTabSelect);
// Press enter!
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
});

Просмотреть файл

@ -128,14 +128,14 @@ var gTests = [
desc: "escape key",
affectsFullscreenMode: false,
exitFunc: () => {
executeSoon(() => EventUtils.synthesizeKey("VK_ESCAPE", {}));
executeSoon(() => EventUtils.synthesizeKey("KEY_Escape"));
}
},
{
desc: "F11 key",
affectsFullscreenMode: true,
exitFunc() {
executeSoon(() => EventUtils.synthesizeKey("VK_F11", {}));
executeSoon(() => EventUtils.synthesizeKey("KEY_F11"));
}
}
];

Просмотреть файл

@ -15,7 +15,7 @@ add_task(async function() {
gBrowser.selectedBrowser.focus();
}, {capture: true, once: true});
EventUtils.synthesizeKey("v", { });
EventUtils.sendString("v");
is(keyUps, 1, "Key up fired at url bar");

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function test_keyword_bookmarklet() {
// Enter bookmarklet keyword in the URL bar
gURLBar.value = "bm";
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
await BrowserTestUtils.waitForContentEvent(gBrowser.selectedBrowser, "pageshow");

Просмотреть файл

@ -119,5 +119,5 @@ function doTest() {
// Simulate a user entering search terms
gURLBar.value = gCurrTest.testText;
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
}

Просмотреть файл

@ -78,7 +78,7 @@ function doTest() {
// Simulate a user entering search terms
gURLBar.value = gCurrTest.testText;
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
}

Просмотреть файл

@ -21,7 +21,7 @@ function tidyUp() {
}
function testClosePrintPreviewWithAccessKey() {
EventUtils.synthesizeKey("c", { altKey: true });
EventUtils.synthesizeKey("c", {altKey: true});
checkPrintPreviewClosed(function(aSucceeded) {
ok(aSucceeded,
"print preview mode should be finished by access key");
@ -30,7 +30,7 @@ function testClosePrintPreviewWithAccessKey() {
}
function testClosePrintPreviewWithEscKey() {
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
checkPrintPreviewClosed(function(aSucceeded) {
ok(aSucceeded,
"print preview mode should be finished by Esc key press");
@ -39,7 +39,7 @@ function testClosePrintPreviewWithEscKey() {
}
function testClosePrintPreviewWithClosingWindowShortcutKey() {
EventUtils.synthesizeKey("w", { accelKey: true });
EventUtils.synthesizeKey("w", {accelKey: true});
checkPrintPreviewClosed(function(aSucceeded) {
ok(aSucceeded,
"print preview mode should be finished by closing window shortcut key");

Просмотреть файл

@ -344,16 +344,16 @@ add_task(async function() {
_lastfocus = "urlbar";
_lastfocuswindow = "main-window";
await expectFocusShift(() => EventUtils.synthesizeKey("VK_F6", { }),
await expectFocusShift(() => EventUtils.synthesizeKey("KEY_F6"),
"window1", "html1",
true, "switch document forward with f6");
EventUtils.synthesizeKey("VK_F6", { });
EventUtils.synthesizeKey("KEY_F6");
is(fm.focusedWindow, window, "switch document forward again with f6");
browser1.style.MozUserFocus = "ignore";
browser1.clientWidth;
EventUtils.synthesizeKey("VK_F6", { });
EventUtils.synthesizeKey("KEY_F6");
is(fm.focusedWindow, window, "switch document forward again with f6 when browser non-focusable");
browser1.style.MozUserFocus = "normal";

Просмотреть файл

@ -11,7 +11,7 @@ add_task(async function() {
let remote = gBrowser.selectedBrowser.isRemoteBrowser;
let findBarOpenPromise = promiseWaitForEvent(gBrowser, "findbaropen");
EventUtils.synthesizeKey("f", { accelKey: true });
EventUtils.synthesizeKey("f", {accelKey: true});
await findBarOpenPromise;
ok(gFindBarInitialized, "find bar is now initialized");
@ -20,9 +20,7 @@ add_task(async function() {
let scrollPromise = remote ?
BrowserTestUtils.waitForContentEvent(gBrowser.selectedBrowser, "scroll") :
BrowserTestUtils.waitForEvent(gBrowser, "scroll");
EventUtils.synthesizeKey("d", {});
EventUtils.synthesizeKey("i", {});
EventUtils.synthesizeKey("v", {});
EventUtils.sendString("div");
await scrollPromise;
// Wait for one paint to ensure we've processed the previous key events and scrolling.
@ -40,7 +38,7 @@ add_task(async function() {
scrollPromise = remote ?
BrowserTestUtils.waitForContentEvent(gBrowser.selectedBrowser, "scroll") :
BrowserTestUtils.waitForEvent(gBrowser, "scroll");
EventUtils.synthesizeKey("g", { accelKey: true });
EventUtils.synthesizeKey("g", {accelKey: true});
await scrollPromise;
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
@ -49,8 +47,8 @@ add_task(async function() {
});
// clear the find bar
EventUtils.synthesizeKey("a", { accelKey: true });
EventUtils.synthesizeKey("VK_DELETE", { });
EventUtils.synthesizeKey("a", {accelKey: true});
EventUtils.synthesizeKey("KEY_Delete");
gFindBar.close();
gBrowser.removeCurrentTab();

Просмотреть файл

@ -41,7 +41,7 @@ function nextTest() {
} else {
// Make sure the find bar is re-enabled after disabled page is closed.
testFindEnabled("about:blank", function() {
EventUtils.synthesizeKey("VK_ESCAPE", { });
EventUtils.synthesizeKey("KEY_Escape");
ok(gFindBar.hidden, "Find bar should now be hidden");
finish();
});
@ -53,7 +53,7 @@ function testFindDisabled(url, cb) {
ok(gFindBar.hidden, "Find bar should not be visible");
EventUtils.synthesizeKey("/", {}, gTab.linkedBrowser.contentWindow);
ok(gFindBar.hidden, "Find bar should not be visible");
EventUtils.synthesizeKey("f", { accelKey: true });
EventUtils.synthesizeKey("f", {accelKey: true});
ok(gFindBar.hidden, "Find bar should not be visible");
ok(document.getElementById("cmd_find").getAttribute("disabled"),
"Find command should be disabled");
@ -71,7 +71,7 @@ function testFindEnabled(url, cb) {
// Open Find bar and then close it.
EventUtils.synthesizeKey("f", { accelKey: true });
ok(!gFindBar.hidden, "Find bar should be visible again");
EventUtils.synthesizeKey("VK_ESCAPE", { });
EventUtils.synthesizeKey("KEY_Escape");
ok(gFindBar.hidden, "Find bar should now be hidden");
gBrowser.removeTab(gTab);

Просмотреть файл

@ -33,7 +33,7 @@ var messageHandlers = {
key(arg) {
let keyName = typeof(arg) == "string" ? arg : arg.key;
content.synthesizeKey(keyName, arg.modifiers || {});
content.synthesizeKey(keyName, arg.modifiers);
let wait = arg.waitForSuggestions ? waitForSuggestions : cb => cb();
wait(ack.bind(null, "key"));
},
@ -143,9 +143,9 @@ var messageHandlers = {
// no text entered, this won't have any effect, so also escape to ensure the
// suggestions table is closed.
gController.input.focus();
content.synthesizeKey("a", { accelKey: true });
content.synthesizeKey("VK_DELETE", {});
content.synthesizeKey("VK_ESCAPE", {});
content.synthesizeKey("a", {accelKey: true});
content.synthesizeKey("KEY_Delete");
content.synthesizeKey("KEY_Escape");
ack("reset");
},
};

Просмотреть файл

@ -50,7 +50,7 @@ add_task(async function() {
function countFocus(aExpectedCount) {
let focusCount = 0;
do {
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
if (document.activeElement == gBrowser.selectedBrowser) {
focusCount++;
}

Просмотреть файл

@ -156,7 +156,7 @@ add_task(async function() {
let suggestionsPromise = promiseSearchEvents(["Suggestions"]);
EventUtils.synthesizeKey("x", {});
EventUtils.sendString("x");
// Wait for the search suggestions to become visible and for the Suggestions
// message.
@ -164,8 +164,8 @@ add_task(async function() {
await suggestionsPromise;
// Empty the search input, causing the suggestions to be hidden.
EventUtils.synthesizeKey("a", { accelKey: true });
EventUtils.synthesizeKey("VK_DELETE", {});
EventUtils.synthesizeKey("a", {accelKey: true});
EventUtils.synthesizeKey("KEY_Delete");
await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
Assert.ok(content.document.getElementById("searchSuggestionTable").hidden,

Просмотреть файл

@ -17,9 +17,7 @@ add_task(async function test_reserved_shortcuts() {
const pageUrl = "data:text/html,<body onload='document.body.firstChild.focus();'><div onkeydown='event.preventDefault();' tabindex=0>Test</div></body>";
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
EventUtils.synthesizeKey("O", { shiftKey: true });
EventUtils.synthesizeKey("P", { shiftKey: true });
EventUtils.synthesizeKey("Q", { shiftKey: true });
EventUtils.sendString("OPQ");
is(document.getElementById("kt_reserved").getAttribute("count"), "1", "reserved='true' with preference off");
is(document.getElementById("kt_notreserved").getAttribute("count"), "0", "reserved='false' with preference off");
@ -30,9 +28,7 @@ add_task(async function test_reserved_shortcuts() {
SpecialPowers.pushPrefEnv({"set": [["permissions.default.shortcuts", 2]]}, resolve);
});
EventUtils.synthesizeKey("O", { shiftKey: true });
EventUtils.synthesizeKey("P", { shiftKey: true });
EventUtils.synthesizeKey("Q", { shiftKey: true });
EventUtils.sendString("OPQ");
is(document.getElementById("kt_reserved").getAttribute("count"), "2", "reserved='true' with preference on");
is(document.getElementById("kt_notreserved").getAttribute("count"), "0", "reserved='false' with preference on");
@ -56,9 +52,9 @@ if (!navigator.platform.includes("Mac")) {
// Pressing Alt+H should open the Help menu.
let helpPopup = document.getElementById("menu_HelpPopup");
let popupShown = BrowserTestUtils.waitForEvent(helpPopup, "popupshown");
EventUtils.synthesizeKey("VK_ALT", { type: "keydown" });
EventUtils.synthesizeKey("H", { altKey: true });
EventUtils.synthesizeKey("VK_ALT", { type: "keyup" });
EventUtils.synthesizeKey("KEY_Alt", {type: "keydown"});
EventUtils.synthesizeKey("h", {altKey: true});
EventUtils.synthesizeKey("KEY_Alt", {type: "keyup"});
await popupShown;
ok(true, "Help menu opened");
@ -71,13 +67,13 @@ if (!navigator.platform.includes("Mac")) {
// pressing Down will open the file menu.
let menubar = document.getElementById("main-menubar");
let menubarActive = BrowserTestUtils.waitForEvent(menubar, "DOMMenuBarActive");
EventUtils.sendKey("F10");
EventUtils.synthesizeKey("KEY_F10");
await menubarActive;
let filePopup = document.getElementById("menu_FilePopup");
popupShown = BrowserTestUtils.waitForEvent(filePopup, "popupshown");
if (navigator.platform.includes("Win")) {
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
}
await popupShown;

Просмотреть файл

@ -23,7 +23,7 @@ var tests = [
},
onShown(popup) {
checkPopup(popup, this.notifyObj);
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
},
onHidden(popup) {
ok(!this.notifyObj.mainActionClicked, "mainAction was not clicked");
@ -41,7 +41,7 @@ var tests = [
},
onShown(popup) {
checkPopup(popup, this.notifyObj);
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
},
onHidden(popup) {
ok(!this.notifyObj.mainActionClicked, "mainAction was not clicked");
@ -66,7 +66,7 @@ var tests = [
let anchor = document.getElementById(this.notifyObj.anchorID);
anchor.focus();
is(document.activeElement, anchor);
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
is(document.activeElement, popup.childNodes[0].closebutton);
this.notification.remove();
},
@ -108,7 +108,7 @@ var tests = [
anchor.focus();
is(document.activeElement, anchor);
opened = waitForNotificationPanel();
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
popup = await opened;
checkPopup(popup, notifyObj1);
@ -119,7 +119,7 @@ var tests = [
anchor.focus();
is(document.activeElement, anchor);
opened = waitForNotificationPanel();
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
popup = await opened;
checkPopup(popup, notifyObj2);
@ -147,7 +147,7 @@ var tests = [
// can not be focused, next tab focus will be inside the panel.
is(Services.focus.focusedElement, null);
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
is(Services.focus.focusedElement, popup.childNodes[0].closebutton);
dismissNotification(popup);
},

Просмотреть файл

@ -120,7 +120,7 @@ var tests = [
// Typing in the location bar should hide the notification.
let hidden = waitForNotificationPanelHidden();
gURLBar.select();
EventUtils.synthesizeKey("*", {});
EventUtils.sendString("*");
await hidden;
is(document.getElementById("geo-notification-icon").boxObject.width, 0,
@ -130,8 +130,8 @@ var tests = [
// anchored to the identity icon. We clear the URL bar before moving the
// focus so that the awesomebar popup doesn't get in the way.
shown = waitForNotificationPanel();
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Backspace");
EventUtils.synthesizeKey("KEY_Tab");
await shown;
is(PopupNotifications.panel.anchorNode.id, "identity-icon",
@ -139,12 +139,12 @@ var tests = [
// Moving focus to the location bar should hide the notification again.
hidden = waitForNotificationPanelHidden();
EventUtils.synthesizeKey("VK_TAB", { shiftKey: true });
EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
await hidden;
// Reverting the URL should show the notification again.
shown = waitForNotificationPanel();
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await shown;
checkPopup(PopupNotifications.panel, this.notifyObj);
@ -163,8 +163,8 @@ var tests = [
for (let persistent of [false, true]) {
// Start editing the URL, ensuring that the awesomebar popup is hidden.
gURLBar.select();
EventUtils.synthesizeKey("*", {});
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.sendString("*");
EventUtils.synthesizeKey("KEY_Backspace");
// Trying to show a notification should display nothing.
let notShowing = promiseTopicObserved("PopupNotifications-updateNotShowing");
@ -176,7 +176,7 @@ var tests = [
// Reverting the URL should show the notification.
let shown = waitForNotificationPanel();
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await shown;
checkPopup(PopupNotifications.panel, this.notifyObj);
@ -210,7 +210,7 @@ var tests = [
// Start editing the URL.
gURLBar.select();
EventUtils.synthesizeKey("*", {});
EventUtils.sendString("*");
// Switching to the old tab should show the notification again.
shown = waitForNotificationPanel();

Просмотреть файл

@ -123,7 +123,7 @@ function showNotification(notifyObj) {
function dismissNotification(popup) {
info("Dismissing notification " + popup.childNodes[0].id);
executeSoon(() => EventUtils.synthesizeKey("VK_ESCAPE", {}));
executeSoon(() => EventUtils.synthesizeKey("KEY_Escape"));
}
function BasicNotification(testId) {
@ -309,13 +309,13 @@ function triggerSecondaryCommand(popup, index) {
// Press down until the desired command is selected. Decrease index by one
// since the secondary action was handled above.
for (let i = 0; i <= index - 1; i++) {
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
}
// Activate
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
}, {once: true});
// One down event to open the popup
info("Open the popup to trigger secondary command for notification " + notification.id);
EventUtils.synthesizeKey("VK_DOWN", { altKey: !navigator.platform.includes("Mac") });
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: !navigator.platform.includes("Mac")});
}

Просмотреть файл

@ -19,7 +19,7 @@ add_task(async function testIdentityPopupFocusKeyboard() {
gIdentityHandler._identityBox.focus();
await focused;
let shown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
await shown;
is(Services.focus.focusedElement, document.getElementById("identity-popup-security-expander"));
});

Просмотреть файл

@ -27,7 +27,7 @@ add_task(async function() {
"Image attribute should have the search engine's icon");
let tabPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
EventUtils.synthesizeKey("VK_RETURN", { });
EventUtils.synthesizeKey("KEY_Enter");
await tabPromise;
is(gBrowser.selectedBrowser.currentURI.spec, "http://example.com/?q=open+a+search");

Просмотреть файл

@ -56,40 +56,40 @@ add_task(async function() {
is_selected(0);
info("Key Down to select the next item");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is_selected(1);
info("Key Down maxResults-1 times should select the first one-off");
repeat(maxResults - 1, () => EventUtils.synthesizeKey("VK_DOWN", {}));
repeat(maxResults - 1, () => EventUtils.synthesizeKey("KEY_ArrowDown"));
is_selected_one_off(0);
info("Key Down numButtons-1 should select the last one-off");
let numButtons =
gURLBar.popup.oneOffSearchButtons.getSelectableButtons(true).length;
repeat(numButtons - 1, () => EventUtils.synthesizeKey("VK_DOWN", {}));
repeat(numButtons - 1, () => EventUtils.synthesizeKey("KEY_ArrowDown"));
is_selected_one_off(numButtons - 1);
info("Key Down twice more should select the second result");
repeat(2, () => EventUtils.synthesizeKey("VK_DOWN", {}));
repeat(2, () => EventUtils.synthesizeKey("KEY_ArrowDown"));
is_selected(1);
info("Key Down maxResults + numButtons times should wrap around");
repeat(maxResults + numButtons,
() => EventUtils.synthesizeKey("VK_DOWN", {}));
() => EventUtils.synthesizeKey("KEY_ArrowDown"));
is_selected(1);
info("Key Up maxResults + numButtons times should wrap around the other way");
repeat(maxResults + numButtons, () => EventUtils.synthesizeKey("VK_UP", {}));
repeat(maxResults + numButtons, () => EventUtils.synthesizeKey("KEY_ArrowUp"));
is_selected(1);
info("Page Up will go up the list, but not wrap");
EventUtils.synthesizeKey("VK_PAGE_UP", {});
EventUtils.synthesizeKey("KEY_PageUp");
is_selected(0);
info("Page Up again will wrap around to the end of the list");
EventUtils.synthesizeKey("VK_PAGE_UP", {});
EventUtils.synthesizeKey("KEY_PageUp");
is_selected(maxResults - 1);
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promisePopupHidden(gURLBar.popup);
});

Просмотреть файл

@ -10,7 +10,7 @@ add_task(async function() {
is(gURLBar.popup.state, "open", "Popup should be open");
is(gURLBar.popup.richlistbox.selectedIndex, 0, "Should have selected something");
EventUtils.synthesizeKey("VK_RIGHT", {});
EventUtils.synthesizeKey("KEY_ArrowRight");
await promisePopupHidden(gURLBar.popup);
is(gURLBar.selectionStart, 5, "Should have moved the cursor");

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function() {
let initialIndex = list.selectedIndex;
info("Key Down to select the next item.");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
let nextIndex = initialIndex + 1;
let nextValue = gURLBar.controller.getFinalCompleteValueAt(nextIndex);
@ -28,7 +28,7 @@ add_task(async function() {
is(gURLBar.value, nextValue, "The selected URL is completed.");
info("Press backspace");
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.synthesizeKey("KEY_Backspace");
await promiseSearchComplete();
let editedValue = gURLBar.textValue;
@ -38,7 +38,7 @@ add_task(async function() {
let docLoad = waitForDocLoadAndStopIt("http://" + editedValue);
info("Press return to load edited URL.");
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
await Promise.all([
promisePopupHidden(gURLBar.popup),
docLoad,

Просмотреть файл

@ -20,8 +20,8 @@ add_task(async function setup() {
add_task(async function test_keyword() {
await promiseAutocompleteResultPopup("keyword bear");
gURLBar.focus();
EventUtils.synthesizeKey("d", {});
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.sendString("d");
EventUtils.synthesizeKey("KEY_Enter");
info("wait for the page to load");
await BrowserTestUtils.browserLoaded(gBrowser.selectedTab.linkedBrowser,
false, "http://example.com/?q=beard");
@ -37,7 +37,7 @@ add_task(async function test_sametext() {
let event = document.createEvent("Events");
event.initEvent("input", true, true);
gURLBar.dispatchEvent(event);
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
info("wait for the page to load");
await BrowserTestUtils.browserLoaded(gBrowser.selectedTab.linkedBrowser,
@ -49,8 +49,8 @@ add_task(async function test_after_empty_search() {
gURLBar.focus();
// Add www. to avoid a switch-to-tab.
gURLBar.value = "www.e";
EventUtils.synthesizeKey("x", {});
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("x");
EventUtils.synthesizeKey("KEY_Enter");
info("wait for the page to load");
await BrowserTestUtils.browserLoaded(gBrowser.selectedTab.linkedBrowser,
@ -87,8 +87,8 @@ add_task(async function test_disabled_ac() {
gURLBar.focus();
gURLBar.value = "e";
EventUtils.synthesizeKey("x", {});
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.sendString("x");
EventUtils.synthesizeKey("KEY_Enter");
info("wait for the page to load");
await BrowserTestUtils.browserLoaded(gBrowser.selectedTab.linkedBrowser,
@ -115,8 +115,8 @@ add_task(async function test_delay() {
gURLBar.closePopup();
gURLBar.focus();
gURLBar.value = "e";
EventUtils.synthesizeKey("x", {});
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.sendString("x");
EventUtils.synthesizeKey("KEY_Enter");
info("wait for the page to load");
await BrowserTestUtils.browserLoaded(gBrowser.selectedTab.linkedBrowser,
false, "http://example.com/");

Просмотреть файл

@ -31,11 +31,11 @@ add_task(async function test_switchtab_override() {
gURLBar.focus();
gURLBar.value = "dummy_pag";
EventUtils.synthesizeKey("e", {});
EventUtils.sendString("e");
await deferred.promise;
info("Select second autocomplete popup entry");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
ok(/moz-action:switchtab/.test(gURLBar.value), "switch to tab entry found");
info("Override switch-to-tab");
@ -51,10 +51,10 @@ add_task(async function test_switchtab_override() {
// Otherwise it would load the page.
BrowserTestUtils.browserLoaded(secondTab.linkedBrowser).then(deferred.resolve);
EventUtils.synthesizeKey("VK_SHIFT", { type: "keydown" });
EventUtils.synthesizeKey("VK_RETURN", { });
EventUtils.synthesizeKey("KEY_Shift", {type: "keydown"});
EventUtils.synthesizeKey("KEY_Enter");
info(`gURLBar.value = ${gURLBar.value}`);
EventUtils.synthesizeKey("VK_SHIFT", { type: "keyup" });
EventUtils.synthesizeKey("KEY_Shift", {type: "keyup"});
await deferred.promise;
await PlacesUtils.history.clear();

Просмотреть файл

@ -20,18 +20,18 @@ add_task(async function test_switchtab_override_keynav() {
gURLBar.focus();
gURLBar.value = "dummy_pag";
EventUtils.synthesizeKey("e", {});
EventUtils.sendString("e");
await promiseSearchComplete();
info("Select second autocomplete popup entry");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
ok(/moz-action:switchtab/.test(gURLBar.value), "switch to tab entry found");
info("Shift+left on switch-to-tab entry");
EventUtils.synthesizeKey("VK_SHIFT", { type: "keydown" });
EventUtils.synthesizeKey("VK_LEFT", { shiftKey: true });
EventUtils.synthesizeKey("VK_SHIFT", { type: "keyup" });
EventUtils.synthesizeKey("KEY_Shift", {type: "keydown"});
EventUtils.synthesizeKey("KEY_ArrowLeft", {shiftKey: true});
EventUtils.synthesizeKey("KEY_Shift", {type: "keyup"});
ok(!/moz-action:switchtab/.test(gURLBar.inputField.value), "switch to tab should be hidden");
});

Просмотреть файл

@ -34,13 +34,13 @@ add_task(async function() {
// First item should already be selected
is_selected(0);
// Select next one (important!)
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is_selected(1);
// Re-select keyword item
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is_selected(0);
EventUtils.synthesizeKey("b", {});
EventUtils.sendString("b");
await promiseSearchComplete();
is(gURLBar.textValue, "keyword ab", "urlbar should have expected input");
@ -49,7 +49,7 @@ add_task(async function() {
let uri = NetUtil.newURI(result.getAttribute("url"));
is(uri.spec, PlacesUtils.mozActionURI("keyword", {url: "http://example.com/?q=ab", input: "keyword ab"}), "Expect correct url");
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promisePopupHidden(gURLBar.popup);
gBrowser.removeTab(tab);
});

Просмотреть файл

@ -10,7 +10,7 @@ add_task(async function test_switchtab_decodeuri() {
await promiseAutocompleteResultPopup("dummy_page");
info("Select autocomplete popup entry");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
ok(gURLBar.value.startsWith("moz-action:switchtab"), "switch to tab entry found");
info("switch-to-tab");
@ -20,7 +20,7 @@ add_task(async function test_switchtab_decodeuri() {
is(gBrowser.selectedTab, tab, "Should have switched to the right tab");
resolve();
}, {once: true});
EventUtils.synthesizeKey("VK_RETURN", { });
EventUtils.synthesizeKey("KEY_Enter");
});
gBrowser.removeCurrentTab();

Просмотреть файл

@ -8,7 +8,7 @@ add_task(async function test_remotetab_opens() {
// The URL is going to open in the current tab as it is currently about:blank
let promiseTabLoaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
await promiseTabLoaded;
Assert.equal(gBrowser.selectedTab.linkedBrowser.currentURI.spec, url, "correct URL loaded");

Просмотреть файл

@ -51,7 +51,7 @@ add_task(async function() {
if (gURLBar.selectionStart == gURLBar.selectionEnd) {
gURLBar.selectionStart = gURLBar.selectionEnd = gURLBar.textValue.length;
}
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.synthesizeKey("KEY_Backspace");
});
}

Просмотреть файл

@ -32,11 +32,11 @@ add_task(async function() {
gURLBar.selectionStart = gURLBar.selectionEnd =
gURLBar.inputField.value.length;
gURLBar.inputField.value = inputValue.slice(0, -1);
EventUtils.synthesizeKey(inputValue.slice(-1), {});
EventUtils.sendString(inputValue.slice(-1));
} else {
gURLBar.textValue = inputValue;
}
EventUtils.synthesizeKey("VK_RETURN", options);
EventUtils.synthesizeKey("KEY_Enter", options);
await promiseLoad;
}
});

Просмотреть файл

@ -159,9 +159,7 @@ add_task(async function load_in_new_tab_test() {
function triggerCommand(shouldClick, event) {
gURLBar.focus();
gURLBar.value = "";
for (let c of TEST_VALUE) {
EventUtils.synthesizeKey(c, {});
}
EventUtils.sendString(TEST_VALUE);
if (shouldClick) {
ok(gURLBar.hasAttribute("usertyping"),
@ -169,7 +167,7 @@ function triggerCommand(shouldClick, event) {
EventUtils.synthesizeMouseAtCenter(gURLBar.goButton, event);
} else {
EventUtils.synthesizeKey("VK_RETURN", event);
EventUtils.synthesizeKey("KEY_Enter", event);
}
}

Просмотреть файл

@ -13,16 +13,13 @@ add_task(async function() {
function urlEnter(url) {
gURLBar.value = url;
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
}
function urlClick(url) {
gURLBar.focus();
gURLBar.value = "";
for (let c of url) {
EventUtils.synthesizeKey(c, {});
}
EventUtils.sendString(url);
EventUtils.synthesizeMouseAtCenter(gURLBar.goButton, {});
}

Просмотреть файл

@ -27,7 +27,7 @@ add_task(async function setup() {
async function promiseSearch(searchtext) {
gURLBar.focus();
gURLBar.inputField.value = searchtext.substr(0, searchtext.length - 1);
EventUtils.synthesizeKey(searchtext.substr(-1, 1), {});
EventUtils.sendString(searchtext.substr(-1, 1));
await promiseSearchComplete();
}
@ -111,6 +111,6 @@ add_task(async function autofill_complete_domain() {
// Now ensure selecting from the popup correctly trims.
is(gURLBar.controller.matchCount, 2, "Found the expected number of matches");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(gURLBar.inputField.value, "www.autofilltrimurl.com/whatever", "trim was applied correctly");
});

Просмотреть файл

@ -13,14 +13,14 @@ add_task(async function() {
function sendHome() {
// unclear why VK_HOME doesn't work on Mac, but it doesn't...
if (Services.appinfo.OS == "Darwin") {
EventUtils.synthesizeKey("VK_LEFT", { altKey: true });
EventUtils.synthesizeKey("KEY_ArrowLeft", {altKey: true});
} else {
EventUtils.synthesizeKey("VK_HOME", {});
EventUtils.synthesizeKey("KEY_Home");
}
}
function sendDelete() {
EventUtils.synthesizeKey("VK_DELETE", {});
EventUtils.synthesizeKey("KEY_Delete");
}
async function testDelete() {

Просмотреть файл

@ -11,7 +11,7 @@ add_task(async function() {
let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, START_VALUE);
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
// Check url bar and selected tab.
@ -30,7 +30,7 @@ add_task(async function() {
let tabOpenPromise = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen");
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {altKey: true});
EventUtils.synthesizeKey("KEY_Enter", {altKey: true});
// wait for the new tab to appear.
await tabOpenPromise;

Просмотреть файл

@ -7,7 +7,7 @@ function repeat(limit, func) {
async function promiseAutoComplete(inputText) {
gURLBar.focus();
gURLBar.value = inputText.slice(0, -1);
EventUtils.synthesizeKey(inputText.slice(-1), {});
EventUtils.sendString(inputText.slice(-1));
await promiseSearchComplete();
}
@ -45,7 +45,7 @@ add_task(async function() {
let initiallySelected = gURLBar.popup.richlistbox.selectedIndex;
info("Key Down to select the next item");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is_selected(initiallySelected + 1);
let expectedURL = gURLBar.controller.getFinalCompleteValueAt(initiallySelected + 1);
@ -62,7 +62,7 @@ add_task(async function() {
let autocompletePopupHidden = promisePopupHidden(gURLBar.popup);
let openedExpectedPage = waitForDocLoadAndStopIt(expectedURL);
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
await Promise.all([autocompletePopupHidden, openedExpectedPage]);
gBrowser.removeCurrentTab();

Просмотреть файл

@ -34,7 +34,7 @@ add_task(async function init() {
// there's no text in the textbox.
add_task(async function history() {
gURLBar.focus();
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
await promisePopupShown(gURLBar.popup);
await waitForAutocompleteResultAt(gMaxResults - 1);
@ -42,7 +42,7 @@ add_task(async function history() {
// Key down through each result.
for (let i = 0; i < gMaxResults; i++) {
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
assertState(i, -1,
"example.com/browser_urlbarOneOffs.js/?" + (gMaxResults - i - 1));
}
@ -51,50 +51,50 @@ add_task(async function history() {
let numButtons =
gURLBar.popup.oneOffSearchButtons.getSelectableButtons(true).length;
for (let i = 0; i < numButtons; i++) {
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
assertState(-1, i, "");
}
// Key down once more. Nothing should be selected.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
assertState(-1, -1, "");
// Once more. The first result should be selected.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
assertState(0, -1,
"example.com/browser_urlbarOneOffs.js/?" + (gMaxResults - 1));
// Now key up. Nothing should be selected again.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
assertState(-1, -1, "");
// Key up through each one-off.
for (let i = numButtons - 1; i >= 0; i--) {
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
assertState(-1, i, "");
}
// Key right through each one-off.
for (let i = 1; i < numButtons; i++) {
EventUtils.synthesizeKey("VK_RIGHT", {});
EventUtils.synthesizeKey("KEY_ArrowRight");
assertState(-1, i, "");
}
// Key left through each one-off.
for (let i = numButtons - 2; i >= 0; i--) {
EventUtils.synthesizeKey("VK_LEFT", {});
EventUtils.synthesizeKey("KEY_ArrowLeft");
assertState(-1, i, "");
}
// Key up through each result.
for (let i = gMaxResults - 1; i >= 0; i--) {
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
assertState(i, -1,
"example.com/browser_urlbarOneOffs.js/?" + (gMaxResults - i - 1));
}
// Key up once more. Nothing should be selected.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
assertState(-1, -1, "");
await hidePopup();
@ -113,7 +113,7 @@ add_task(async function() {
// Key down through each result. The first result is already selected, which
// is why gMaxResults - 1 is the correct number of times to do this.
for (let i = 0; i < gMaxResults - 1; i++) {
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
// i starts at zero so that the textValue passed to assertState is correct.
// But that means that i + 1 is the expected selected index, since initially
// (when this loop starts) the first result is selected.
@ -125,30 +125,30 @@ add_task(async function() {
let numButtons =
gURLBar.popup.oneOffSearchButtons.getSelectableButtons(true).length;
for (let i = 0; i < numButtons; i++) {
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
assertState(-1, i, typedValue);
}
// Key down once more. The selection should wrap around to the first result.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
assertState(0, -1, typedValue);
// Now key up. The selection should wrap back around to the one-offs. Key
// up through all the one-offs.
for (let i = numButtons - 1; i >= 0; i--) {
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
assertState(-1, i, typedValue);
}
// Key up through each non-heuristic result.
for (let i = gMaxResults - 2; i >= 0; i--) {
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
assertState(i + 1, -1,
"example.com/browser_urlbarOneOffs.js/?" + (gMaxResults - i - 1));
}
// Key up once more. The heuristic result should be selected.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
assertState(0, -1, typedValue);
await hidePopup();
@ -169,7 +169,7 @@ add_task(async function searchWith() {
// Alt+Down to the first one-off. Now the first result and the first one-off
// should both be selected.
EventUtils.synthesizeKey("VK_DOWN", { altKey: true });
EventUtils.synthesizeKey("KEY_ArrowDown", { altKey: true });
assertState(0, 0, typedValue);
let engineName = gURLBar.popup.oneOffSearchButtons.selectedButton.engine.name;
@ -216,13 +216,13 @@ add_task(async function oneOffReturn() {
assertState(0, -1, typedValue);
// Alt+Down to select the first one-off.
EventUtils.synthesizeKey("VK_DOWN", { altKey: true });
EventUtils.synthesizeKey("KEY_ArrowDown", { altKey: true });
assertState(0, 0, typedValue);
let resultsPromise =
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false,
"http://mochi.test:8888/?terms=foo.bar");
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
await resultsPromise;
gBrowser.removeTab(gBrowser.selectedTab);
@ -243,7 +243,7 @@ add_task(async function collapsedOneOffs() {
assertState(0, -1);
Assert.ok(gURLBar.popup.oneOffSearchButtons.buttons.collapsed,
"The one-off buttons should be collapsed");
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
assertState(1, -1);
await hidePopup();
});
@ -259,6 +259,6 @@ function assertState(result, oneOff, textValue = undefined) {
}
async function hidePopup() {
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promisePopupHidden(gURLBar.popup);
}

Просмотреть файл

@ -31,21 +31,21 @@ add_task(async function oneOffReturnAfterSuggestion() {
assertState(0, -1, typedValue);
// Down to select the first search suggestion.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
assertState(1, -1, "foofoo");
// Down to select the next search suggestion.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
assertState(2, -1, "foobar");
// Alt+Down to select the first one-off.
EventUtils.synthesizeKey("VK_DOWN", { altKey: true });
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
assertState(2, 0, "foobar");
let resultsPromise =
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false,
`http://mochi.test:8888/?terms=foobar`);
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
await resultsPromise;
await PlacesUtils.history.clear();
@ -62,11 +62,11 @@ add_task(async function oneOffClickAfterSuggestion() {
assertState(0, -1, typedValue);
// Down to select the first search suggestion.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
assertState(1, -1, "foofoo");
// Down to select the next search suggestion.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
assertState(2, -1, "foobar");
let oneOffs = gURLBar.popup.oneOffSearchButtons.getSelectableButtons(true);
@ -87,11 +87,11 @@ add_task(async function overridden_engine_not_reused() {
await promiseAutocompleteResultPopup(typedValue, window, true);
await promiseSuggestionsPresent();
// Down to select the first search suggestion.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
assertState(1, -1, "foofoo");
// ALT+Down to select the second search engine.
EventUtils.synthesizeKey("VK_DOWN", { altKey: true });
EventUtils.synthesizeKey("VK_DOWN", { altKey: true });
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
assertState(1, 1, "foofoo");
let label = gURLBar.popup.richlistbox.children[gURLBar.popup.richlistbox.selectedIndex].label;
@ -116,6 +116,6 @@ function assertState(result, oneOff, textValue = undefined) {
}
async function hidePopup() {
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promisePopupHidden(gURLBar.popup);
}

Просмотреть файл

@ -28,7 +28,7 @@ function checkURLBarRevert() {
gURLBar.focus();
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
is(gURLBar.value, originalValue, "ESC reverted the location bar value");

Просмотреть файл

@ -56,9 +56,9 @@ async function testPressEnterOnSuggestion(expectedUrl = null, keyModifiers = {})
let promiseLoad = waitForDocLoadAndStopIt(expectedUrl);
for (let i = 0; i < idx; ++i) {
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
}
EventUtils.synthesizeKey("VK_RETURN", keyModifiers);
EventUtils.synthesizeKey("KEY_Enter", keyModifiers);
await promiseLoad;
await BrowserTestUtils.removeTab(tab);
@ -80,13 +80,13 @@ add_task(async function copySuggestionText() {
await promiseAutocompleteResultPopup("foo");
let [idx, suggestion] = await promiseFirstSuggestion();
for (let i = 0; i < idx; ++i) {
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
}
gURLBar.select();
await new Promise((resolve, reject) => waitForClipboard(suggestion, function() {
goDoCommand("cmd_copy");
}, resolve, reject));
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promisePopupHidden(gURLBar.popup);
});

Просмотреть файл

@ -47,9 +47,7 @@ add_task(async function focus() {
Assert.equal(gURLBar.popup.matchCount, 0, "popup should have no results");
// Start searching.
EventUtils.synthesizeKey("r", {});
EventUtils.synthesizeKey("n", {});
EventUtils.synthesizeKey("d", {});
EventUtils.sendString("rnd");
await promiseSearchComplete();
Assert.ok(suggestionsPresent());
assertVisible(true);

Просмотреть файл

@ -11,7 +11,7 @@ async function test_autocomplete(data) {
if (onAutoFill)
onAutoFill();
keys.forEach(key => EventUtils.synthesizeKey(key, {}));
keys.forEach(key => EventUtils.synthesizeKey(key));
is(gURLBar.textValue, modified, "backspaced value is as expected");
@ -46,14 +46,14 @@ add_task(async function() {
typed: "exam",
autofilled: "example.com/",
modified: "exam",
keys: ["VK_DELETE"],
keys: ["KEY_Delete"],
action: "searchengine"
});
await test_autocomplete({ desc: "DELETE the final slash should visit",
typed: "example.com",
autofilled: "example.com/",
modified: "example.com",
keys: ["VK_DELETE"],
keys: ["KEY_Delete"],
action: "visiturl"
});
@ -61,14 +61,14 @@ add_task(async function() {
typed: "exam",
autofilled: "example.com/",
modified: "exam",
keys: ["VK_BACK_SPACE"],
keys: ["KEY_Backspace"],
action: "searchengine"
});
await test_autocomplete({ desc: "BACK_SPACE the final slash should visit",
typed: "example.com",
autofilled: "example.com/",
modified: "example.com",
keys: ["VK_BACK_SPACE"],
keys: ["KEY_Backspace"],
action: "visiturl"
});
@ -76,14 +76,14 @@ add_task(async function() {
typed: "exam",
autofilled: "example.com/",
modified: "exa",
keys: ["VK_DELETE", "VK_BACK_SPACE"],
keys: ["KEY_Delete", "KEY_Backspace"],
action: "searchengine"
});
await test_autocomplete({ desc: "DELETE the final slash, then BACK_SPACE, should search",
typed: "example.com",
autofilled: "example.com/",
modified: "example.co",
keys: ["VK_DELETE", "VK_BACK_SPACE"],
keys: ["KEY_Delete", "KEY_Backspace"],
action: "visiturl"
});
@ -91,14 +91,14 @@ add_task(async function() {
typed: "exam",
autofilled: "example.com/",
modified: "exa",
keys: ["VK_BACK_SPACE", "VK_BACK_SPACE"],
keys: ["KEY_Backspace", "KEY_Backspace"],
action: "searchengine"
});
await test_autocomplete({ desc: "BACK_SPACE the final slash, then BACK_SPACE, should search",
typed: "example.com",
autofilled: "example.com/",
modified: "example.co",
keys: ["VK_BACK_SPACE", "VK_BACK_SPACE"],
keys: ["KEY_Backspace", "KEY_Backspace"],
action: "visiturl"
});
@ -106,7 +106,7 @@ add_task(async function() {
typed: "ex",
autofilled: "example.com/",
modified: "e",
keys: ["VK_BACK_SPACE"],
keys: ["KEY_Backspace"],
action: "searchengine",
onAutoFill: () => {
gURLBar.blur();
@ -119,7 +119,7 @@ add_task(async function() {
typed: "ex",
autofilled: "example.com/",
modified: "e",
keys: ["VK_DELETE"],
keys: ["KEY_Delete"],
action: "searchengine",
onAutoFill: () => {
gURLBar.blur();
@ -132,7 +132,7 @@ add_task(async function() {
typed: "ex",
autofilled: "example.com/",
modified: "e",
keys: ["VK_BACK_SPACE", "VK_BACK_SPACE"],
keys: ["KEY_Backspace", "KEY_Backspace"],
action: "searchengine",
onAutoFill: () => {
gURLBar.blur();

Просмотреть файл

@ -14,7 +14,7 @@ async function test_autocomplete(data) {
let promiseLoad = waitForDocLoadAndStopIt(waitForUrl);
keys.forEach(([key, mods]) => EventUtils.synthesizeKey(key, mods || {}));
keys.forEach(([key, mods]) => EventUtils.synthesizeKey(key, mods));
is(gURLBar.textValue, modified, "value is as expected");
@ -41,7 +41,7 @@ add_task(async function() {
autofilled: "example.com/",
modified: "example.com/",
waitForUrl: "http://example.com/",
keys: [["VK_RETURN", {}]]
keys: [["KEY_Enter"]]
});
await test_autocomplete({ desc: "CTRL+ENTER on the autofilled part should bypass autofill",
@ -49,9 +49,9 @@ add_task(async function() {
autofilled: "example.com/",
modified: "www.exam.com",
waitForUrl: "http://www.exam.com/",
keys: [["VK_RETURN", AppConstants.platform === "macosx" ?
{ metaKey: true } :
{ ctrlKey: true }]]
keys: [["KEY_Enter", AppConstants.platform === "macosx" ?
{metaKey: true} :
{ctrlKey: true}]]
});
await test_autocomplete({ desc: "SHIFT+ENTER on the autofilled part should bypass autofill",
@ -59,6 +59,6 @@ add_task(async function() {
autofilled: "example.com/",
modified: "www.exam.net",
waitForUrl: "http://www.exam.net/",
keys: [["VK_RETURN", { shiftKey: true }]]
keys: [["KEY_Enter", {shiftKey: true}]]
});
});

Просмотреть файл

@ -2,7 +2,7 @@
async function checkURLBarValueStays(browser) {
gURLBar.select();
EventUtils.synthesizeKey("a", {});
EventUtils.sendString("a");
is(gURLBar.value, "a", "URL bar value should match after sending a key");
await new Promise(resolve => {
let listener = {

Просмотреть файл

@ -17,10 +17,10 @@ add_task(async function test_remove_history() {
let result = await waitForAutocompleteResultAt(1);
Assert.equal(result.getAttribute("ac-value"), TEST_URL, "Found the expected result");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
Assert.equal(gURLBar.popup.richlistbox.selectedIndex, 1);
let options = AppConstants.platform == "macosx" ? { shiftKey: true } : {};
EventUtils.synthesizeKey("VK_DELETE", options);
EventUtils.synthesizeKey("KEY_Delete", options);
await promiseVisitRemoved;
await BrowserTestUtils.waitForCondition(
() => !gURLBar.popup.richlistbox.children.some(c => !c.collapsed && c.getAttribute("ac-value") == TEST_URL),

Просмотреть файл

@ -14,7 +14,7 @@ add_task(async function() {
let popupopened = BrowserTestUtils.waitForEvent(gURLBar.popup, "popupshown");
gURLBar.focus();
EventUtils.synthesizeKey("a", {});
EventUtils.sendString("a");
await popupopened;
// Since the current tab is blank the preferences pane will load there

Просмотреть файл

@ -26,7 +26,7 @@ add_task(async function() {
await waitForSearchBarFocus();
let hiddenPanelPromise = promiseOverflowHidden(window);
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await hiddenPanelPromise;
CustomizableUI.reset();
});
@ -43,7 +43,7 @@ add_task(async function() {
await waitForSearchBarFocus();
let hiddenPanelPromise = promiseOverflowHidden(window);
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await hiddenPanelPromise;
CustomizableUI.reset();
});
@ -71,7 +71,7 @@ add_task(async function() {
await waitForSearchBarFocus();
let hiddenPanelPromise = promiseOverflowHidden(window);
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await hiddenPanelPromise;
Services.prefs.setBoolPref("browser.search.widget.inNavBar", false);
@ -98,9 +98,9 @@ add_task(async function() {
function sendWebSearchKeyCommand() {
if (Services.appinfo.OS === "Darwin")
EventUtils.synthesizeKey("k", { accelKey: true });
EventUtils.synthesizeKey("k", {accelKey: true});
else
EventUtils.synthesizeKey("k", { ctrlKey: true });
EventUtils.synthesizeKey("k", {ctrlKey: true});
}
function logActiveElement() {

Просмотреть файл

@ -61,7 +61,7 @@ add_task(async function searchbar_in_panel() {
ok(isOverflowOpen(), "Panel should still be open");
let hiddenPanelPromise = promiseOverflowHidden(window);
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await hiddenPanelPromise;
ok(!isOverflowOpen(), "Panel should no longer be open");

Просмотреть файл

@ -103,7 +103,7 @@ function checkSpecialContextMenus() {
*/
function closePopup(aPopup) {
let hiddenPromise = popupHidden(aPopup);
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
return hiddenPromise;
}

Просмотреть файл

@ -19,7 +19,7 @@ add_task(async function testFullscreen() {
is(doorhanger.id, "appMenu-update-manual-notification", "PanelUI is displaying the update-manual notification.");
let popuphiddenPromise = BrowserTestUtils.waitForEvent(PanelUI.notificationPanel, "popuphidden");
EventUtils.synthesizeKey("VK_F11", {});
EventUtils.synthesizeKey("KEY_F11");
await popuphiddenPromise;
await new Promise(executeSoon);
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is closed.");
@ -28,7 +28,7 @@ add_task(async function testFullscreen() {
is(PanelUI.menuButton.getAttribute("badge-status"), "update-manual", "Badge is displaying on PanelUI button.");
let popupshownPromise = BrowserTestUtils.waitForEvent(PanelUI.notificationPanel, "popupshown");
EventUtils.synthesizeKey("VK_F11", {});
EventUtils.synthesizeKey("KEY_F11");
await popupshownPromise;
await new Promise(executeSoon);
isnot(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is showing.");

Просмотреть файл

@ -50,7 +50,7 @@ add_task(async function testFullscreen() {
is(doorhanger.id, "appMenu-update-manual-notification", "PanelUI is displaying the update-manual notification.");
let fullscreenPromise = waitForFullscreen();
EventUtils.synthesizeKey("VK_F11", {});
EventUtils.synthesizeKey("KEY_F11");
await fullscreenPromise;
isnot(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is still showing after entering fullscreen.");
@ -78,6 +78,6 @@ add_task(async function testFullscreen() {
is(PanelUI.menuButton.hasAttribute("badge-status"), false, "Should not have a badge status");
fullscreenPromise = BrowserTestUtils.waitForEvent(window, "fullscreen");
EventUtils.synthesizeKey("VK_F11", {});
EventUtils.synthesizeKey("KEY_F11");
await fullscreenPromise;
});

Просмотреть файл

@ -17,12 +17,12 @@ add_task(async function testUpDownKeys() {
for (let button of buttons) {
if (button.disabled)
continue;
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
Assert.equal(document.commandDispatcher.focusedElement, button,
"The correct button should be focused after navigating downward");
}
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
Assert.equal(document.commandDispatcher.focusedElement, buttons[0],
"Pressing upwards should cycle around and select the first button again");
@ -30,7 +30,7 @@ add_task(async function testUpDownKeys() {
let button = buttons[i];
if (button.disabled)
continue;
EventUtils.synthesizeKey("KEY_ArrowUp", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
Assert.equal(document.commandDispatcher.focusedElement, button,
"The first button should be focused after navigating upward");
}
@ -48,7 +48,7 @@ add_task(async function testEnterKeyBehaviors() {
let buttons = PanelView.forNode(PanelUI.mainView).getNavigableElements();
// Navigate to the 'Help' button, which points to a subview.
EventUtils.synthesizeKey("KEY_ArrowUp", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
let focusedElement = document.commandDispatcher.focusedElement;
Assert.equal(focusedElement, buttons[buttons.length - 1],
"The last button should be focused after navigating upward");
@ -56,10 +56,10 @@ add_task(async function testEnterKeyBehaviors() {
promise = BrowserTestUtils.waitForEvent(PanelUI.helpView, "ViewShown");
// Make sure the Help button is in focus.
while (!focusedElement || !focusedElement.id || focusedElement.id != kHelpButtonId) {
EventUtils.synthesizeKey("KEY_ArrowUp", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
focusedElement = document.commandDispatcher.focusedElement;
}
EventUtils.synthesizeKey("KEY_Enter", {});
EventUtils.synthesizeKey("KEY_Enter");
await promise;
let helpButtons = PanelView.forNode(PanelUI.helpView).getNavigableElements();
@ -71,33 +71,33 @@ add_task(async function testEnterKeyBehaviors() {
let button = helpButtons[i];
if (button.disabled)
continue;
EventUtils.synthesizeKey("KEY_ArrowUp", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
focusedElement = document.commandDispatcher.focusedElement;
Assert.equal(focusedElement, button, "The first button should be focused after navigating upward");
}
// Make sure the back button is in focus again.
while (focusedElement != helpButtons[0]) {
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
focusedElement = document.commandDispatcher.focusedElement;
}
// The first button is the back button. Hittin Enter should navigate us back.
promise = BrowserTestUtils.waitForEvent(PanelUI.mainView, "ViewShown");
EventUtils.synthesizeKey("KEY_Enter", {});
EventUtils.synthesizeKey("KEY_Enter");
await promise;
// Let's test a 'normal' command button.
focusedElement = document.commandDispatcher.focusedElement;
const kFindButtonId = "appMenu-find-button";
while (!focusedElement || !focusedElement.id || focusedElement.id != kFindButtonId) {
EventUtils.synthesizeKey("KEY_ArrowUp", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
focusedElement = document.commandDispatcher.focusedElement;
}
Assert.equal(focusedElement.id, kFindButtonId, "Find button should be selected");
promise = promisePanelHidden(window);
EventUtils.synthesizeKey("KEY_Enter", {});
EventUtils.synthesizeKey("KEY_Enter");
await promise;
Assert.ok(!gFindBar.hidden, "Findbar should have opened");
@ -112,7 +112,7 @@ add_task(async function testLeftRightKeys() {
// Navigate to the 'Help' button, which points to a subview.
let focusedElement = document.commandDispatcher.focusedElement;
while (!focusedElement || !focusedElement.id || focusedElement.id != kHelpButtonId) {
EventUtils.synthesizeKey("KEY_ArrowUp", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
focusedElement = document.commandDispatcher.focusedElement;
}
Assert.equal(focusedElement.id, kHelpButtonId, "The last button should be focused after navigating upward");
@ -120,12 +120,12 @@ add_task(async function testLeftRightKeys() {
// Hitting ArrowRight on a button that points to a subview should navigate us
// there.
promise = BrowserTestUtils.waitForEvent(PanelUI.helpView, "ViewShown");
EventUtils.synthesizeKey("KEY_ArrowRight", {});
EventUtils.synthesizeKey("KEY_ArrowRight");
await promise;
// Hitting ArrowLeft should navigate us back.
promise = BrowserTestUtils.waitForEvent(PanelUI.mainView, "ViewShown");
EventUtils.synthesizeKey("KEY_ArrowLeft", {});
EventUtils.synthesizeKey("KEY_ArrowLeft");
await promise;
focusedElement = document.commandDispatcher.focusedElement;
@ -147,12 +147,12 @@ add_task(async function testTabKey() {
for (let button of buttons) {
if (button.disabled)
continue;
EventUtils.synthesizeKey("KEY_Tab", {});
EventUtils.synthesizeKey("KEY_Tab");
Assert.equal(document.commandDispatcher.focusedElement, button,
"The correct button should be focused after tabbing");
}
EventUtils.synthesizeKey("KEY_Tab", {});
EventUtils.synthesizeKey("KEY_Tab");
Assert.equal(document.commandDispatcher.focusedElement, buttons[0],
"Pressing tab should cycle around and select the first button again");
@ -186,9 +186,9 @@ add_task(async function testInterleavedTabAndArrowKeys() {
if (button.disabled)
continue;
if (tab) {
EventUtils.synthesizeKey("KEY_Tab", {});
EventUtils.synthesizeKey("KEY_Tab");
} else {
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
}
tab = !tab;
}
@ -212,7 +212,7 @@ add_task(async function testSpaceDownAfterTabNavigation() {
for (button of buttons) {
if (button.disabled)
continue;
EventUtils.synthesizeKey("KEY_Tab", {});
EventUtils.synthesizeKey("KEY_Tab");
if (button.id == kHelpButtonId) {
break;
}

Просмотреть файл

@ -111,12 +111,12 @@ add_task(async function() {
async function startInputSession(indexToWaitFor) {
gURLBar.focus();
gURLBar.value = keyword;
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
await expectEvent("on-input-started-fired");
// Always use a different input at every invokation, so that
// waitForAutocompleteResultAt can distinguish different cases.
let char = ((inputSessionSerial++) % 10).toString();
EventUtils.synthesizeKey(char, {});
EventUtils.sendString(char);
await expectEvent("on-input-changed-fired", {text: char});
// Wait for the autocomplete search. Note that we cannot wait for the search
@ -131,58 +131,52 @@ add_task(async function() {
gURLBar.focus();
// Start an input session by typing in <keyword><space>.
for (let letter of keyword) {
EventUtils.synthesizeKey(letter, {});
}
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(keyword + " ");
await expectEvent("on-input-started-fired");
// Test canceling the input before any changed events fire.
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.synthesizeKey("KEY_Backspace");
await expectEvent("on-input-cancelled-fired");
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
await expectEvent("on-input-started-fired");
// Test submitting the input before any changed events fire.
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
await expectEvent("on-input-entered-fired");
gURLBar.focus();
// Start an input session by typing in <keyword><space>.
for (let letter of keyword) {
EventUtils.synthesizeKey(letter, {});
}
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(keyword + " ");
await expectEvent("on-input-started-fired");
// We should expect input changed events now that the keyword is active.
EventUtils.synthesizeKey("b", {});
EventUtils.sendString("b");
await expectEvent("on-input-changed-fired", {text: "b"});
EventUtils.synthesizeKey("c", {});
EventUtils.sendString("c");
await expectEvent("on-input-changed-fired", {text: "bc"});
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.synthesizeKey("KEY_Backspace");
await expectEvent("on-input-changed-fired", {text: "b"});
// Even though the input is <keyword><space> We should not expect an
// input started event to fire since the keyword is active.
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.synthesizeKey("KEY_Backspace");
await expectEvent("on-input-changed-fired", {text: ""});
// Make the keyword inactive by hitting backspace.
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.synthesizeKey("KEY_Backspace");
await expectEvent("on-input-cancelled-fired");
// Activate the keyword by typing a space.
// Expect onInputStarted to fire.
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
await expectEvent("on-input-started-fired");
// onInputChanged should fire even if a space is entered.
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
await expectEvent("on-input-changed-fired", {text: " "});
// The active session should cancel if the input blurs.
@ -222,9 +216,7 @@ add_task(async function() {
await startInputSession(suggestionIndex);
// Select the suggestion.
for (let i = 0; i < suggestionIndex; i++) {
EventUtils.synthesizeKey("VK_DOWN", {});
}
EventUtils.synthesizeKey("KEY_ArrowDown", {repeat: suggestionIndex});
let promiseEvent = expectEvent("on-input-entered-fired", {
text: expectedText,

Просмотреть файл

@ -46,7 +46,7 @@ add_task(async function openKeywordBookmarkWithWindowOpen() {
gURLBar.focus();
let tabCreatedPromise = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen");
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
info("Waiting for tab being created");
let {target: tab} = await tabCreatedPromise;

Просмотреть файл

@ -22,9 +22,9 @@ async function testContextmenu(menuitem) {
EventUtils.synthesizeMouseAtCenter(menuitem, {type: "contextmenu", button: 2});
await promiseEvent;
let promiseTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, null);
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
BrowserTestUtils.waitForEvent(menuitem, "DOMMenuItemActive");
EventUtils.synthesizeKey("KEY_ArrowDown", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
BrowserTestUtils.waitForEvent(menuitem, "DOMMenuItemActive");
EventUtils.sendKey("return");
let newTab = await promiseTabOpened;

Просмотреть файл

@ -37,7 +37,7 @@ async function checkPopupContextMenu() {
await contextMenuHiddenPromise;
let popupHiddenPromise = onPopupEvent(BMB_menuPopup, "hidden");
// Can't use synthesizeMouseAtCenter because the dropdown panel is in the way
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
info("Waiting for bookmarks menu to be hidden.");
await popupHiddenPromise;
}

Просмотреть файл

@ -80,8 +80,8 @@
let promise = promiseOnItemChanged();
keywordField.focus();
keywordField.value = "kw";
synthesizeKey(i.toString(), {});
synthesizeKey("VK_RETURN", {});
sendString(i.toString());
synthesizeKey("KEY_Enter");
keywordField.blur();
let {property, value} = await promise;
is(property, "keyword", "The keyword should have been changed");

Просмотреть файл

@ -16,13 +16,13 @@ add_task(async function() {
// Test button
let button = doc.getElementById("button");
button.focus();
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
await checkPageScrolling(container, "button");
// Test checkbox
let checkbox = doc.getElementById("checkbox");
checkbox.focus();
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
ok(checkbox.checked, "Checkbox is checked");
await checkPageScrolling(container, "checkbox");
@ -30,14 +30,14 @@ add_task(async function() {
let listbox = doc.getElementById("listbox");
let listitem = doc.getElementById("listitem");
listbox.focus();
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
ok(listitem.selected, "Listitem is selected");
await checkPageScrolling(container, "listbox");
// Test radio
let radiogroup = doc.getElementById("radiogroup");
radiogroup.focus();
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
await checkPageScrolling(container, "radio");
});
@ -49,9 +49,9 @@ add_task(async function() {
// Test search
let engineList = doc.getElementById("engineList");
engineList.focus();
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
is(engineList.view.selection.currentIndex, 0, "Search engineList is selected");
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
await checkPageScrolling(container, "search engineList");
});
@ -80,7 +80,7 @@ add_task(async function() {
let tabsToggle = doc.getElementById("tabsToggle");
tabsToggle.focus();
EventUtils.synthesizeKey(" ", {});
EventUtils.sendString(" ");
await checkPageScrolling(doc.documentElement, "session restore");
gBrowser.removeCurrentTab();

Просмотреть файл

@ -33,9 +33,9 @@ add_task(async function testDeleteCookie() {
tree.view.selection.select(0);
if (AppConstants.platform == "macosx") {
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.synthesizeKey("KEY_Backspace");
} else {
EventUtils.synthesizeKey("VK_DELETE", {});
EventUtils.synthesizeKey("KEY_Delete");
}
await TestUtils.waitForCondition(() => tree.view.rowCount == 0);

Просмотреть файл

@ -59,9 +59,9 @@ add_task(async function test_deletePasswordWithKey() {
tree.view.selection.select(0);
if (AppConstants.platform == "macosx") {
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.synthesizeKey("KEY_Backspace");
} else {
EventUtils.synthesizeKey("VK_DELETE", {});
EventUtils.synthesizeKey("KEY_Delete");
}
await TestUtils.waitForCondition(() => tree.view.rowCount == 0);

Просмотреть файл

@ -64,9 +64,9 @@ add_task(async function deleteALoginException() {
tree.view.selection.select(0);
if (AppConstants.platform == "macosx") {
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.synthesizeKey("KEY_Backspace");
} else {
EventUtils.synthesizeKey("VK_DELETE", {});
EventUtils.synthesizeKey("KEY_Delete");
}
await TestUtils.waitForCondition(() => tree.view.rowCount == 0);

Просмотреть файл

@ -135,7 +135,7 @@ add_task(async function testSetupEngine() {
add_task(async function testReturn() {
await prepareTest();
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
is(gBrowser.tabs.length, preTabNo, "Return key did not open new tab");
@ -145,7 +145,7 @@ add_task(async function testReturn() {
add_task(async function testAltReturn() {
await prepareTest();
await BrowserTestUtils.openNewForegroundTab(gBrowser, () => {
EventUtils.synthesizeKey("VK_RETURN", { altKey: true });
EventUtils.synthesizeKey("KEY_Enter", {altKey: true});
});
is(gBrowser.tabs.length, preTabNo + 1, "Alt+Return key added new tab");
@ -237,7 +237,7 @@ add_task(async function testClearHistory() {
EventUtils.synthesizeMouseAtCenter(textbox, { type: "contextmenu", button: 2 });
await popupShownPromise;
// Close the context menu.
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
let controller = searchBar.textbox.controllers.getControllerForCommand("cmd_clearhistory");
ok(controller.isCommandEnabled("cmd_clearhistory"), "Clear history command enabled");

Просмотреть файл

@ -138,7 +138,7 @@ async function testSearchEngine(engineDetails) {
run() {
gURLBar.value = "? foo";
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
}
},
{
@ -147,7 +147,7 @@ async function testSearchEngine(engineDetails) {
run() {
gURLBar.value = `${engineDetails.alias} foo`;
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
}
},
{
@ -158,7 +158,7 @@ async function testSearchEngine(engineDetails) {
let sb = BrowserSearch.searchBar;
sb.focus();
sb.value = "foo";
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
},
postTest() {
BrowserSearch.searchBar.value = "";
@ -181,7 +181,7 @@ async function testSearchEngine(engineDetails) {
input.focus();
input.value = "foo";
});
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
}
}
];

Просмотреть файл

@ -47,7 +47,7 @@ function test() {
Services.search.removeEngine(fooEngine);
}
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
executeSoon(() => executeSoon(afterSearch));
}

Просмотреть файл

@ -44,7 +44,7 @@ add_task(async function test_hidden() {
promise = promiseEvent(searchPopup, "popuphidden");
info("Closing search panel");
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promise;
});

Просмотреть файл

@ -74,7 +74,7 @@ async function doTest() {
// By default the search will open in the background and the popup will stay open:
promise = promiseEvent(searchPopup, "popuphidden");
info("Closing search panel");
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promise;
// Check the loaded tab.

Просмотреть файл

@ -150,7 +150,7 @@ async function openPopupAndGetEngineButton(isSearch, popup, oneOffBinding, baseI
} else {
// There's no history at this stage, so we need to press a key.
urlbar.focus();
EventUtils.synthesizeKey("a", {});
EventUtils.sendString("a");
}
await promise;
@ -195,7 +195,7 @@ async function openPopupAndGetEngineButton(isSearch, popup, oneOffBinding, baseI
async function promiseClosePopup(popup) {
// close the panel using the escape key.
let promise = promiseEvent(popup, "popuphidden");
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promise;
// Move the cursor out of the panel area to avoid messing with other tests.

Просмотреть файл

@ -94,7 +94,7 @@ add_task(async function test_notext() {
promise = promiseEvent(searchPopup, "popuphidden");
info("Closing search panel");
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promise;
});

Просмотреть файл

@ -159,7 +159,7 @@ async function testSearchEngine(engineDetails) {
run() {
gURLBar.value = "? foo";
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
}
},
{
@ -168,7 +168,7 @@ async function testSearchEngine(engineDetails) {
run() {
gURLBar.value = `${engineDetails.alias} foo`;
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
}
},
{
@ -181,7 +181,7 @@ async function testSearchEngine(engineDetails) {
registerCleanupFunction(function() {
sb.value = "";
});
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
}
},
{
@ -200,7 +200,7 @@ async function testSearchEngine(engineDetails) {
input.focus();
input.value = "foo";
});
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("KEY_Enter");
}
}
];

Просмотреть файл

@ -92,7 +92,7 @@ add_task(async function test_arrows() {
// The down arrow should first go through the suggestions.
for (let i = 0; i < kValues.length; ++i) {
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(searchPopup.selectedIndex, i,
"the suggestion at index " + i + " should be selected");
is(textbox.value, kValues[i],
@ -101,7 +101,7 @@ add_task(async function test_arrows() {
// Pressing down again should remove suggestion selection and change the text
// field value back to what the user typed, and select the first one-off.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
is(textbox.value, kUserValue,
"the textfield value should be back to initial value");
@ -110,32 +110,32 @@ add_task(async function test_arrows() {
for (let i = 0; i < oneOffs.length; ++i) {
is(textbox.selectedButton, oneOffs[i],
"the one-off button #" + (i + 1) + " should be selected");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
}
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
// We should now be back to the initial situation.
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
ok(!textbox.selectedButton, "no one-off button should be selected");
info("now test the up arrow key");
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
// cycle through the one-off items, the first one is already selected.
for (let i = oneOffs.length; i; --i) {
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton, oneOffs[i - 1],
"the one-off button #" + i + " should be selected");
}
// Another press on up should clear the one-off selection and select the
// last suggestion.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
ok(!textbox.selectedButton, "no one-off button should be selected");
for (let i = kValues.length - 1; i >= 0; --i) {
@ -143,7 +143,7 @@ add_task(async function test_arrows() {
"the suggestion at index " + i + " should be selected");
is(textbox.value, kValues[i],
"the textfield value should be " + kValues[i]);
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
}
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
@ -156,16 +156,16 @@ add_task(async function test_typing_clears_button_selection() {
"the search bar should be focused"); // from the previous test.
ok(!textbox.selectedButton, "no button should be selected");
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
// Type a character.
EventUtils.synthesizeKey("a", {});
EventUtils.sendString("a");
ok(!textbox.selectedButton, "the settings item should be de-selected");
// Remove the character.
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
EventUtils.synthesizeKey("KEY_Backspace");
});
add_task(async function test_tab() {
@ -178,7 +178,7 @@ add_task(async function test_tab() {
// Pressing tab should select the first one-off without selecting suggestions.
// now cycle through the one-off items, the first one is already selected.
for (let i = 0; i < oneOffs.length; ++i) {
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
is(textbox.selectedButton, oneOffs[i],
"the one-off button #" + (i + 1) + " should be selected");
}
@ -186,13 +186,13 @@ add_task(async function test_tab() {
is(textbox.value, kUserValue, "the textfield value should be unmodified");
// One more <tab> selects the settings button.
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
// Pressing tab again should close the panel...
let promise = promiseEvent(searchPopup, "popuphidden");
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
await promise;
// ... and move the focus out of the searchbox.
@ -211,26 +211,26 @@ add_task(async function test_shift_tab() {
ok(!textbox.selectedButton, "no one-off button should be selected");
// Press up once to select the last button.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
// Press up again to select the last one-off button.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
// Pressing shift+tab should cycle through the one-off items.
for (let i = oneOffs.length - 1; i >= 0; --i) {
is(textbox.selectedButton, oneOffs[i],
"the one-off button #" + (i + 1) + " should be selected");
if (i)
EventUtils.synthesizeKey("VK_TAB", {shiftKey: true});
EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
}
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
is(textbox.value, kUserValue, "the textfield value should be unmodified");
// Pressing shift+tab again should close the panel...
promise = promiseEvent(searchPopup, "popuphidden");
EventUtils.synthesizeKey("VK_TAB", {shiftKey: true});
EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
await promise;
// ... and move the focus out of the searchbox.
@ -247,12 +247,12 @@ add_task(async function test_alt_down() {
// close the panel using the escape key.
promise = promiseEvent(searchPopup, "popuphidden");
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promise;
// check that alt+down opens the panel...
promise = promiseEvent(searchPopup, "popupshown");
EventUtils.synthesizeKey("VK_DOWN", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
await promise;
// ... and does nothing else.
@ -264,18 +264,18 @@ add_task(async function test_alt_down() {
// and cycle through the one-off items.
let oneOffs = getOneOffs();
for (let i = 0; i < oneOffs.length; ++i) {
EventUtils.synthesizeKey("VK_DOWN", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
is(textbox.selectedButton, oneOffs[i],
"the one-off button #" + (i + 1) + " should be selected");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
}
// One more alt+down keypress and nothing should be selected.
EventUtils.synthesizeKey("VK_DOWN", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
ok(!textbox.selectedButton, "no one-off button should be selected");
// another one and the first one-off should be selected.
EventUtils.synthesizeKey("VK_DOWN", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
is(textbox.selectedButton, oneOffs[0],
"the first one-off button should be selected");
});
@ -283,12 +283,12 @@ add_task(async function test_alt_down() {
add_task(async function test_alt_up() {
// close the panel using the escape key.
let promise = promiseEvent(searchPopup, "popuphidden");
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promise;
// check that alt+up opens the panel...
promise = promiseEvent(searchPopup, "popupshown");
EventUtils.synthesizeKey("VK_UP", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowUp", {altKey: true});
await promise;
// ... and does nothing else.
@ -300,26 +300,26 @@ add_task(async function test_alt_up() {
// and cycle up through the one-off items.
let oneOffs = getOneOffs();
for (let i = oneOffs.length - 1; i >= 0; --i) {
EventUtils.synthesizeKey("VK_UP", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowUp", {altKey: true});
is(textbox.selectedButton, oneOffs[i],
"the one-off button #" + (i + 1) + " should be selected");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
}
// One more alt+down keypress and nothing should be selected.
EventUtils.synthesizeKey("VK_UP", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowUp", {altKey: true});
ok(!textbox.selectedButton, "no one-off button should be selected");
// another one and the last one-off should be selected.
EventUtils.synthesizeKey("VK_UP", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowUp", {altKey: true});
is(textbox.selectedButton, oneOffs[oneOffs.length - 1],
"the last one-off button should be selected");
// Cleanup for the next test.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
ok(!textbox.selectedButton, "no one-off should be selected anymore");
});
@ -330,7 +330,7 @@ add_task(async function test_tab_and_arrows() {
is(textbox.value, kUserValue, "the textfield value should be unmodified");
// After pressing down, the first sugggestion should be selected.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(searchPopup.selectedIndex, 0, "first suggestion should be selected");
is(textbox.value, kValues[0], "the textfield value should have changed");
ok(!textbox.selectedButton, "no one-off button should be selected");
@ -338,31 +338,31 @@ add_task(async function test_tab_and_arrows() {
// After pressing tab, the first one-off should be selected,
// and no suggestion should be selected.
let oneOffs = getOneOffs();
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
is(textbox.selectedButton, oneOffs[0],
"the first one-off button should be selected");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
// After pressing down, the second one-off should be selected.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(textbox.selectedButton, oneOffs[1],
"the second one-off button should be selected");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
// After pressing right, the third one-off should be selected.
EventUtils.synthesizeKey("VK_RIGHT", {});
EventUtils.synthesizeKey("KEY_ArrowRight");
is(textbox.selectedButton, oneOffs[2],
"the third one-off button should be selected");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
// After pressing left, the second one-off should be selected again.
EventUtils.synthesizeKey("VK_LEFT", {});
EventUtils.synthesizeKey("KEY_ArrowLeft");
is(textbox.selectedButton, oneOffs[1],
"the second one-off button should be selected again");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
// After pressing up, the first one-off should be selected again.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton, oneOffs[0],
"the first one-off button should be selected again");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
@ -370,7 +370,7 @@ add_task(async function test_tab_and_arrows() {
// After pressing up again, the last suggestion should be selected.
// the textfield value back to the user-typed value, and still the first one-off
// selected.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(searchPopup.selectedIndex, kValues.length - 1,
"last suggestion should be selected");
is(textbox.value, kValues[kValues.length - 1],
@ -379,7 +379,7 @@ add_task(async function test_tab_and_arrows() {
"no one-off button should be selected");
// Now pressing down should select the first one-off.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(textbox.selectedButton, oneOffs[0],
"the first one-off button should be selected");
is(searchPopup.selectedIndex, -1, "there should be no selected suggestion");
@ -407,13 +407,13 @@ add_task(async function test_open_search() {
ok(!textbox.selectedButton, "no button should be selected");
// Pressing up once selects the setting button...
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
// ...and then pressing up selects open search engines.
for (let i = engines.length; i; --i) {
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
let selectedButton = textbox.selectedButton;
is(selectedButton, engines[i - 1],
"the engine #" + i + " should be selected");
@ -422,19 +422,19 @@ add_task(async function test_open_search() {
}
// Pressing up again should select the last one-off button.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton, getOneOffs().pop(),
"the last one-off button should be selected");
info("now check that the down key navigates open search items as expected");
for (let i = 0; i < engines.length; ++i) {
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(textbox.selectedButton, engines[i],
"the engine #" + (i + 1) + " should be selected");
}
// Pressing down on the last engine item selects the settings button.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");

Просмотреть файл

@ -246,7 +246,7 @@ add_task(async function focus_change_closes_popup() {
promise = promiseEvent(searchPopup, "popuphidden");
let promise2 = promiseEvent(searchbar, "blur");
EventUtils.synthesizeKey("VK_TAB", { shiftKey: true });
EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
await promise;
await promise2;
@ -269,7 +269,7 @@ add_task(async function focus_change_closes_small_popup() {
promise = promiseEvent(searchPopup, "popuphidden");
let promise2 = promiseEvent(searchbar, "blur");
EventUtils.synthesizeKey("VK_TAB", { shiftKey: true });
EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
await promise;
await promise2;
});
@ -289,7 +289,7 @@ add_task(async function escape_closes_popup() {
is(textbox.selectionEnd, 3, "Should have selected all of the text");
promise = promiseEvent(searchPopup, "popuphidden");
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promise;
textbox.value = "";
@ -332,7 +332,7 @@ add_task(async function tab_opens_popup() {
textbox.value = "foo";
let promise = promiseEvent(searchPopup, "popupshown");
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
await promise;
isnot(searchPopup.getAttribute("showonlysettings"), "true", "Should show the full popup");
@ -352,7 +352,7 @@ add_no_popup_task(function tab_doesnt_open_popup() {
gURLBar.focus();
textbox.value = "foo";
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
is(Services.focus.focusedElement, textbox.inputField, "Should have focused the search bar");
is(textbox.selectionStart, 0, "Should have selected all of the text");
@ -404,7 +404,7 @@ add_task(async function refocus_window_doesnt_open_popup_keyboard() {
textbox.value = "foo";
let promise = promiseEvent(searchPopup, "popupshown");
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
await promise;
isnot(searchPopup.getAttribute("showonlysettings"), "true", "Should show the full popup");
@ -502,45 +502,45 @@ add_task(async function dont_rollup_oncaretmove() {
await promise;
// Deselect the text
EventUtils.synthesizeKey("VK_RIGHT", {});
EventUtils.synthesizeKey("KEY_ArrowRight");
is(textbox.selectionStart, 9, "Should have moved the caret (selectionStart after deselect right)");
is(textbox.selectionEnd, 9, "Should have moved the caret (selectionEnd after deselect right)");
is(searchPopup.state, "open", "Popup should still be open");
EventUtils.synthesizeKey("VK_LEFT", {});
EventUtils.synthesizeKey("KEY_ArrowLeft");
is(textbox.selectionStart, 8, "Should have moved the caret (selectionStart after left)");
is(textbox.selectionEnd, 8, "Should have moved the caret (selectionEnd after left)");
is(searchPopup.state, "open", "Popup should still be open");
EventUtils.synthesizeKey("VK_RIGHT", {});
EventUtils.synthesizeKey("KEY_ArrowRight");
is(textbox.selectionStart, 9, "Should have moved the caret (selectionStart after right)");
is(textbox.selectionEnd, 9, "Should have moved the caret (selectionEnd after right)");
is(searchPopup.state, "open", "Popup should still be open");
// Ensure caret movement works while a suggestion is selected.
is(textbox.popup.selectedIndex, -1, "No selected item in list");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(textbox.popup.selectedIndex, 0, "Selected item in list");
is(textbox.selectionStart, 9, "Should have moved the caret to the end (selectionStart after selection)");
is(textbox.selectionEnd, 9, "Should have moved the caret to the end (selectionEnd after selection)");
EventUtils.synthesizeKey("VK_LEFT", {});
EventUtils.synthesizeKey("KEY_ArrowLeft");
is(textbox.selectionStart, 8, "Should have moved the caret again (selectionStart after left)");
is(textbox.selectionEnd, 8, "Should have moved the caret again (selectionEnd after left)");
is(searchPopup.state, "open", "Popup should still be open");
EventUtils.synthesizeKey("VK_LEFT", {});
EventUtils.synthesizeKey("KEY_ArrowLeft");
is(textbox.selectionStart, 7, "Should have moved the caret (selectionStart after left)");
is(textbox.selectionEnd, 7, "Should have moved the caret (selectionEnd after left)");
is(searchPopup.state, "open", "Popup should still be open");
EventUtils.synthesizeKey("VK_RIGHT", {});
EventUtils.synthesizeKey("KEY_ArrowRight");
is(textbox.selectionStart, 8, "Should have moved the caret (selectionStart after right)");
is(textbox.selectionEnd, 8, "Should have moved the caret (selectionEnd after right)");
is(searchPopup.state, "open", "Popup should still be open");
if (!navigator.platform.includes("Mac")) {
EventUtils.synthesizeKey("VK_HOME", {});
EventUtils.synthesizeKey("KEY_Home");
is(textbox.selectionStart, 0, "Should have moved the caret (selectionStart after home)");
is(textbox.selectionEnd, 0, "Should have moved the caret (selectionEnd after home)");
is(searchPopup.state, "open", "Popup should still be open");
@ -548,7 +548,7 @@ add_task(async function dont_rollup_oncaretmove() {
// Close the popup again
promise = promiseEvent(searchPopup, "popuphidden");
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promise;
textbox.value = "";
@ -560,7 +560,7 @@ add_task(async function dont_open_in_customization() {
textbox.value = "foo";
let promise = promiseEvent(searchPopup, "popupshown");
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
await promise;
isnot(searchPopup.getAttribute("showonlysettings"), "true", "Should show the full popup");

Просмотреть файл

@ -95,7 +95,7 @@ info("textbox.mController.searchString = " + textbox.mController.searchString);
ok(!textbox.selectedButton, "no one-off button should be selected");
// Pressing should select the first one-off.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
is(textbox.value, "", "the textfield value should be unmodified");
@ -103,31 +103,31 @@ info("textbox.mController.searchString = " + textbox.mController.searchString);
for (let i = 0; i < oneOffs.length; ++i) {
is(textbox.selectedButton, oneOffs[i],
"the one-off button #" + (i + 1) + " should be selected");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
}
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
// We should now be back to the initial situation.
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
ok(!textbox.selectedButton, "no one-off button should be selected");
info("now test the up arrow key");
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
// cycle through the one-off items, the first one is already selected.
for (let i = oneOffs.length; i; --i) {
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton, oneOffs[i - 1],
"the one-off button #" + i + " should be selected");
}
// Another press on up should clear the one-off selection.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
ok(!textbox.selectedButton, "no one-off button should be selected");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
is(textbox.value, "", "the textfield value should be unmodified");
@ -143,7 +143,7 @@ add_task(async function test_tab() {
// Pressing tab should select the first one-off without selecting suggestions.
// now cycle through the one-off items, the first one is already selected.
for (let i = 0; i < oneOffs.length; ++i) {
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
is(textbox.selectedButton, oneOffs[i],
"the one-off button #" + (i + 1) + " should be selected");
}
@ -151,13 +151,13 @@ add_task(async function test_tab() {
is(textbox.value, "", "the textfield value should be unmodified");
// One more <tab> selects the settings button.
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
// Pressing tab again should close the panel...
let promise = promiseEvent(searchPopup, "popuphidden");
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
await promise;
// ... and move the focus out of the searchbox.
@ -179,26 +179,26 @@ add_task(async function test_shift_tab() {
is(searchPopup.getAttribute("showonlysettings"), "true", "Should show the small popup");
// Press up once to select the last button.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
// Press up again to select the last one-off button.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
// Pressing shift+tab should cycle through the one-off items.
for (let i = oneOffs.length - 1; i >= 0; --i) {
is(textbox.selectedButton, oneOffs[i],
"the one-off button #" + (i + 1) + " should be selected");
if (i)
EventUtils.synthesizeKey("VK_TAB", {shiftKey: true});
EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
}
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
is(textbox.value, "", "the textfield value should be unmodified");
// Pressing shift+tab again should close the panel...
promise = promiseEvent(searchPopup, "popuphidden");
EventUtils.synthesizeKey("VK_TAB", {shiftKey: true});
EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
await promise;
// ... and move the focus out of the searchbox.
@ -225,23 +225,23 @@ add_task(async function test_alt_down() {
// and cycle through the one-off items.
let oneOffs = getOneOffs();
for (let i = 0; i < oneOffs.length; ++i) {
EventUtils.synthesizeKey("VK_DOWN", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
is(textbox.selectedButton, oneOffs[i],
"the one-off button #" + (i + 1) + " should be selected");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
}
// One more alt+down keypress and nothing should be selected.
EventUtils.synthesizeKey("VK_DOWN", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
ok(!textbox.selectedButton, "no one-off button should be selected");
// another one and the first one-off should be selected.
EventUtils.synthesizeKey("VK_DOWN", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
is(textbox.selectedButton, oneOffs[0],
"the first one-off button should be selected");
// Clear the selection with an alt+up keypress
EventUtils.synthesizeKey("VK_UP", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowUp", {altKey: true});
ok(!textbox.selectedButton, "no one-off button should be selected");
});
@ -255,26 +255,26 @@ add_task(async function test_alt_up() {
// and cycle up through the one-off items.
let oneOffs = getOneOffs();
for (let i = oneOffs.length - 1; i >= 0; --i) {
EventUtils.synthesizeKey("VK_UP", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowUp", {altKey: true});
is(textbox.selectedButton, oneOffs[i],
"the one-off button #" + (i + 1) + " should be selected");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
}
// One more alt+down keypress and nothing should be selected.
EventUtils.synthesizeKey("VK_UP", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowUp", {altKey: true});
ok(!textbox.selectedButton, "no one-off button should be selected");
// another one and the last one-off should be selected.
EventUtils.synthesizeKey("VK_UP", {altKey: true});
EventUtils.synthesizeKey("KEY_ArrowUp", {altKey: true});
is(textbox.selectedButton, oneOffs[oneOffs.length - 1],
"the last one-off button should be selected");
// Cleanup for the next test.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
ok(!textbox.selectedButton, "no one-off should be selected anymore");
});
@ -286,19 +286,19 @@ add_task(async function test_tab_and_arrows() {
// After pressing down, the first one-off should be selected.
let oneOffs = getOneOffs();
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(textbox.selectedButton, oneOffs[0],
"the first one-off button should be selected");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
// After pressing tab, the second one-off should be selected.
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("KEY_Tab");
is(textbox.selectedButton, oneOffs[1],
"the second one-off button should be selected");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
// After pressing up, the first one-off should be selected again.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton, oneOffs[0],
"the first one-off button should be selected");
is(searchPopup.selectedIndex, -1, "no suggestion should be selected");
@ -327,13 +327,13 @@ add_task(async function test_open_search() {
ok(!textbox.selectedButton, "no button should be selected");
// Pressing up once selects the setting button...
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");
// ...and then pressing up selects open search engines.
for (let i = engines.length; i; --i) {
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
let selectedButton = textbox.selectedButton;
is(selectedButton, engines[i - 1],
"the engine #" + i + " should be selected");
@ -342,19 +342,19 @@ add_task(async function test_open_search() {
}
// Pressing up again should select the last one-off button.
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
is(textbox.selectedButton, getOneOffs().pop(),
"the last one-off button should be selected");
info("now check that the down key navigates open search items as expected");
for (let i = 0; i < engines.length; ++i) {
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(textbox.selectedButton, engines[i],
"the engine #" + (i + 1) + " should be selected");
}
// Pressing down on the last engine item selects the settings button.
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
is(textbox.selectedButton.getAttribute("anonid"), "search-settings",
"the settings item should be selected");

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function test() {
let promise = promiseEvent(searchPopup, "popupshown");
info("Opening search panel");
searchbar.focus();
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("KEY_ArrowDown");
await promise;
// Make sure it has only one add-engine menu button item.
@ -60,19 +60,19 @@ add_task(async function test() {
for (let button = null;
button != menuButton;
button = searchbar.textbox.popup.oneOffButtons.selectedButton) {
EventUtils.synthesizeKey("VK_UP", {});
EventUtils.synthesizeKey("KEY_ArrowUp");
}
// Press the Right arrow key. The submenu should open.
promise = promiseEvent(buttonPopup, "popupshown");
EventUtils.synthesizeKey("VK_RIGHT", {});
EventUtils.synthesizeKey("KEY_ArrowRight");
await promise;
Assert.ok(menuButton.open, "Submenu should be open");
// Press the Esc key. The submenu should close.
promise = promiseEvent(buttonPopup, "popuphidden");
EventUtils.synthesizeKey("VK_ESCAPE", {});
EventUtils.synthesizeKey("KEY_Escape");
await promise;
Assert.ok(!menuButton.open, "Submenu should be closed");

Просмотреть файл

@ -231,7 +231,7 @@ function test() {
let inputText = "example.org";
gURLBar.focus();
gURLBar.value = inputText.slice(0, -1);
EventUtils.synthesizeKey(inputText.slice(-1), {});
EventUtils.sendString(inputText.slice(-1));
executeSoon(function() {
is(browser.userTypedValue, "example.org",

Просмотреть файл

@ -119,7 +119,7 @@ function triggerAutofillAndCheckProfile(profile) {
promises.push(checkFieldAutofilled);
}
// Press Enter key and trigger form autofill.
synthesizeKey("KEY_Enter", {});
synthesizeKey("KEY_Enter");
return Promise.all(promises);
}
@ -243,10 +243,10 @@ function initPopupListener() {
async function triggerPopupAndHoverItem(fieldSelector, selectIndex) {
await focusAndWaitForFieldsIdentified(fieldSelector);
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
for (let i = 0; i <= selectIndex; i++) {
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
}
await notifySelectedIndex(selectIndex);
}

Просмотреть файл

@ -39,7 +39,7 @@ async function setupAddressStorage() {
add_task(async function check_autocomplete_on_autofocus_field() {
await setupAddressStorage();
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(address =>
JSON.stringify({primary: address.organization, secondary: address["street-address"]})

Просмотреть файл

@ -54,7 +54,7 @@ add_task(async function history_only_menu_checking() {
await setupFormHistory();
await setInput("#tel", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(["+1234567890"], false);
});
@ -67,7 +67,7 @@ add_task(async function all_saved_fields_less_than_threshold() {
});
await setInput("#email", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(["foo@mozilla.com"], false);
@ -79,7 +79,7 @@ add_task(async function check_menu_when_both_existed() {
await setupAddressStorage();
await setInput("#organization", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(address =>
JSON.stringify({
@ -89,7 +89,7 @@ add_task(async function check_menu_when_both_existed() {
));
await setInput("#street-address", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(address =>
JSON.stringify({
@ -99,7 +99,7 @@ add_task(async function check_menu_when_both_existed() {
));
await setInput("#tel", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(address =>
JSON.stringify({
@ -109,7 +109,7 @@ add_task(async function check_menu_when_both_existed() {
));
await setInput("#address-line1", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(address =>
JSON.stringify({
@ -122,7 +122,7 @@ add_task(async function check_menu_when_both_existed() {
// Display history search result if no matched data in addresses.
add_task(async function check_fallback_for_mismatched_field() {
await setInput("#email", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(["foo@mozilla.com"], false);
});
@ -134,7 +134,7 @@ add_task(async function check_search_result_for_pref_off() {
});
await setInput("#tel", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(["+1234567890"], false);
@ -144,7 +144,7 @@ add_task(async function check_search_result_for_pref_off() {
// Autofill the address from dropdown menu.
add_task(async function check_fields_after_form_autofill() {
const focusedInput = await setInput("#organization", "Moz");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(address =>
JSON.stringify({
@ -152,16 +152,16 @@ add_task(async function check_fields_after_form_autofill() {
secondary: FormAutofillUtils.toOneLineAddress(address["street-address"]),
})
).slice(1));
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await triggerAutofillAndCheckProfile(MOCK_STORAGE[1]);
synthesizeKey("KEY_Escape", {});
synthesizeKey("KEY_Escape");
is(focusedInput.value, "Mozilla", "Filled field shouldn't be reverted by ESC key");
});
// Fallback to history search after autofill address.
add_task(async function check_fallback_after_form_autofill() {
await setInput("#tel", "", true);
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(["+1234567890"], false);
});
@ -171,7 +171,7 @@ add_task(async function check_form_autofill_resume() {
document.querySelector("#tel").blur();
document.querySelector("#form1").reset();
await setInput("#tel", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(address =>
JSON.stringify({

Просмотреть файл

@ -62,7 +62,7 @@ add_task(async function history_only_menu_checking() {
await setupFormHistory();
await setInput("#cc-exp-year", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(["2023"], false);
});
@ -72,7 +72,7 @@ add_task(async function all_saved_fields_less_than_threshold() {
await addCreditCard(reducedMockRecord);
await setInput("#cc-name", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries([reducedMockRecord].map(patchRecordCCNumber).map(cc => JSON.stringify({
primary: cc["cc-name"],
@ -87,7 +87,7 @@ add_task(async function check_menu_when_both_existed() {
await setupCreditCardStorage();
await setInput("#cc-number", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
primaryAffix: cc.ccNumberFmt.affix,
@ -96,7 +96,7 @@ add_task(async function check_menu_when_both_existed() {
})));
await setInput("#cc-name", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
primary: cc["cc-name"],
@ -104,7 +104,7 @@ add_task(async function check_menu_when_both_existed() {
})));
await setInput("#cc-exp-year", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
primary: cc["cc-exp-year"],
@ -112,7 +112,7 @@ add_task(async function check_menu_when_both_existed() {
})));
await setInput("#cc-exp-month", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
primary: cc["cc-exp-month"],
@ -127,7 +127,7 @@ add_task(async function check_fallback_for_mismatched_field() {
await addCreditCard(reducedMockRecord);
await setInput("#cc-exp-year", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(["2023"], false);
@ -143,7 +143,7 @@ add_task(async function check_search_result_for_pref_off() {
});
await setInput("#cc-name", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(["John Smith"], false);
@ -154,21 +154,21 @@ add_task(async function check_search_result_for_pref_off() {
add_task(async function check_fields_after_form_autofill() {
await setInput("#cc-exp-year", 202);
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.slice(1).map(patchRecordCCNumber).map(cc => JSON.stringify({
primary: cc["cc-exp-year"],
secondary: cc.ccNumberFmt.affix + cc.ccNumberFmt.label,
})));
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await triggerAutofillAndCheckProfile(MOCK_STORAGE[1]);
});
// Fallback to history search after autofill address.
add_task(async function check_fallback_after_form_autofill() {
await setInput("#cc-name", "", true);
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(["John Smith"], false);
});
@ -179,7 +179,7 @@ add_task(async function check_form_autofill_resume() {
document.querySelector("#form1").reset();
await setInput("#cc-name", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
primary: cc["cc-name"],

Просмотреть файл

@ -71,7 +71,7 @@ add_task(async function simple_clear() {
await triggerAutofillAndCheckProfile(MOCK_ADDR_STORAGE[0]);
await triggerPopupAndHoverItem("#tel", 0);
synthesizeKey("KEY_Enter", {});
synthesizeKey("KEY_Enter");
checkIsFormCleared();
});
@ -80,7 +80,7 @@ add_task(async function clear_adapted_record() {
await triggerAutofillAndCheckProfile(MOCK_ADDR_STORAGE[0]);
await triggerPopupAndHoverItem("#street-address", 0);
synthesizeKey("KEY_Enter", {});
synthesizeKey("KEY_Enter");
checkIsFormCleared();
});
@ -91,7 +91,7 @@ add_task(async function clear_modified_form() {
await setInput("#tel", "+1111111111", true);
await triggerPopupAndHoverItem("#street-address", 0);
synthesizeKey("KEY_Enter", {});
synthesizeKey("KEY_Enter");
checkIsFormCleared({tel: "+1111111111"});
});
@ -103,7 +103,7 @@ add_task(async function clear_distinct_section() {
await triggerPopupAndHoverItem("#organization", 0);
await triggerAutofillAndCheckProfile(MOCK_ADDR_STORAGE[0]);
await triggerPopupAndHoverItem("#street-address", 0);
synthesizeKey("KEY_Enter", {});
synthesizeKey("KEY_Enter");
for (const [id, val] of Object.entries(MOCK_CC_STORAGE[0])) {
const element = document.getElementById(id);
@ -115,7 +115,7 @@ add_task(async function clear_distinct_section() {
}
await triggerPopupAndHoverItem("#cc-name", 0);
synthesizeKey("KEY_Enter", {});
synthesizeKey("KEY_Enter");
checkIsFormCleared();
});

Просмотреть файл

@ -51,12 +51,12 @@ add_task(async function history_only_menu_checking() {
await setupFormHistory();
await setInput("#cc-number", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(["1234000056780000"], false);
await setInput("#cc-name", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await notExpectPopup();
});
@ -65,7 +65,7 @@ add_task(async function check_menu_when_both_with_autocomplete_off() {
await setupCreditCardStorage();
await setInput("#cc-number", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
primaryAffix: cc.ccNumberFmt.affix,
@ -74,7 +74,7 @@ add_task(async function check_menu_when_both_with_autocomplete_off() {
})));
await setInput("#cc-name", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
primary: cc["cc-name"],

Просмотреть файл

@ -50,7 +50,7 @@ function addInputField(form, className) {
async function checkFormChangeHappened(formId) {
info("expecting form changed");
await focusAndWaitForFieldsIdentified(`#${formId} input[name=tel]`);
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(address =>
JSON.stringify({primary: address.tel, secondary: address.name})
@ -60,7 +60,7 @@ async function checkFormChangeHappened(formId) {
addInputField(document.querySelector(`#${formId}`), "address-level2");
await focusAndWaitForFieldsIdentified(`#${formId} input[name=name]`);
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(address =>
JSON.stringify({primary: address.name, secondary: address["address-level2"]})
@ -71,7 +71,7 @@ async function checkFormChangeHappened(formId) {
addInputField(document.querySelector(`#${formId}`), "address-level2");
await focusAndWaitForFieldsIdentified(`#${formId} input[name=address-level2]`, true);
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(MOCK_STORAGE.map(address =>
JSON.stringify({primary: address["address-level2"], secondary: address.name})

Просмотреть файл

@ -55,22 +55,22 @@ add_task(async function setup_storage() {
add_task(async function check_preview() {
const focusedInput = await setInput("#organization", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkFormFieldsStyle(null);
for (let i = 0; i < MOCK_STORAGE.length; i++) {
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await notifySelectedIndex(i);
checkFormFieldsStyle(MOCK_STORAGE[i]);
}
// Navigate to the footer
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await notifySelectedIndex(MOCK_STORAGE.length);
checkFormFieldsStyle(null);
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await notifySelectedIndex(-1);
checkFormFieldsStyle(null);

Просмотреть файл

@ -89,7 +89,7 @@ function checkFormFilled(selector, address) {
promises.push(...checkElementFilled(element, converted));
}
}
synthesizeKey("KEY_Enter", {});
synthesizeKey("KEY_Enter");
return Promise.all(promises);
}
@ -112,19 +112,19 @@ add_task(async function setup() {
// Autofill the address with address level 1 code.
add_task(async function autofill_with_level1_code() {
await setInput("#organization-en", "Mozilla Toronto");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
// Replace address level 1 code with full name in English for test result
let result = Object.assign({}, MOCK_STORAGE[1], {"address-level1": "Ontario"});
await checkFormFilled("#form-en", result);
await setInput("#organization-fr", "Mozilla Vancouver");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
// Replace address level 1 code with full name in French for test result
result = Object.assign({}, MOCK_STORAGE[0], {"address-level1": "Colombie-Britannique"});
await checkFormFilled("#form-fr", result);
@ -135,19 +135,19 @@ add_task(async function autofill_with_level1_code() {
// Autofill the address with address level 1 full name.
add_task(async function autofill_with_level1_full_name() {
await setInput("#organization-en", "ExpoCité");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
// Replace address level 1 code with full name in French for test result
let result = Object.assign({}, MOCK_STORAGE[3], {"address-level1": "Quebec"});
await checkFormFilled("#form-en", result);
await setInput("#organization-fr", "Prince of Wales Northern Heritage");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
// Replace address level 1 code with full name in English for test result
result = Object.assign({}, MOCK_STORAGE[2], {"address-level1": "Territoires du Nord-Ouest"});
await checkFormFilled("#form-fr", result);

Просмотреть файл

@ -33,19 +33,19 @@ add_task(async function setupStorage() {
add_task(async function check_switch_form_popup() {
await setInput("#additional-name", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
// We need an intentional wait here before switching form.
await sleep();
await setInput("#organization", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
const {open: popupOpen} = await getPopupState();
is(popupOpen, false);
await sleep();
await setInput("#given-name", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
});

Просмотреть файл

@ -75,7 +75,7 @@ add_task(async function check_storage_after_another_address_submitted() {
ok(matching, "New address saved as expected");
await setInput("#organization", "");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
checkMenuEntries(addressesInMenu.map(address =>
JSON.stringify({primary: address.organization, secondary: address["street-address"]})
@ -110,10 +110,10 @@ add_task(async function check_storage_after_form_submitted() {
TEST_ADDRESSES[1].country = "US";
await setInput("#organization", "Moz");
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_ArrowDown");
await expectPopup();
synthesizeKey("KEY_ArrowDown", {});
synthesizeKey("KEY_Enter", {});
synthesizeKey("KEY_ArrowDown");
synthesizeKey("KEY_Enter");
clickOnElement("input[type=submit]");
let expectedAddresses = TEST_ADDRESSES.slice(0);

Просмотреть файл

@ -101,7 +101,7 @@ add_task(async function test_plainQuery() {
info("Simulate entering a simple search.");
let p = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
await searchInSearchbar("simple query");
EventUtils.sendKey("return");
EventUtils.synthesizeKey("KEY_Enter");
await p;
// Check if the scalars contain the expected values.
@ -143,8 +143,8 @@ add_task(async function test_oneOff_enter() {
await searchInSearchbar("query");
info("Pressing Alt+Down to highlight the first one off engine.");
EventUtils.synthesizeKey("VK_DOWN", { altKey: true });
EventUtils.sendKey("return");
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
EventUtils.synthesizeKey("KEY_Enter");
await p;
// Check if the scalars contain the expected values.
@ -198,9 +198,9 @@ add_task(async function test_oneOff_enterSelection() {
await searchInSearchbar("query");
info("Select the second result, press Alt+Down to take us to the first one-off engine.");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.synthesizeKey("VK_DOWN", { altKey: true });
EventUtils.sendKey("return");
EventUtils.synthesizeKey("KEY_ArrowDown");
EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true});
EventUtils.synthesizeKey("KEY_Enter");
await p;
let resultMethods = resultMethodHist.snapshot();
@ -322,8 +322,8 @@ add_task(async function test_suggestion_enterSelection() {
let p = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
await searchInSearchbar("query");
info("Select the second result and press Return.");
EventUtils.synthesizeKey("VK_DOWN", {});
EventUtils.sendKey("return");
EventUtils.synthesizeKey("KEY_ArrowDown");
EventUtils.synthesizeKey("KEY_Enter");
await p;
let resultMethods = resultMethodHist.snapshot();

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше