1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/passwordmgr/test/test_basic_form_1pw.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,170 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <title>Test for Login Manager</title> 1.8 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <script type="text/javascript" src="pwmgr_common.js"></script> 1.10 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.11 +</head> 1.12 +<body> 1.13 +Login Manager test: forms with 1 password field 1.14 +<p id="display"></p> 1.15 + 1.16 +<div id="content" style="display: none"> 1.17 + 1.18 +<!-- no username fields --> 1.19 + 1.20 +<form id='form1' action='formtest.js'> 1 1.21 + <!-- Blank, so fill in the password --> 1.22 + <input type='password' name='pname' value=''> 1.23 + <button type='submit'>Submit</button> 1.24 +</form> 1.25 + 1.26 +<form id='form2' action='formtest.js'> 2 1.27 + <!-- Already contains the password, so nothing to do. --> 1.28 + <input type='password' name='pname' value='testpass'> 1.29 + <button type='submit'>Submit</button> 1.30 +</form> 1.31 + 1.32 +<form id='form3' action='formtest.js'> 3 1.33 + <!-- Contains unknown password, so don't change it --> 1.34 + <input type='password' name='pname' value='xxxxxxxx'> 1.35 + <button type='submit'>Submit</button> 1.36 +</form> 1.37 + 1.38 + 1.39 +<!-- username fields --> 1.40 + 1.41 +<form id='form4' action='formtest.js'> 4 1.42 + <!-- Blanks, so fill in login --> 1.43 + <input type='text' name='uname' value=''> 1.44 + <input type='password' name='pname' value=''> 1.45 + <button type='submit'>Submit</button> 1.46 +</form> 1.47 + 1.48 +<form id='form5' action='formtest.js'> 5 1.49 + <!-- Username already set, so fill in password --> 1.50 + <input type='text' name='uname' value='testuser'> 1.51 + <input type='password' name='pname' value=''> 1.52 + <button type='submit'>Submit</button> 1.53 +</form> 1.54 + 1.55 +<form id='form6' action='formtest.js'> 6 1.56 + <!-- Unknown username, so don't fill in password --> 1.57 + <input type='text' name='uname' value='xxxxxxxx'> 1.58 + <input type='password' name='pname' value=''> 1.59 + <button type='submit'>Submit</button> 1.60 +</form> 1.61 + 1.62 +<form id='form7' action='formtest.js'> 7 1.63 + <!-- Password already set, could fill in username but that's weird so we don't --> 1.64 + <input type='text' name='uname' value=''> 1.65 + <input type='password' name='pname' value='testpass'> 1.66 + <button type='submit'>Submit</button> 1.67 +</form> 1.68 + 1.69 +<form id='form8' action='formtest.js'> 8 1.70 + <!-- Unknown password, so don't fill in a username --> 1.71 + <input type='text' name='uname' value=''> 1.72 + <input type='password' name='pname' value='xxxxxxxx'> 1.73 + <button type='submit'>Submit</button> 1.74 +</form> 1.75 + 1.76 + 1.77 + 1.78 +<!-- extra text fields --> 1.79 + 1.80 +<form id='form9' action='formtest.js'> 9 1.81 + <!-- text field _after_ password should never be treated as a username field --> 1.82 + <input type='password' name='pname' value=''> 1.83 + <input type='text' name='uname' value=''> 1.84 + <button type='submit'>Submit</button> 1.85 +</form> 1.86 + 1.87 +<form id='form10' action='formtest.js'> 10 1.88 + <!-- only the first text field before the password should be for username --> 1.89 + <input type='text' name='other' value=''> 1.90 + <input type='text' name='uname' value=''> 1.91 + <input type='password' name='pname' value=''> 1.92 + <button type='submit'>Submit</button> 1.93 +</form> 1.94 + 1.95 +<form id='form11' action='formtest.js'> 11 1.96 + <!-- variation just to make sure extra text field is still ignored --> 1.97 + <input type='text' name='uname' value=''> 1.98 + <input type='password' name='pname' value=''> 1.99 + <input type='text' name='other' value=''> 1.100 + <button type='submit'>Submit</button> 1.101 +</form> 1.102 + 1.103 + 1.104 + 1.105 +<!-- same as last bunch, but with xxxx in the extra field. --> 1.106 + 1.107 +<form id='form12' action='formtest.js'> 12 1.108 + <!-- text field _after_ password should never be treated as a username field --> 1.109 + <input type='password' name='pname' value=''> 1.110 + <input type='text' name='uname' value='xxxxxxxx'> 1.111 + <button type='submit'>Submit</button> 1.112 +</form> 1.113 + 1.114 +<form id='form13' action='formtest.js'> 13 1.115 + <!-- only the first text field before the password should be for username --> 1.116 + <input type='text' name='other' value='xxxxxxxx'> 1.117 + <input type='text' name='uname' value=''> 1.118 + <input type='password' name='pname' value=''> 1.119 + <button type='submit'>Submit</button> 1.120 +</form> 1.121 + 1.122 +<form id='form14' action='formtest.js'> 14 1.123 + <!-- variation just to make sure extra text field is still ignored --> 1.124 + <input type='text' name='uname' value=''> 1.125 + <input type='password' name='pname' value=''> 1.126 + <input type='text' name='other' value='xxxxxxxx'> 1.127 + <button type='submit'>Submit</button> 1.128 +</form> 1.129 + 1.130 + 1.131 +</div> 1.132 + 1.133 +<pre id="test"> 1.134 +<script class="testbody" type="text/javascript"> 1.135 + 1.136 +/** Test for Login Manager: simple form fill **/ 1.137 + 1.138 +commonInit(); 1.139 + 1.140 +function startTest() { 1.141 + var f = 1; 1.142 + 1.143 + // 1-3 1.144 + checkForm(f++, "testpass"); 1.145 + checkForm(f++, "testpass"); 1.146 + checkForm(f++, "xxxxxxxx"); 1.147 + 1.148 + // 4-8 1.149 + checkForm(f++, "testuser", "testpass"); 1.150 + checkForm(f++, "testuser", "testpass"); 1.151 + checkForm(f++, "xxxxxxxx", ""); 1.152 + checkForm(f++, "", "testpass"); 1.153 + checkForm(f++, "", "xxxxxxxx"); 1.154 + 1.155 + // 9-14 1.156 + checkForm(f++, "testpass", ""); 1.157 + checkForm(f++, "", "testuser", "testpass"); 1.158 + checkForm(f++, "testuser", "testpass", ""); 1.159 + checkForm(f++, "testpass", "xxxxxxxx"); 1.160 + checkForm(f++, "xxxxxxxx", "testuser", "testpass"); 1.161 + checkForm(f++, "testuser", "testpass", "xxxxxxxx"); 1.162 + 1.163 + SimpleTest.finish(); 1.164 +} 1.165 + 1.166 + 1.167 +window.onload = startTest; 1.168 + 1.169 +SimpleTest.waitForExplicitFinish(); 1.170 +</script> 1.171 +</pre> 1.172 +</body> 1.173 +</html>