diff options
Diffstat (limited to 'toolkit/components/passwordmgr/test/mochitest/test_autofill_username-only_threshold.html')
-rw-r--r-- | toolkit/components/passwordmgr/test/mochitest/test_autofill_username-only_threshold.html | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autofill_username-only_threshold.html b/toolkit/components/passwordmgr/test/mochitest/test_autofill_username-only_threshold.html new file mode 100644 index 0000000000..d9a2e08095 --- /dev/null +++ b/toolkit/components/passwordmgr/test/mochitest/test_autofill_username-only_threshold.html @@ -0,0 +1,83 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <title>Test autofill on username-form when the number of form exceeds the lookup threshold</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="pwmgr_common.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +Test not autofill on username-form when the number of form exceeds the lookup threshold + +<script> +add_setup(async () => { + await SpecialPowers.pushPrefEnv({"set": [["signon.usernameOnlyForm.lookupThreshold", 5]]}); + + await setStoredLoginsAsync( + [window.location.origin, "https://autofill", null, "user1", "pass1"] + ); +}); + +add_task(async function test_autofill_username_only_form() { + const win = window.open("about:blank"); + SimpleTest.registerCleanupFunction(() => win.close()); + + await loadFormIntoWindow(window.location.origin, ` + <!-- no password field, 1 username field --> + <form id='form1' action='https://autofill'> 1 + <input type='text' name='uname' autocomplete='username' value=''> + + <button type='submit'>Submit</button> + <button type='reset'> Reset </button> + </form> + + <form id='form2' action='https://autofill'> 2 + <input type='text' name='uname' autocomplete='username' value=''> + + <button type='submit'>Submit</button> + <button type='reset'> Reset </button> + </form> + + <form id='form3' action='https://autofill'> 3 + <input type='text' name='uname' autocomplete='username' value=''> + + <button type='submit'>Submit</button> + <button type='reset'> Reset </button> + </form> + + <form id='form4' action='https://autofill'> 4 + <input type='text' name='uname' autocomplete='username' value=''> + + <button type='submit'>Submit</button> + <button type='reset'> Reset </button> + </form> + + <form id='form5' action='https://autofill'> 5 + <input type='text' name='uname' autocomplete='username' value=''> + + <button type='submit'>Submit</button> + <button type='reset'> Reset </button> + </form> + + <form id='form6' action='https://autofill'> 6 + <input type='text' name='uname' autocomplete='username' value=''> + + <button type='submit'>Submit</button> + <button type='reset'> Reset </button> + </form>`, win, 5); + + await checkLoginFormInFrameWithElementValues(win, 1, "user1"); + await checkLoginFormInFrameWithElementValues(win, 2, "user1"); + await checkLoginFormInFrameWithElementValues(win, 3, "user1"); + await checkLoginFormInFrameWithElementValues(win, 4, "user1"); + await checkLoginFormInFrameWithElementValues(win, 5, "user1"); + await checkUnmodifiedFormInFrame(win, 6); +}); +</script> + +<p id="display"></p> +<div id="content"></div> +<pre id="test"></pre> +</body> +</html> |