diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
commit | 0ddd00f1959c78ce37c14fef3c83401408fca3bf (patch) | |
tree | d408e02767c86cf8aac3acbb86722b03c77ede6f /toolkit/components/passwordmgr/test/browser/browser_context_menu_autocomplete_interaction.js | |
parent | 20f0905b33cbb18d1caa80c55e2f552c2e18957b (diff) | |
download | UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar.gz UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar.lz UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar.xz UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.zip |
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/passwordmgr/test/browser/browser_context_menu_autocomplete_interaction.js')
-rw-r--r-- | toolkit/components/passwordmgr/test/browser/browser_context_menu_autocomplete_interaction.js | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/toolkit/components/passwordmgr/test/browser/browser_context_menu_autocomplete_interaction.js b/toolkit/components/passwordmgr/test/browser/browser_context_menu_autocomplete_interaction.js deleted file mode 100644 index 1b37e3f79..000000000 --- a/toolkit/components/passwordmgr/test/browser/browser_context_menu_autocomplete_interaction.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Test the password manager context menu interaction with autocomplete. - */ - -"use strict"; - -const TEST_HOSTNAME = "https://example.com"; -const BASIC_FORM_PAGE_PATH = DIRECTORY_PATH + "form_basic.html"; - -var gUnexpectedIsTODO = false; - -/** - * Initialize logins needed for the tests and disable autofill - * for login forms for easier testing of manual fill. - */ -add_task(function* test_initialize() { - let autocompletePopup = document.getElementById("PopupAutoComplete"); - Services.prefs.setBoolPref("signon.autofillForms", false); - registerCleanupFunction(() => { - Services.prefs.clearUserPref("signon.autofillForms"); - autocompletePopup.removeEventListener("popupshowing", autocompleteUnexpectedPopupShowing); - }); - for (let login of loginList()) { - Services.logins.addLogin(login); - } - autocompletePopup.addEventListener("popupshowing", autocompleteUnexpectedPopupShowing); -}); - -add_task(function* test_context_menu_username() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: TEST_HOSTNAME + BASIC_FORM_PAGE_PATH, - }, function* (browser) { - yield openContextMenu(browser, "#form-basic-username"); - - let contextMenu = document.getElementById("contentAreaContextMenu"); - Assert.equal(contextMenu.state, "open", "Context menu opened"); - contextMenu.hidePopup(); - }); -}); - -add_task(function* test_context_menu_password() { - gUnexpectedIsTODO = true; - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: TEST_HOSTNAME + BASIC_FORM_PAGE_PATH, - }, function* (browser) { - yield openContextMenu(browser, "#form-basic-password"); - - let contextMenu = document.getElementById("contentAreaContextMenu"); - Assert.equal(contextMenu.state, "open", "Context menu opened"); - contextMenu.hidePopup(); - }); -}); - -function autocompleteUnexpectedPopupShowing(event) { - if (gUnexpectedIsTODO) { - todo(false, "Autocomplete shouldn't appear"); - } else { - Assert.ok(false, "Autocomplete shouldn't appear"); - } - event.target.hidePopup(); -} - -/** - * Synthesize mouse clicks to open the context menu popup - * for a target login input element. - */ -function* openContextMenu(browser, loginInput) { - // First synthesize a mousedown. We need this to get the focus event with the "contextmenu" event. - let eventDetails1 = {type: "mousedown", button: 2}; - BrowserTestUtils.synthesizeMouseAtCenter(loginInput, eventDetails1, browser); - - // Then synthesize the contextmenu click over the input element. - let contextMenuShownPromise = BrowserTestUtils.waitForEvent(window, "popupshown"); - let eventDetails = {type: "contextmenu", button: 2}; - BrowserTestUtils.synthesizeMouseAtCenter(loginInput, eventDetails, browser); - yield contextMenuShownPromise; - - // Wait to see which popups are shown. - yield new Promise(resolve => setTimeout(resolve, 1000)); -} - -function loginList() { - return [ - LoginTestUtils.testData.formLogin({ - hostname: "https://example.com", - formSubmitURL: "https://example.com", - username: "username", - password: "password", - }), - LoginTestUtils.testData.formLogin({ - hostname: "https://example.com", - formSubmitURL: "https://example.com", - username: "username2", - password: "password2", - }), - ]; -} |