|
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: html5 input types (email, tel, url, etc.) |
|
11 <script> |
|
12 commonInit(); |
|
13 SimpleTest.waitForExplicitFinish(); |
|
14 |
|
15 const Ci = SpecialPowers.Ci; |
|
16 const Cc = SpecialPowers.Cc; |
|
17 pwmgr = Cc["@mozilla.org/login-manager;1"]. |
|
18 getService(Ci.nsILoginManager); |
|
19 |
|
20 login1 = Cc["@mozilla.org/login-manager/loginInfo;1"]. |
|
21 createInstance(Ci.nsILoginInfo); |
|
22 login2 = Cc["@mozilla.org/login-manager/loginInfo;1"]. |
|
23 createInstance(Ci.nsILoginInfo); |
|
24 login3 = Cc["@mozilla.org/login-manager/loginInfo;1"]. |
|
25 createInstance(Ci.nsILoginInfo); |
|
26 login4 = Cc["@mozilla.org/login-manager/loginInfo;1"]. |
|
27 createInstance(Ci.nsILoginInfo); |
|
28 |
|
29 login1.init("http://mochi.test:8888", "http://bug600551-1", null, |
|
30 "testuser@example.com", "testpass1", "", ""); |
|
31 login2.init("http://mochi.test:8888", "http://bug600551-2", null, |
|
32 "555-555-5555", "testpass2", "", ""); |
|
33 login3.init("http://mochi.test:8888", "http://bug600551-3", null, |
|
34 "http://mozilla.org", "testpass3", "", ""); |
|
35 login4.init("http://mochi.test:8888", "http://bug600551-4", null, |
|
36 "123456789", "testpass4", "", ""); |
|
37 |
|
38 pwmgr.addLogin(login1); |
|
39 pwmgr.addLogin(login2); |
|
40 pwmgr.addLogin(login3); |
|
41 pwmgr.addLogin(login4); |
|
42 </script> |
|
43 |
|
44 <p id="display"></p> |
|
45 <div id="content" style="display: none"> |
|
46 |
|
47 <form id="form1" action="http://bug600551-1"> |
|
48 <input type="email" name="uname"> |
|
49 <input type="password" name="pword"> |
|
50 <button type="submit">Submit</button> |
|
51 </form> |
|
52 |
|
53 <form id="form2" action="http://bug600551-2"> |
|
54 <input type="tel" name="uname"> |
|
55 <input type="password" name="pword"> |
|
56 <button type="submit">Submit</button> |
|
57 </form> |
|
58 |
|
59 <form id="form3" action="http://bug600551-3"> |
|
60 <input type="url" name="uname"> |
|
61 <input type="password" name="pword"> |
|
62 <button type="submit">Submit</button> |
|
63 </form> |
|
64 |
|
65 |
|
66 <form id="form4" action="http://bug600551-4"> |
|
67 <input type="number" name="uname"> |
|
68 <input type="password" name="pword"> |
|
69 <button type="submit">Submit</button> |
|
70 </form> |
|
71 |
|
72 <!-- The following forms should not be filled with usernames --> |
|
73 <form id="form5" action="formtest.js"> |
|
74 <input type="search" name="uname"> |
|
75 <input type="password" name="pword"> |
|
76 <button type="submit">Submit</button> |
|
77 </form> |
|
78 |
|
79 <form id="form6" action="formtest.js"> |
|
80 <input type="datetime" name="uname"> |
|
81 <input type="password" name="pword"> |
|
82 <button type="submit">Submit</button> |
|
83 </form> |
|
84 |
|
85 <form id="form7" action="formtest.js"> |
|
86 <input type="date" name="uname"> |
|
87 <input type="password" name="pword"> |
|
88 <button type="submit">Submit</button> |
|
89 </form> |
|
90 |
|
91 <form id="form8" action="formtest.js"> |
|
92 <input type="month" name="uname"> |
|
93 <input type="password" name="pword"> |
|
94 <button type="submit">Submit</button> |
|
95 </form> |
|
96 |
|
97 <form id="form9" action="formtest.js"> |
|
98 <input type="week" name="uname"> |
|
99 <input type="password" name="pword"> |
|
100 <button type="submit">Submit</button> |
|
101 </form> |
|
102 |
|
103 <form id="form10" action="formtest.js"> |
|
104 <input type="time" name="uname"> |
|
105 <input type="password" name="pword"> |
|
106 <button type="submit">Submit</button> |
|
107 </form> |
|
108 |
|
109 <form id="form11" action="formtest.js"> |
|
110 <input type="datetime-local" name="uname"> |
|
111 <input type="password" name="pword"> |
|
112 <button type="submit">Submit</button> |
|
113 </form> |
|
114 |
|
115 <form id="form12" action="formtest.js"> |
|
116 <input type="range" name="uname"> |
|
117 <input type="password" name="pword"> |
|
118 <button type="submit">Submit</button> |
|
119 </form> |
|
120 |
|
121 <form id="form13" action="formtest.js"> |
|
122 <input type="color" name="uname"> |
|
123 <input type="password" name="pword"> |
|
124 <button type="submit">Submit</button> |
|
125 </form> |
|
126 |
|
127 |
|
128 </div> |
|
129 <pre id="test"> |
|
130 <script class="testbody" type="text/javascript"> |
|
131 |
|
132 /* Test for Login Manager: 600551 |
|
133 (Password manager not working with input type=email) |
|
134 */ |
|
135 function startTest() { |
|
136 checkForm(1, "testuser@example.com", "testpass1"); |
|
137 checkForm(2, "555-555-5555", "testpass2"); |
|
138 checkForm(3, "http://mozilla.org", "testpass3"); |
|
139 checkForm(4, "123456789", "testpass4"); |
|
140 |
|
141 is($_(5, "uname").value, "", "type=search should not be considered a username"); |
|
142 |
|
143 is($_(6, "uname").value, "", "type=datetime should not be considered a username"); |
|
144 |
|
145 is($_(7, "uname").value, "", "type=date should not be considered a username"); |
|
146 |
|
147 is($_(8, "uname").value, "", "type=month should not be considered a username"); |
|
148 |
|
149 is($_(9, "uname").value, "", "type=week should not be considered a username"); |
|
150 |
|
151 is($_(10, "uname").value, "", "type=time should not be considered a username"); |
|
152 |
|
153 is($_(11, "uname").value, "", "type=datetime-local should not be considered a username"); |
|
154 |
|
155 is($_(12, "uname").value, "50", "type=range should not be considered a username"); |
|
156 |
|
157 is($_(13, "uname").value, "#000000", "type=color should not be considered a username"); |
|
158 |
|
159 pwmgr.removeLogin(login1); |
|
160 pwmgr.removeLogin(login2); |
|
161 pwmgr.removeLogin(login3); |
|
162 pwmgr.removeLogin(login4); |
|
163 |
|
164 SimpleTest.finish(); |
|
165 } |
|
166 |
|
167 window.onload = startTest; |
|
168 </script> |
|
169 </pre> |
|
170 </body> |
|
171 </html> |