toolkit/components/passwordmgr/test/test_basic_form_1pw.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:7c1424d4bd3f
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>Test for Login Manager</title>
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script type="text/javascript" src="pwmgr_common.js"></script>
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
8 </head>
9 <body>
10 Login Manager test: forms with 1 password field
11 <p id="display"></p>
12
13 <div id="content" style="display: none">
14
15 <!-- no username fields -->
16
17 <form id='form1' action='formtest.js'> 1
18 <!-- Blank, so fill in the password -->
19 <input type='password' name='pname' value=''>
20 <button type='submit'>Submit</button>
21 </form>
22
23 <form id='form2' action='formtest.js'> 2
24 <!-- Already contains the password, so nothing to do. -->
25 <input type='password' name='pname' value='testpass'>
26 <button type='submit'>Submit</button>
27 </form>
28
29 <form id='form3' action='formtest.js'> 3
30 <!-- Contains unknown password, so don't change it -->
31 <input type='password' name='pname' value='xxxxxxxx'>
32 <button type='submit'>Submit</button>
33 </form>
34
35
36 <!-- username fields -->
37
38 <form id='form4' action='formtest.js'> 4
39 <!-- Blanks, so fill in login -->
40 <input type='text' name='uname' value=''>
41 <input type='password' name='pname' value=''>
42 <button type='submit'>Submit</button>
43 </form>
44
45 <form id='form5' action='formtest.js'> 5
46 <!-- Username already set, so fill in password -->
47 <input type='text' name='uname' value='testuser'>
48 <input type='password' name='pname' value=''>
49 <button type='submit'>Submit</button>
50 </form>
51
52 <form id='form6' action='formtest.js'> 6
53 <!-- Unknown username, so don't fill in password -->
54 <input type='text' name='uname' value='xxxxxxxx'>
55 <input type='password' name='pname' value=''>
56 <button type='submit'>Submit</button>
57 </form>
58
59 <form id='form7' action='formtest.js'> 7
60 <!-- Password already set, could fill in username but that's weird so we don't -->
61 <input type='text' name='uname' value=''>
62 <input type='password' name='pname' value='testpass'>
63 <button type='submit'>Submit</button>
64 </form>
65
66 <form id='form8' action='formtest.js'> 8
67 <!-- Unknown password, so don't fill in a username -->
68 <input type='text' name='uname' value=''>
69 <input type='password' name='pname' value='xxxxxxxx'>
70 <button type='submit'>Submit</button>
71 </form>
72
73
74
75 <!-- extra text fields -->
76
77 <form id='form9' action='formtest.js'> 9
78 <!-- text field _after_ password should never be treated as a username field -->
79 <input type='password' name='pname' value=''>
80 <input type='text' name='uname' value=''>
81 <button type='submit'>Submit</button>
82 </form>
83
84 <form id='form10' action='formtest.js'> 10
85 <!-- only the first text field before the password should be for username -->
86 <input type='text' name='other' value=''>
87 <input type='text' name='uname' value=''>
88 <input type='password' name='pname' value=''>
89 <button type='submit'>Submit</button>
90 </form>
91
92 <form id='form11' action='formtest.js'> 11
93 <!-- variation just to make sure extra text field is still ignored -->
94 <input type='text' name='uname' value=''>
95 <input type='password' name='pname' value=''>
96 <input type='text' name='other' value=''>
97 <button type='submit'>Submit</button>
98 </form>
99
100
101
102 <!-- same as last bunch, but with xxxx in the extra field. -->
103
104 <form id='form12' action='formtest.js'> 12
105 <!-- text field _after_ password should never be treated as a username field -->
106 <input type='password' name='pname' value=''>
107 <input type='text' name='uname' value='xxxxxxxx'>
108 <button type='submit'>Submit</button>
109 </form>
110
111 <form id='form13' action='formtest.js'> 13
112 <!-- only the first text field before the password should be for username -->
113 <input type='text' name='other' value='xxxxxxxx'>
114 <input type='text' name='uname' value=''>
115 <input type='password' name='pname' value=''>
116 <button type='submit'>Submit</button>
117 </form>
118
119 <form id='form14' action='formtest.js'> 14
120 <!-- variation just to make sure extra text field is still ignored -->
121 <input type='text' name='uname' value=''>
122 <input type='password' name='pname' value=''>
123 <input type='text' name='other' value='xxxxxxxx'>
124 <button type='submit'>Submit</button>
125 </form>
126
127
128 </div>
129
130 <pre id="test">
131 <script class="testbody" type="text/javascript">
132
133 /** Test for Login Manager: simple form fill **/
134
135 commonInit();
136
137 function startTest() {
138 var f = 1;
139
140 // 1-3
141 checkForm(f++, "testpass");
142 checkForm(f++, "testpass");
143 checkForm(f++, "xxxxxxxx");
144
145 // 4-8
146 checkForm(f++, "testuser", "testpass");
147 checkForm(f++, "testuser", "testpass");
148 checkForm(f++, "xxxxxxxx", "");
149 checkForm(f++, "", "testpass");
150 checkForm(f++, "", "xxxxxxxx");
151
152 // 9-14
153 checkForm(f++, "testpass", "");
154 checkForm(f++, "", "testuser", "testpass");
155 checkForm(f++, "testuser", "testpass", "");
156 checkForm(f++, "testpass", "xxxxxxxx");
157 checkForm(f++, "xxxxxxxx", "testuser", "testpass");
158 checkForm(f++, "testuser", "testpass", "xxxxxxxx");
159
160 SimpleTest.finish();
161 }
162
163
164 window.onload = startTest;
165
166 SimpleTest.waitForExplicitFinish();
167 </script>
168 </pre>
169 </body>
170 </html>

mercurial