toolkit/components/passwordmgr/test/test_bug_242956.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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: 242956
michael@0 11 <p id="display"></p>
michael@0 12 <div id="content" style="display: none">
michael@0 13 <!-- pword is not a type=password input -->
michael@0 14 <form id="form1" action="formtest.js">
michael@0 15 <input type="text" name="uname">
michael@0 16 <input type="text" name="pword">
michael@0 17
michael@0 18 <button type="submit">Submit</button>
michael@0 19 <button type="reset"> Reset </button>
michael@0 20 </form>
michael@0 21
michael@0 22 <!-- uname is not a type=text input -->
michael@0 23 <form id="form2" action="formtest.js">
michael@0 24 <input type="password" name="uname">
michael@0 25 <input type="password" name="pword">
michael@0 26
michael@0 27 <button type="submit">Submit</button>
michael@0 28 <button type="reset"> Reset </button>
michael@0 29 </form>
michael@0 30
michael@0 31 <!-- two "pword" inputs, (text + password) -->
michael@0 32 <form id="form3" action="formtest.js">
michael@0 33 <input type="text" name="uname">
michael@0 34 <input type="text" name="pword">
michael@0 35 <input type="password" name="qword">
michael@0 36
michael@0 37 <button type="submit">Submit</button>
michael@0 38 <button type="reset"> Reset </button>
michael@0 39 </form>
michael@0 40
michael@0 41 <!-- same thing, different order -->
michael@0 42 <form id="form4" action="formtest.js">
michael@0 43 <input type="text" name="uname">
michael@0 44 <input type="password" name="pword">
michael@0 45 <input type="text" name="qword">
michael@0 46
michael@0 47 <button type="submit">Submit</button>
michael@0 48 <button type="reset"> Reset </button>
michael@0 49 </form>
michael@0 50
michael@0 51 <!-- uname is not a type=text input (try a checkbox just for variety) -->
michael@0 52 <form id="form5" action="formtest.js">
michael@0 53 <input type="checkbox" name="uname" value="">
michael@0 54 <input type="password" name="pword">
michael@0 55
michael@0 56 <button type="submit">Submit</button>
michael@0 57 <button type="reset"> Reset </button>
michael@0 58 </form>
michael@0 59
michael@0 60 <!-- pword is not a type=password input (try a checkbox just for variety) -->
michael@0 61 <form id="form6" action="formtest.js">
michael@0 62 <input type="text" name="uname">
michael@0 63 <input type="checkbox" name="pword" value="">
michael@0 64
michael@0 65 <button type="submit">Submit</button>
michael@0 66 <button type="reset"> Reset </button>
michael@0 67 </form>
michael@0 68
michael@0 69 <!-- pword is not a type=password input -->
michael@0 70 <form id="form7" action="formtest.js">
michael@0 71 <input type="text" name="uname" value="testuser">
michael@0 72 <input type="text" name="pword">
michael@0 73
michael@0 74 <button type="submit">Submit</button>
michael@0 75 <button type="reset"> Reset </button>
michael@0 76 </form>
michael@0 77
michael@0 78
michael@0 79 </div>
michael@0 80 <pre id="test">
michael@0 81 <script class="testbody" type="text/javascript">
michael@0 82
michael@0 83 /** Test for Login Manager: 242956 (Stored password is inserted into a
michael@0 84 readable text input on a second page) **/
michael@0 85 commonInit();
michael@0 86
michael@0 87 // Make sure that pwmgr only puts passwords into type=password <input>s.
michael@0 88 // Might as well test the converse, too (username in password field).
michael@0 89
michael@0 90 function startTest() {
michael@0 91 var form, input;
michael@0 92
michael@0 93 is($_(1, "uname").value, "", "Checking for unfilled username 1");
michael@0 94 is($_(1, "pword").value, "", "Checking for unfilled password 1");
michael@0 95
michael@0 96 is($_(2, "uname").value, "testpass", "Checking for password not username 2");
michael@0 97 is($_(2, "pword").value, "", "Checking for unfilled password 2");
michael@0 98
michael@0 99 is($_(3, "uname").value, "", "Checking for unfilled username 3");
michael@0 100 is($_(3, "pword").value, "testuser", "Checking for unfilled password 3");
michael@0 101 is($_(3, "qword").value, "testpass", "Checking for unfilled qassword 3");
michael@0 102
michael@0 103 is($_(4, "uname").value, "testuser", "Checking for password not username 4");
michael@0 104 is($_(4, "pword").value, "testpass", "Checking for unfilled password 4");
michael@0 105 is($_(4, "qword").value, "", "Checking for unfilled qassword 4");
michael@0 106
michael@0 107 is($_(5, "uname").value, "", "Checking for unfilled username 5");
michael@0 108 is($_(5, "pword").value, "testpass", "Checking for filled password 5");
michael@0 109
michael@0 110 is($_(6, "uname").value, "", "Checking for unfilled username 6");
michael@0 111 is($_(6, "pword").value, "", "Checking for unfilled password 6");
michael@0 112
michael@0 113 is($_(7, "uname").value, "testuser", "Checking for unmodified username 7");
michael@0 114 is($_(7, "pword").value, "", "Checking for unfilled password 7");
michael@0 115
michael@0 116
michael@0 117
michael@0 118 SimpleTest.finish();
michael@0 119 }
michael@0 120
michael@0 121 window.onload = startTest;
michael@0 122
michael@0 123 SimpleTest.waitForExplicitFinish();
michael@0 124
michael@0 125 </script>
michael@0 126 </pre>
michael@0 127 </body>
michael@0 128 </html>

mercurial