<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>Test for input events in Login Manager when username/password are filled in already</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <script type="text/javascript" src="../../../satchel/test/satchel_common.js"></script>
  <script type="text/javascript" src="pwmgr_common.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="onNewEvent(event)">
Login Manager test: input events should fire.

<script>
runChecksAfterCommonInit();

SimpleTest.requestFlakyTimeout("untriaged");

/** Test for Login Manager: form fill when form is already filled, should not get input events. **/

var onloadFired = false;

function onNewEvent(e) {
  console.error("Got " + e.type + " event.");
  if (e.type == "load") {
    onloadFired = true;
    getFormElementByName(1, "uname").focus();
    sendKey("Tab");
  } else {
    ok(false, "Got an input event for " + e.target.name + " field, which shouldn't happen.");
  }
}
</script>

<p id="display"></p>

<div id="content">

  <form id="form1" action="formtest.js">
    <p>This is form 1.</p>
    <input  type="text"       name="uname" oninput="onNewEvent(event)" value="testuser">
    <input  type="password"   name="pword" oninput="onNewEvent(event)" onfocus="setTimeout(function() { SimpleTest.finish() }, 1000);" value="testpass">

    <button type="submit">Submit</button>
    <button type="reset"> Reset </button>
  </form>

</div>
<pre id="test"></pre>
</body>
</html>
