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