diff options
Diffstat (limited to 'toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html')
-rw-r--r-- | toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html b/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html deleted file mode 100644 index 2ce3293dd..000000000 --- a/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html +++ /dev/null @@ -1,115 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <meta charset="utf-8"> - <title>Test login autocomplete is activated when focused by js on load</title> - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> - <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script> - <script type="text/javascript" src="satchel_common.js"></script> - <script type="text/javascript" src="pwmgr_common.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body> -<script> -const chromeScript = runChecksAfterCommonInit(false); - -runInParent(function addLogins() { - const { classes: Cc, interfaces: Ci, utils: Cu } = Components; - Cu.import("resource://gre/modules/Services.jsm"); - - // Create some logins just for this form, since we'll be deleting them. - let nsLoginInfo = Components.Constructor("@mozilla.org/login-manager/loginInfo;1", - Ci.nsILoginInfo, "init"); - - let login0 = new nsLoginInfo("https://example.org", "https://example.org", null, - "name", "pass", "uname", "pword"); - - let login1 = new nsLoginInfo("https://example.org", "https://example.org", null, - "name1", "pass1", "uname", "pword"); - - try { - Services.logins.addLogin(login0); - Services.logins.addLogin(login1); - } catch (e) { - assert.ok(false, "addLogin threw: " + e); - } -}); -</script> -<p id="display"></p> - -<div id="content"> - <iframe src="https://example.org/tests/toolkit/components/passwordmgr/test/mochitest/form_autofocus_js.html"></iframe> -</div> - -<pre id="test"> -<script class="testbody" type="text/javascript"> - -let iframe = SpecialPowers.wrap(document.getElementsByTagName("iframe")[0]); -let iframeDoc; - -add_task(function* setup() { - yield new Promise(resolve => { - iframe.addEventListener("load", function onLoad() { - iframe.removeEventListener("load", onLoad); - resolve(); - }); - }); - - iframeDoc = iframe.contentDocument; - - SimpleTest.requestFlakyTimeout("Giving a chance for the unexpected popupshown to occur"); -}); - -add_task(function* test_initial_focus() { - let results = yield notifyMenuChanged(2, "name"); - checkArrayValues(results, ["name", "name1"], "Two results"); - doKey("down"); - doKey("return"); - yield promiseFormsProcessed(); - is(iframeDoc.getElementById("form-basic-password").value, "pass", "Check first password filled"); - let popupState = yield getPopupState(); - is(popupState.open, false, "Check popup is now closed"); -}); - -// This depends on the filling from the previous test. -add_task(function* test_not_reopened_if_filled() { - listenForUnexpectedPopupShown(); - let usernameField = iframeDoc.getElementById("form-basic-username"); - usernameField.focus(); - info("Waiting to see if a popupshown occurs"); - yield new Promise(resolve => setTimeout(resolve, 1000)); - - // cleanup - gPopupShownExpected = true; - iframeDoc.getElementById("form-basic-submit").focus(); -}); - -add_task(function* test_reopened_after_edit_not_matching_saved() { - let usernameField = iframeDoc.getElementById("form-basic-username"); - usernameField.value = "nam"; - let shownPromise = promiseACShown(); - usernameField.focus(); - yield shownPromise; - iframeDoc.getElementById("form-basic-submit").focus(); -}); - -add_task(function* test_not_reopened_after_selecting() { - let formFillController = SpecialPowers.Cc["@mozilla.org/satchel/form-fill-controller;1"]. - getService(SpecialPowers.Ci.nsIFormFillController); - let usernameField = iframeDoc.getElementById("form-basic-username"); - usernameField.value = ""; - iframeDoc.getElementById("form-basic-password").value = ""; - listenForUnexpectedPopupShown(); - formFillController.markAsLoginManagerField(usernameField); - info("Waiting to see if a popupshown occurs"); - yield new Promise(resolve => setTimeout(resolve, 1000)); - - // Cleanup - gPopupShownExpected = true; -}); - -</script> -</pre> -</body> -</html> |