toolkit/components/passwordmgr/test/test_bug_391514.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/passwordmgr/test/test_bug_391514.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,140 @@
     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: 391514
    1.14 +<p id="display"></p>
    1.15 +<div id="content" style="display: none">
    1.16 +  <!-- normal form. -->
    1.17 +  <form id="form1" action="formtest.js">
    1.18 +    <input  type="text"     name="uname">
    1.19 +    <input  type="password" name="pword">
    1.20 +
    1.21 +    <button type="submit">Submit</button>
    1.22 +    <button type="reset"> Reset </button>
    1.23 +  </form>
    1.24 +
    1.25 +  <!-- limited username -->
    1.26 +  <form id="form2" action="formtest.js">
    1.27 +    <input  type="text"     name="uname" maxlength="4">
    1.28 +    <input  type="password" name="pword">
    1.29 +  </form>
    1.30 +
    1.31 +  <!-- limited password -->
    1.32 +  <form id="form3" action="formtest.js">
    1.33 +    <input  type="text"     name="uname">
    1.34 +    <input  type="password" name="pword" maxlength="4">
    1.35 +  </form>
    1.36 +
    1.37 +  <!-- limited username and password -->
    1.38 +  <form id="form4" action="formtest.js">
    1.39 +    <input  type="text"     name="uname" maxlength="4">
    1.40 +    <input  type="password" name="pword" maxlength="4">
    1.41 +  </form>
    1.42 +
    1.43 +
    1.44 +  <!-- limited username -->
    1.45 +  <form id="form5" action="formtest.js">
    1.46 +    <input  type="text"     name="uname" maxlength="0">
    1.47 +    <input  type="password" name="pword">
    1.48 +  </form>
    1.49 +
    1.50 +  <!-- limited password -->
    1.51 +  <form id="form6" action="formtest.js">
    1.52 +    <input  type="text"     name="uname">
    1.53 +    <input  type="password" name="pword" maxlength="0">
    1.54 +  </form>
    1.55 +
    1.56 +  <!-- limited username and password -->
    1.57 +  <form id="form7" action="formtest.js">
    1.58 +    <input  type="text"     name="uname" maxlength="0">
    1.59 +    <input  type="password" name="pword" maxlength="0">
    1.60 +  </form>
    1.61 +
    1.62 +
    1.63 +  <!-- limited, but ok, username -->
    1.64 +  <form id="form8" action="formtest.js">
    1.65 +    <input  type="text"     name="uname" maxlength="999">
    1.66 +    <input  type="password" name="pword">
    1.67 +  </form>
    1.68 +
    1.69 +  <!-- limited, but ok, password -->
    1.70 +  <form id="form9" action="formtest.js">
    1.71 +    <input  type="text"     name="uname">
    1.72 +    <input  type="password" name="pword" maxlength="999">
    1.73 +  </form>
    1.74 +
    1.75 +  <!-- limited, but ok, username and password -->
    1.76 +  <form id="form10" action="formtest.js">
    1.77 +    <input  type="text"     name="uname" maxlength="999">
    1.78 +    <input  type="password" name="pword" maxlength="999">
    1.79 +  </form>
    1.80 +
    1.81 +
    1.82 +  <!-- limited, but ok, username -->
    1.83 +  <!-- (note that filled values are exactly 8 characters) -->
    1.84 +  <form id="form11" action="formtest.js">
    1.85 +    <input  type="text"     name="uname" maxlength="8">
    1.86 +    <input  type="password" name="pword">
    1.87 +  </form>
    1.88 +
    1.89 +  <!-- limited, but ok, password -->
    1.90 +  <!-- (note that filled values are exactly 8 characters) -->
    1.91 +  <form id="form12" action="formtest.js">
    1.92 +    <input  type="text"     name="uname">
    1.93 +    <input  type="password" name="pword" maxlength="8">
    1.94 +  </form>
    1.95 +
    1.96 +  <!-- limited, but ok, username and password -->
    1.97 +  <!-- (note that filled values are exactly 8 characters) -->
    1.98 +  <form id="form13" action="formtest.js">
    1.99 +    <input  type="text"     name="uname" maxlength="8">
   1.100 +    <input  type="password" name="pword" maxlength="8">
   1.101 +  </form>
   1.102 +
   1.103 +</div>
   1.104 +<pre id="test">
   1.105 +<script class="testbody" type="text/javascript">
   1.106 +
   1.107 +/* Test for Login Manager: 391514 (Login Manager gets confused with
   1.108 + * password/PIN on usaa.com)
   1.109 + */
   1.110 +
   1.111 +commonInit();
   1.112 +
   1.113 +function startTest() {
   1.114 +  var i;
   1.115 +
   1.116 +  is($_(1, "uname").value, "testuser", "Checking for filled username 1");
   1.117 +  is($_(1, "pword").value, "testpass", "Checking for filled password 1");
   1.118 +
   1.119 +  for (i = 2; i < 8; i++) {
   1.120 +    is($_(i, "uname").value, "", "Checking for unfilled username " + i);
   1.121 +    is($_(i, "pword").value, "", "Checking for unfilled password " + i);
   1.122 +  }
   1.123 +
   1.124 +  for (i = 8; i < 14; i++) {
   1.125 +    is($_(i, "uname").value, "testuser", "Checking for filled username " + i);
   1.126 +    is($_(i, "pword").value, "testpass", "Checking for filled password " + i);
   1.127 +  }
   1.128 +
   1.129 +  // Note that tests 11-13 are limited to exactly the expected value.
   1.130 +  // Assert this lest someone change the login we're testing with.
   1.131 +  is($_(11, "uname").value.length, 8, "asserting test assumption is valid.");
   1.132 +
   1.133 +  SimpleTest.finish();
   1.134 +}
   1.135 +
   1.136 +window.onload = startTest;
   1.137 +
   1.138 +SimpleTest.waitForExplicitFinish();
   1.139 +
   1.140 +</script>
   1.141 +</pre>
   1.142 +</body>
   1.143 +</html>

mercurial