Bug 1258055 - Enable a bunch of mochitest-plain password manager tests not involving UI for e10s. r=dolske
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Thu, 24 Mar 2016 21:56:59 -0400
changeset 290418 b903047d9572a456eed53377f12b24b1354c1135
parent 290417 5585f64b747d73ca4e677936cd528c3393f6df8f
child 290419 095be1660e1f5ba50f68feef4e0a74bcf0d4b6fa
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs1258055
milestone48.0a1
Bug 1258055 - Enable a bunch of mochitest-plain password manager tests not involving UI for e10s. r=dolske * Delete test_zzz_finish.html now that we always cleanup logins, disabled hosts and auth state. * Move test_autofill_before_load.html to mochitest/ since it doesn't need to be fixed (skip-if=true) * Use runInParent to add custom logins for some tests * Remove some cleanup functions that were just cleaning up DOM attributes since it's not necessary. MozReview-Commit-ID: 55vIzwfcPBB
toolkit/components/passwordmgr/test/auth2/authenticate.sjs
toolkit/components/passwordmgr/test/mochitest.ini
toolkit/components/passwordmgr/test/mochitest/auth2/authenticate.sjs
toolkit/components/passwordmgr/test/mochitest/mochitest.ini
toolkit/components/passwordmgr/test/mochitest/test_basic_form.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_0pw.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw_2.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_2pw_1.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_3pw_1.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_html5.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwevent.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwonly.html
toolkit/components/passwordmgr/test/mochitest/test_bug_776171.html
toolkit/components/passwordmgr/test/mochitest/test_form_action_1.html
toolkit/components/passwordmgr/test/mochitest/test_form_action_2.html
toolkit/components/passwordmgr/test/mochitest/test_form_action_javascript.html
toolkit/components/passwordmgr/test/mochitest/test_input_events.html
toolkit/components/passwordmgr/test/mochitest/test_input_events_for_identical_values.html
toolkit/components/passwordmgr/test/mochitest/test_maxlength.html
toolkit/components/passwordmgr/test/mochitest/test_passwords_in_type_password.html
toolkit/components/passwordmgr/test/mochitest/test_xhr_2.html
toolkit/components/passwordmgr/test/test_autofill_before_load.html
toolkit/components/passwordmgr/test/test_basic_form.html
toolkit/components/passwordmgr/test/test_basic_form_0pw.html
toolkit/components/passwordmgr/test/test_basic_form_1pw.html
toolkit/components/passwordmgr/test/test_basic_form_1pw_2.html
toolkit/components/passwordmgr/test/test_basic_form_2pw_1.html
toolkit/components/passwordmgr/test/test_basic_form_3pw_1.html
toolkit/components/passwordmgr/test/test_basic_form_html5.html
toolkit/components/passwordmgr/test/test_basic_form_pwevent.html
toolkit/components/passwordmgr/test/test_basic_form_pwonly.html
toolkit/components/passwordmgr/test/test_bug_776171.html
toolkit/components/passwordmgr/test/test_form_action_1.html
toolkit/components/passwordmgr/test/test_form_action_2.html
toolkit/components/passwordmgr/test/test_form_action_javascript.html
toolkit/components/passwordmgr/test/test_input_events.html
toolkit/components/passwordmgr/test/test_input_events_for_identical_values.html
toolkit/components/passwordmgr/test/test_maxlength.html
toolkit/components/passwordmgr/test/test_passwords_in_type_password.html
toolkit/components/passwordmgr/test/test_xhr_2.html
toolkit/components/passwordmgr/test/test_zzz_finish.html
--- a/toolkit/components/passwordmgr/test/mochitest.ini
+++ b/toolkit/components/passwordmgr/test/mochitest.ini
@@ -23,56 +23,32 @@ support-files =
   subtst_notifications_7.html
   subtst_notifications_8.html
   subtst_notifications_9.html
   subtst_privbrowsing_1.html
   subtst_privbrowsing_2.html
   subtst_privbrowsing_3.html
   subtst_privbrowsing_4.html
   subtst_prompt_async.html
-  auth2/authenticate.sjs
 
-[test_autofill_before_load.html]
-# This test doesn't pass because we can't ensure a cross-platform event that
-# occurs between DOMContentLoaded and Pageload
-skip-if = true
-[test_basic_form.html]
-[test_basic_form_0pw.html]
-[test_basic_form_1pw.html]
-[test_basic_form_1pw_2.html]
-[test_basic_form_2pw_1.html]
 [test_basic_form_2pw_2.html]
-[test_basic_form_3pw_1.html]
 [test_basic_form_autocomplete.html]
 skip-if = toolkit == 'android'
 [test_case_differences.html]
 skip-if = toolkit == 'android'
-[test_basic_form_html5.html]
-[test_basic_form_pwevent.html]
-[test_basic_form_pwonly.html]
 [test_bug_627616.html]
 skip-if = toolkit == 'android' #TIMED_OUT
-[test_bug_776171.html]
-[test_form_action_1.html]
-[test_form_action_2.html]
-[test_form_action_javascript.html]
-[test_input_events.html]
-[test_input_events_for_identical_values.html]
 [test_master_password.html]
 skip-if = toolkit == 'android' #TIMED_OUT
 [test_master_password_cleanup.html]
 skip-if = toolkit == 'android'
-[test_maxlength.html]
 [test_notifications.html]
 skip-if = toolkit == 'android'
 [test_notifications_popup.html]
 skip-if = os == "linux" || toolkit == 'android' # bug 934057
-[test_passwords_in_type_password.html]
 [test_prompt.html]
 skip-if = os == "linux" || toolkit == 'android' #TIMED_OUT
 [test_prompt_async.html]
 skip-if = toolkit == 'android' #TIMED_OUT
 [test_xhr.html]
 skip-if = toolkit == 'android' #TIMED_OUT
-[test_xhr_2.html]
 [test_xml_load.html]
 skip-if = toolkit == 'android' #TIMED_OUT
-[test_zzz_finish.html]
rename from toolkit/components/passwordmgr/test/auth2/authenticate.sjs
rename to toolkit/components/passwordmgr/test/mochitest/auth2/authenticate.sjs
--- a/toolkit/components/passwordmgr/test/mochitest/mochitest.ini
+++ b/toolkit/components/passwordmgr/test/mochitest/mochitest.ini
@@ -1,7 +1,27 @@
 [DEFAULT]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g'
 support-files =
+  ../authenticate.sjs
   ../pwmgr_common.js
+  auth2/authenticate.sjs
 
 [test_autofill_password-only.html]
+[test_basic_form.html]
+[test_basic_form_0pw.html]
+[test_basic_form_1pw.html]
+[test_basic_form_1pw_2.html]
+[test_basic_form_2pw_1.html]
+[test_basic_form_3pw_1.html]
+[test_basic_form_html5.html]
+[test_basic_form_pwevent.html]
+[test_basic_form_pwonly.html]
+[test_bug_776171.html]
+[test_form_action_1.html]
+[test_form_action_2.html]
+[test_form_action_javascript.html]
+[test_input_events.html]
+[test_input_events_for_identical_values.html]
+[test_maxlength.html]
+[test_passwords_in_type_password.html]
 [test_recipe_login_fields.html]
+[test_xhr_2.html]
rename from toolkit/components/passwordmgr/test/test_basic_form.html
rename to toolkit/components/passwordmgr/test/mochitest/test_basic_form.html
--- a/toolkit/components/passwordmgr/test/test_basic_form.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form.html
@@ -6,29 +6,26 @@
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: simple form fill
 
 <script>
-commonInit();
-SimpleTest.waitForExplicitFinish();
+runChecksAfterCommonInit(startTest);
 
 /** Test for Login Manager: form fill, multiple forms. **/
 
 function startTest() {
   is($_(1, "uname").value, "testuser", "Checking for filled username");
   is($_(1, "pword").value, "testpass", "Checking for filled password");
 
   SimpleTest.finish();
 }
-
-window.addEventListener("runTests", startTest);
 </script>
 
 <p id="display"></p>
 
 <div id="content" style="display: none">
 
   <form id="form1" action="formtest.js">
     <p>This is form 1.</p>
rename from toolkit/components/passwordmgr/test/test_basic_form_0pw.html
rename to toolkit/components/passwordmgr/test/mochitest/test_basic_form_0pw.html
--- a/toolkit/components/passwordmgr/test/test_basic_form_0pw.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_0pw.html
@@ -51,26 +51,22 @@ Login Manager test: forms with no passwo
 
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: form fill, no password fields. **/
 
-commonInit();
-
 function startTest() {
   is($_(3, "uname").value, "", "Checking for unfilled checkbox (form 3)");
   is($_(4, "yyyyy").value, "", "Checking for unfilled text field (form 4)");
   is($_(5, "uname").value, "", "Checking for unfilled text field (form 5)");
 
   SimpleTest.finish();
 }
 
-window.addEventListener("runTests", startTest);
-
-SimpleTest.waitForExplicitFinish();
+runChecksAfterCommonInit(startTest);
 </script>
 </pre>
 </body>
 </html>
 
rename from toolkit/components/passwordmgr/test/test_basic_form_1pw.html
rename to toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw.html
--- a/toolkit/components/passwordmgr/test/test_basic_form_1pw.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw.html
@@ -4,16 +4,19 @@
   <meta charset="utf-8">
   <title>Test autofill for forms with 1 password field</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: forms with 1 password field
+<script>
+runChecksAfterCommonInit(() => startTest());
+</script>
 <p id="display"></p>
 
 <div id="content" style="display: none">
 
 <!-- no username fields -->
 
 <form id='form1' action='formtest.js'> 1
     <!-- Blank, so fill in the password -->
@@ -134,18 +137,16 @@ Login Manager test: forms with 1 passwor
 
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: simple form fill **/
 
-commonInit();
-
 function startTest() {
     var f = 1;
 
     // 1-3
     checkForm(f++, "testpass");
     checkForm(f++, "testpass");
     checkForm(f++, "xxxxxxxx");
 
@@ -164,17 +165,12 @@ function startTest() {
     checkForm(f++, "xxxxxxxx", "testuser", "testpass");
     checkForm(f++, "testuser", "testpass", "xxxxxxxx");
 
     //15
     checkForm(f++, "testuser", "testpass");
 
     SimpleTest.finish();
 }
-
-
-window.addEventListener("runTests", startTest);
-
-SimpleTest.waitForExplicitFinish();
 </script>
 </pre>
 </body>
 </html>
rename from toolkit/components/passwordmgr/test/test_basic_form_1pw_2.html
rename to toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw_2.html
--- a/toolkit/components/passwordmgr/test/test_basic_form_1pw_2.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw_2.html
@@ -4,16 +4,19 @@
   <meta charset="utf-8">
   <title>Test forms with 1 password field, part 2</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: forms with 1 password field, part 2
+<script>
+runChecksAfterCommonInit(() => startTest());
+</script>
 <p id="display"></p>
 
 <div id="content" style="display: none">
 
 <form id='form1' action='formtest.js'> 1
     <input type='password' name='pname' value=''>
     <button type='submit'>Submit</button>
 </form>
@@ -78,36 +81,29 @@ Login Manager test: forms with 1 passwor
 
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: simple form fill, part 2 **/
 
-commonInit();
-
 function startTest() {
     var f;
 
     // Test various combinations of disabled/readonly inputs
     checkForm(1, "testpass"); // control
     checkUnmodifiedForm(2);
     checkUnmodifiedForm(3);
     checkForm(4, "testuser", "testpass"); // control
     for (f = 5;  f <= 8;  f++) { checkUnmodifiedForm(f); }
     // Test case-insensitive comparison of username field
     checkForm(9, "testuser", "testpass");
     checkForm(10, "TESTUSER", "testpass");
     checkForm(11, "TESTUSER", "testpass");
 
     SimpleTest.finish();
 }
-
-
-window.addEventListener("runTests", startTest);
-
-SimpleTest.waitForExplicitFinish();
 </script>
 </pre>
 </body>
 </html>
 
rename from toolkit/components/passwordmgr/test/test_basic_form_2pw_1.html
rename to toolkit/components/passwordmgr/test/mochitest/test_basic_form_2pw_1.html
--- a/toolkit/components/passwordmgr/test/test_basic_form_2pw_1.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_2pw_1.html
@@ -4,17 +4,19 @@
   <meta charset="utf-8">
   <title>Test autofill for forms with 2 password fields</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: forms with 2 password fields
-
+<script>
+runChecksAfterCommonInit(() => startTest());
+</script>
 <p id="display"></p>
 
 <div id="content" style="display: none">
 
 
 <!-- no username fields -->
 
 <form id='form1' action='formtest.js'> 1
@@ -149,18 +151,16 @@ Login Manager test: forms with 2 passwor
 
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: simple form fill **/
 
-commonInit();
-
 function startTest() {
     var f = 1;
 
     // 1-6 no username
     checkForm(f++, "testpass", "");
     checkForm(f++, "testpass", "");
     checkForm(f++, "testpass", "", "");
     checkForm(f++, "testpass", "");
@@ -176,17 +176,12 @@ function startTest() {
     checkForm(f++, "testuser", "testpass", "xxxxxxxx");
     checkForm(f++, "testuser", "testpass", "");
     checkForm(f++, "",         "xxxxxxxx", "testpass");
     checkForm(f++, "testpass", "",         "");
     checkForm(f++, "xxxxxxxx", "",         "");
 
     SimpleTest.finish();
 }
-
-
-window.addEventListener("runTests", startTest);
-
-SimpleTest.waitForExplicitFinish();
 </script>
 </pre>
 </body>
 </html>
rename from toolkit/components/passwordmgr/test/test_basic_form_3pw_1.html
rename to toolkit/components/passwordmgr/test/mochitest/test_basic_form_3pw_1.html
--- a/toolkit/components/passwordmgr/test/test_basic_form_3pw_1.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_3pw_1.html
@@ -4,16 +4,19 @@
   <meta charset="utf-8">
   <title>Test autofill for forms with 3 password fields</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: forms with 3 password fields (form filling)
+<script>
+runChecksAfterCommonInit(() => startTest());
+</script>
 <p id="display"></p>
 
 <div id="content" style="display: none">
   <p>The next three forms are <b>user/pass/passB/passC</b>, as all-empty, preuser(only), and preuser/pass</p>
   <form id="form1" action="formtest.js">
     <input  type="text"       name="uname">
     <input  type="password"   name="pword">
     <input  type="password"   name="qword">
@@ -107,18 +110,16 @@ Login Manager test: forms with 3 passwor
   </form>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: form fill, 3 password fields **/
 
-commonInit();
-
 // Test to make sure 3-password forms are filled properly.
 
 function startTest() {
   // Check form 1
   is($_(1, "uname").value, "testuser", "Checking username 1");
   is($_(1, "pword").value, "testpass", "Checking password 1");
   is($_(1, "qword").value, "",         "Checking password 1 (q)");
   is($_(1, "rword").value, "",         "Checking password 1 (r)");
@@ -164,17 +165,13 @@ function startTest() {
   todo_is($_(9, "qword").value, "",         "Checking password 9 (q)");
   is($_(9, "rword").value, "",         "Checking password 9 (r)");
   is($_(9, "pword").value, "testpass", "Checking password 9");
 
   // TODO: as with the 2-password cases, add tests to check for creating new
   // logins and changing passwords.
   SimpleTest.finish();
 }
-
-window.addEventListener("runTests", startTest);
-
-SimpleTest.waitForExplicitFinish();
 </script>
 </pre>
 </body>
 </html>
 
rename from toolkit/components/passwordmgr/test/test_basic_form_html5.html
rename to toolkit/components/passwordmgr/test/mochitest/test_basic_form_html5.html
--- a/toolkit/components/passwordmgr/test/test_basic_form_html5.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_html5.html
@@ -5,46 +5,46 @@
   <title>Test for html5 input types (email, tel, url, etc.)</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: html5 input types (email, tel, url, etc.)
 <script>
-commonInit();
-SimpleTest.waitForExplicitFinish();
+runChecksAfterCommonInit(() => startTest());
 
-const Ci = SpecialPowers.Ci;
-const Cc = SpecialPowers.Cc;
-pwmgr = Cc["@mozilla.org/login-manager;1"].
-        getService(Ci.nsILoginManager);
+runInParent(function setup() {
+  const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
+  let pwmgr = Cc["@mozilla.org/login-manager;1"].
+              getService(Ci.nsILoginManager);
 
-login1  = Cc["@mozilla.org/login-manager/loginInfo;1"].
+  login1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
            createInstance(Ci.nsILoginInfo);
-login2  = Cc["@mozilla.org/login-manager/loginInfo;1"].
+  login2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
            createInstance(Ci.nsILoginInfo);
-login3  = Cc["@mozilla.org/login-manager/loginInfo;1"].
+  login3 = Cc["@mozilla.org/login-manager/loginInfo;1"].
            createInstance(Ci.nsILoginInfo);
-login4  = Cc["@mozilla.org/login-manager/loginInfo;1"].
+  login4 = Cc["@mozilla.org/login-manager/loginInfo;1"].
            createInstance(Ci.nsILoginInfo);
 
-login1.init("http://mochi.test:8888", "http://bug600551-1", null,
-            "testuser@example.com", "testpass1", "", "");
-login2.init("http://mochi.test:8888", "http://bug600551-2", null,
-            "555-555-5555", "testpass2", "", "");
-login3.init("http://mochi.test:8888", "http://bug600551-3", null,
-            "http://mozilla.org", "testpass3", "", "");
-login4.init("http://mochi.test:8888", "http://bug600551-4", null,
-            "123456789", "testpass4", "", "");
+  login1.init("http://mochi.test:8888", "http://bug600551-1", null,
+              "testuser@example.com", "testpass1", "", "");
+  login2.init("http://mochi.test:8888", "http://bug600551-2", null,
+              "555-555-5555", "testpass2", "", "");
+  login3.init("http://mochi.test:8888", "http://bug600551-3", null,
+              "http://mozilla.org", "testpass3", "", "");
+  login4.init("http://mochi.test:8888", "http://bug600551-4", null,
+              "123456789", "testpass4", "", "");
 
-pwmgr.addLogin(login1);
-pwmgr.addLogin(login2);
-pwmgr.addLogin(login3);
-pwmgr.addLogin(login4);
+  pwmgr.addLogin(login1);
+  pwmgr.addLogin(login2);
+  pwmgr.addLogin(login3);
+  pwmgr.addLogin(login4);
+});
 </script>
 
 <p id="display"></p>
 <div id="content" style="display: none">
 
   <form id="form1" action="http://bug600551-1">
     <input  type="email"    name="uname">
     <input  type="password" name="pword">
@@ -151,21 +151,14 @@ function startTest() {
   is($_(10, "uname").value, "", "type=time should not be considered a username");
 
   is($_(11, "uname").value, "", "type=datetime-local should not be considered a username");
 
   is($_(12, "uname").value, "50", "type=range should not be considered a username");
 
   is($_(13, "uname").value, "#000000", "type=color should not be considered a username");
 
-  pwmgr.removeLogin(login1);
-  pwmgr.removeLogin(login2);
-  pwmgr.removeLogin(login3);
-  pwmgr.removeLogin(login4);
-
   SimpleTest.finish();
 }
-
-window.addEventListener("runTests", startTest);
 </script>
 </pre>
 </body>
 </html>
rename from toolkit/components/passwordmgr/test/test_basic_form_pwevent.html
rename to toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwevent.html
--- a/toolkit/components/passwordmgr/test/test_basic_form_pwevent.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwevent.html
@@ -7,50 +7,45 @@ https://bugzilla.mozilla.org/show_bug.cg
   <meta charset="utf-8"/>
   <title>Test for Bug 355063</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <script type="application/javascript">
   /** Test for Bug 355063 **/
 
-  function startTest() {
+  runChecksAfterCommonInit(function startTest() {
     info("startTest");
     // Password Manager's own listener should always have been added first, so
     // the test's listener should be called after the pwmgr's listener fills in
     // a login.
     //
     SpecialPowers.addChromeEventListener("DOMFormHasPassword", function eventFired() {
       SpecialPowers.removeChromeEventListener("DOMFormHasPassword", eventFired);
       var passField = $("p1");
       passField.addEventListener("input", checkForm);
     });
     addForm();
-  }
+  });
 
   function addForm() {
     info("addForm");
     var c = document.getElementById("content");
     c.innerHTML = "<form id=form1>form1: <input id=u1><input type=password id=p1></form><br>";
   }
 
   function checkForm() {
     info("checkForm");
     var userField = document.getElementById("u1");
     var passField = document.getElementById("p1");
     is(userField.value, "testuser", "checking filled username");
     is(passField.value, "testpass", "checking filled password");
 
     SimpleTest.finish();
   }
-
-  commonInit();
-
-  window.addEventListener("runTests", startTest);
-  SimpleTest.waitForExplicitFinish();
 </script>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=355063">Mozilla Bug 355063</a>
 <p id="display"></p>
 <div id="content">
 forms go here!
 </div>
rename from toolkit/components/passwordmgr/test/test_basic_form_pwonly.html
rename to toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwonly.html
--- a/toolkit/components/passwordmgr/test/test_basic_form_pwonly.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwonly.html
@@ -5,47 +5,43 @@
   <title>Test forms and logins without a username</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: forms and logins without a username.
 <script>
-commonInit();
-SimpleTest.waitForExplicitFinish();
-
-var pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"]
-                         .getService(SpecialPowers.Ci.nsILoginManager);
+runChecksAfterCommonInit(() => startTest());
+runInParent(() => {
+  const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
+  var pwmgr = Cc["@mozilla.org/login-manager;1"]
+              .getService(Ci.nsILoginManager);
 
-var nsLoginInfo = new SpecialPowers.wrap(SpecialPowers.Components).Constructor("@mozilla.org/login-manager/loginInfo;1", SpecialPowers.Ci.nsILoginInfo);
-ok(nsLoginInfo != null, "nsLoginInfo constructor");
+  var nsLoginInfo = Components.Constructor("@mozilla.org/login-manager/loginInfo;1", Ci.nsILoginInfo);
 
-// pwlogin1 uses a unique formSubmitURL, to check forms where no other logins
-// will apply. pwlogin2 uses the normal formSubmitURL, so that we can test
-// forms with a mix of username and non-username logins that might apply.
-//
-// Note: pwlogin2 is deleted at the end of the test.
+  // pwlogin1 uses a unique formSubmitURL, to check forms where no other logins
+  // will apply. pwlogin2 uses the normal formSubmitURL, so that we can test
+  // forms with a mix of username and non-username logins that might apply.
+  //
+  // Note: pwlogin2 is deleted at the end of the test.
 
-pwlogin1 = new nsLoginInfo();
-pwlogin2 = new nsLoginInfo();
+  pwlogin1 = new nsLoginInfo();
+  pwlogin2 = new nsLoginInfo();
 
-pwlogin1.init("http://mochi.test:8888", "http://mochi.test:1111", null,
-    "", "1234", "uname", "pword");
+  pwlogin1.init("http://mochi.test:8888", "http://mochi.test:1111", null,
+                "", "1234", "uname", "pword");
 
-pwlogin2.init("http://mochi.test:8888", "http://mochi.test:8888", null,
-    "", "1234", "uname", "pword");
+  pwlogin2.init("http://mochi.test:8888", "http://mochi.test:8888", null,
+                "", "1234", "uname", "pword");
+
 
-try {
-    pwmgr.addLogin(pwlogin1);
-    pwmgr.addLogin(pwlogin2);
-} catch (e) {
-    ok(false, "addLogin threw: " + e);
-}
-
+  pwmgr.addLogin(pwlogin1);
+  pwmgr.addLogin(pwlogin2);
+});
 </script>
 <p id="display"></p>
 
 <div id="content" style="display: none">
 
 
 <!-- simple form: no username field, 1 password field -->
 <form id='form1' action='http://mochi.test:1111/formtest.js'> 1
@@ -203,18 +199,15 @@ function startTest() {
 
     checkForm(9, "", "1234");
     checkForm(10, "", "1234");
     checkForm(11, "", "1234");
 
     checkUnmodifiedForm(12);
     checkUnmodifiedForm(13);
 
-    pwmgr.removeLogin(pwlogin2);
     SimpleTest.finish();
 }
-
-window.addEventListener("runTests", startTest);
 </script>
 </pre>
 </body>
 </html>
 
rename from toolkit/components/passwordmgr/test/test_bug_776171.html
rename to toolkit/components/passwordmgr/test/mochitest/test_bug_776171.html
--- a/toolkit/components/passwordmgr/test/test_bug_776171.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_bug_776171.html
@@ -2,74 +2,55 @@
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=776171
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 776171 related to HTTP auth</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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="startTest()">
 <script class="testbody" type="text/javascript">
 
 /**
  * This test checks we correctly ignore authentication entry
  * for a subpath and use creds from the URL when provided when XHR
  * is used with filled user name and password.
  *
- * 1. connect auth2/authenticate.sjs that excepts user1:pass1 password
+ * 1. connect auth2/authenticate.sjs that expects user1:pass1 password
  * 2. connect a dummy URL at the same path
  * 3. connect authenticate.sjs that again expects user1:pass1 password
  *    in this case, however, we have an entry without an identity
  *    for this path (that is a parent for auth2 path in the first step)
  */
 
 SimpleTest.waitForExplicitFinish();
 
-function clearAuthCache()
-{
-  var authMgr = SpecialPowers.Cc['@mozilla.org/network/http-auth-manager;1']
-                             .getService(SpecialPowers.Ci.nsIHttpAuthManager);
-  authMgr.clearAll();
-}
-
-function doxhr(URL, user, pass, next)
-{
+function doxhr(URL, user, pass, next) {
   var xhr = new XMLHttpRequest();
   if (user && pass)
     xhr.open("POST", URL, true, user, pass);
   else
     xhr.open("POST", URL, true);
-  xhr.onload = function()
-  {
+  xhr.onload = function() {
     is(xhr.status, 200, "Got status 200");
     next();
   }
-  xhr.onerror = function()
-  {
+  xhr.onerror = function() {
     ok(false, "request passed");
     finishTest();
   }
   xhr.send();
 }
 
-function startTest()
-{
-  clearAuthCache();
+function startTest() {
   doxhr("auth2/authenticate.sjs?user=user1&pass=pass1&realm=realm1", "user1", "pass1", function() {
     doxhr("auth2", null, null, function() {
-      doxhr("authenticate.sjs?user=user1&pass=pass1&realm=realm1", "user1", "pass1", finishTest);
+      doxhr("authenticate.sjs?user=user1&pass=pass1&realm=realm1", "user1", "pass1", SimpleTest.finish);
     });
   });
 }
-
-function finishTest()
-{
-  clearAuthCache();
-  SimpleTest.finish();
-}
-
 </script>
 </body>
 </html>
-
rename from toolkit/components/passwordmgr/test/test_form_action_1.html
rename to toolkit/components/passwordmgr/test/mochitest/test_form_action_1.html
--- a/toolkit/components/passwordmgr/test/test_form_action_1.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_form_action_1.html
@@ -4,16 +4,19 @@
   <meta charset="utf-8">
   <title>Test for considering form action</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: Bug 360493
+<script>
+runChecksAfterCommonInit(() => startTest());
+</script>
 <p id="display"></p>
 <div id="content" style="display: none">
 
   <!-- normal form with normal relative action. -->
   <form id="form1" action="formtest.js">
     <input  type="text"       name="uname">
     <input  type="password"   name="pword">
 
@@ -109,33 +112,26 @@ Login Manager test: Bug 360493
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: 360493 (Cross-Site Forms + Password
     Manager = Security Failure) **/
 
 // This test is designed to make sure variations on the form's |action|
 // and |method| continue to work with the fix for 360493.
 
-commonInit();
-
 function startTest() {
   for (var i = 1; i <= 9; i++) {
     // Check form i
     is($_(i, "uname").value, "testuser", "Checking for filled username " + i);
     is($_(i, "pword").value, "testpass", "Checking for filled password " + i);
   }
 
   // The login's formSubmitURL isn't "javascript:", so don't fill it in.
   isnot($_(10, "uname"), "testuser", "Checking username w/ JS action URL");
   isnot($_(10, "pword"), "testpass", "Checking password w/ JS action URL");
 
   SimpleTest.finish();
 }
-
-window.addEventListener("runTests", startTest);
-
-SimpleTest.waitForExplicitFinish();
-
 </script>
 </pre>
 </body>
 </html>
 
rename from toolkit/components/passwordmgr/test/test_form_action_2.html
rename to toolkit/components/passwordmgr/test/mochitest/test_form_action_2.html
--- a/toolkit/components/passwordmgr/test/test_form_action_2.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_form_action_2.html
@@ -1,19 +1,22 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <meta charset"utf-8">
+  <meta charset="utf-8">
   <title>Test for considering form action</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: Bug 360493
+<script>
+runChecksAfterCommonInit(() => startTest());
+</script>
 <p id="display"></p>
 <div id="content" style="display: none">
 
   <!-- The tests in this page exercise things that shouldn't work. -->
 
   <!-- Change port # of action URL from 8888 to 7777 -->
   <form id="form1" action="http://localhost:7777/tests/toolkit/components/passwordmgr/test/formtest.js">
     <input  type="text"       name="uname">
@@ -126,18 +129,16 @@ Login Manager test: Bug 360493
 <!-- TODO: foo.site.com vs. bar.site.com? -->
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: 360493 (Cross-Site Forms + Password Manager = Security Failure) **/
 
-commonInit();
-
 function startTest() {
   for (var i = 1; i <= 8; i++) {
     // Check form i
     is($_(i, "uname").value, "", "Checking for unfilled username " + i);
     is($_(i, "pword").value, "", "Checking for unfilled password " + i);
   }
 
   is($_(9, "uname").value, "testuser", "Checking for unmodified username 9");
@@ -161,18 +162,13 @@ function startTest() {
   // If the test finds extra forms the submit() causes the test to timeout, then
   // there may be a security issue.
   is(document.forms.length,  11,  "Checking for unexpected forms");
   $("neutered_submit10").click();
   $("neutered_submit11").click();
 
   SimpleTest.finish();
 }
-
-window.addEventListener("runTests", startTest);
-
-SimpleTest.waitForExplicitFinish();
-
 </script>
 </pre>
 </body>
 </html>
 
rename from toolkit/components/passwordmgr/test/test_form_action_javascript.html
rename to toolkit/components/passwordmgr/test/mochitest/test_form_action_javascript.html
--- a/toolkit/components/passwordmgr/test/test_form_action_javascript.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_form_action_javascript.html
@@ -5,40 +5,35 @@
   <title>Test forms with a JS submit action</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: form with JS submit action
 <script>
-SimpleTest.waitForExplicitFinish();
+runChecksAfterCommonInit(() => startTest());
 
-// Note: Call this first so it doesn't override our login.
-commonInit();
+runInParent(function setup() {
+  const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
+  Cu.import("resource://gre/modules/Services.jsm");
 
-var pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"]
-                         .getService(SpecialPowers.Ci.nsILoginManager);
-var jslogin = SpecialPowers.Cc["@mozilla.org/login-manager/loginInfo;1"]
-                           .createInstance(SpecialPowers.Ci.nsILoginInfo);
-jslogin.init("http://mochi.test:8888", "javascript:", null,
+  let jslogin = Cc["@mozilla.org/login-manager/loginInfo;1"].createInstance(Ci.nsILoginInfo);
+  jslogin.init("http://mochi.test:8888", "javascript:", null,
               "jsuser", "jspass123", "uname", "pword");
-pwmgr.addLogin(jslogin);
+  Services.logins.addLogin(jslogin);
+});
 
 /** Test for Login Manager: JS action URL **/
 
 function startTest() {
     checkForm(1, "jsuser", "jspass123");
 
-    pwmgr.removeLogin(jslogin);
     SimpleTest.finish();
 }
-
-// XXX
-window.addEventListener("runTests", startTest);
 </script>
 
 <p id="display"></p>
 
 <div id="content" style="display: none">
 
 
 <form id='form1' action='javascript:alert("never shows")'> 1
rename from toolkit/components/passwordmgr/test/test_input_events.html
rename to toolkit/components/passwordmgr/test/mochitest/test_input_events.html
--- a/toolkit/components/passwordmgr/test/test_input_events.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_input_events.html
@@ -6,18 +6,18 @@
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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>
-commonInit();
-SimpleTest.waitForExplicitFinish();
+runChecksAfterCommonInit();
+
 SimpleTest.requestFlakyTimeout("untriaged");
 
 /** Test for Login Manager: form fill, should get input events. **/
 
 var usernameInputFired = false;
 var passwordInputFired = false;
 var usernameChangeFired = false;
 var passwordChangeFired = false;
rename from toolkit/components/passwordmgr/test/test_input_events_for_identical_values.html
rename to toolkit/components/passwordmgr/test/mochitest/test_input_events_for_identical_values.html
--- a/toolkit/components/passwordmgr/test/test_input_events_for_identical_values.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_input_events_for_identical_values.html
@@ -7,41 +7,34 @@
   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.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>
-commonInit();
-SimpleTest.waitForExplicitFinish();
+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;
     $_(1, "uname").focus();
     sendKey("Tab");
   } else {
     ok(false, "Got an input event for " + e.target.name + " field, which shouldn't happen.");
   }
 }
-
-SimpleTest.registerCleanupFunction(function cleanup() {
-  $_(1, "uname").removeAttribute("oninput");
-  $_(1, "pword").removeAttribute("onfocus");
-  $_(1, "pword").removeAttribute("oninput");
-  document.body.removeAttribute("onload");
-});
 </script>
 
 <p id="display"></p>
 
 <div id="content">
 
   <form id="form1" action="formtest.js">
     <p>This is form 1.</p>
rename from toolkit/components/passwordmgr/test/test_maxlength.html
rename to toolkit/components/passwordmgr/test/mochitest/test_maxlength.html
--- a/toolkit/components/passwordmgr/test/test_maxlength.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_maxlength.html
@@ -4,16 +4,19 @@
   <meta charset="utf-8">
   <title>Test for maxlength attributes</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: Bug 391514
+<script>
+runChecksAfterCommonInit(() => startTest());
+</script>
 <p id="display"></p>
 <div id="content" style="display: none">
   <!-- normal form. -->
   <form id="form1" action="formtest.js">
     <input  type="text"     name="uname">
     <input  type="password" name="pword">
 
     <button type="submit">Submit</button>
@@ -101,18 +104,16 @@ Login Manager test: Bug 391514
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /* Test for Login Manager: 391514 (Login Manager gets confused with
  * password/PIN on usaa.com)
  */
 
-commonInit();
-
 function startTest() {
   var i;
 
   is($_(1, "uname").value, "testuser", "Checking for filled username 1");
   is($_(1, "pword").value, "testpass", "Checking for filled password 1");
 
   for (i = 2; i < 8; i++) {
     is($_(i, "uname").value, "", "Checking for unfilled username " + i);
@@ -125,17 +126,12 @@ function startTest() {
   }
 
   // Note that tests 11-13 are limited to exactly the expected value.
   // Assert this lest someone change the login we're testing with.
   is($_(11, "uname").value.length, 8, "asserting test assumption is valid.");
 
   SimpleTest.finish();
 }
-
-window.addEventListener("runTests", startTest);
-
-SimpleTest.waitForExplicitFinish();
-
 </script>
 </pre>
 </body>
 </html>
rename from toolkit/components/passwordmgr/test/test_passwords_in_type_password.html
rename to toolkit/components/passwordmgr/test/mochitest/test_passwords_in_type_password.html
--- a/toolkit/components/passwordmgr/test/test_passwords_in_type_password.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_passwords_in_type_password.html
@@ -4,16 +4,19 @@
   <meta charset="utf-8">
   <title>Test that passwords only get filled in type=password</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="pwmgr_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: Bug 242956
+<script>
+runChecksAfterCommonInit(() => startTest());
+</script>
 <p id="display"></p>
 <div id="content" style="display: none">
   <!-- pword is not a type=password input -->
   <form id="form1" action="formtest.js">
     <input  type="text" name="uname">
     <input  type="text" name="pword">
 
     <button type="submit">Submit</button>
@@ -78,17 +81,16 @@ Login Manager test: Bug 242956
 
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: 242956 (Stored password is inserted into a
     readable text input on a second page) **/
-commonInit();
 
 // Make sure that pwmgr only puts passwords into type=password <input>s.
 // Might as well test the converse, too (username in password field).
 
 function startTest() {
   var form, input;
 
   is($_(1, "uname").value, "", "Checking for unfilled username 1");
@@ -109,21 +111,14 @@ function startTest() {
   is($_(5, "pword").value, "testpass", "Checking for filled password 5");
 
   is($_(6, "uname").value, "", "Checking for unfilled username 6");
   is($_(6, "pword").value, "", "Checking for unfilled password 6");
 
   is($_(7, "uname").value, "testuser", "Checking for unmodified username 7");
   is($_(7, "pword").value, "",         "Checking for unfilled password 7");
 
-
-
   SimpleTest.finish();
 }
-
-window.addEventListener("runTests", startTest);
-
-SimpleTest.waitForExplicitFinish();
-
 </script>
 </pre>
 </body>
 </html>
rename from toolkit/components/passwordmgr/test/test_xhr_2.html
rename to toolkit/components/passwordmgr/test/mochitest/test_xhr_2.html
--- a/toolkit/components/passwordmgr/test/test_xhr_2.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_xhr_2.html
@@ -2,70 +2,54 @@
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=654348
 -->
 <head>
   <meta charset="utf-8">
   <title>Test XHR auth with user and pass arguments</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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="startTest()">
 <script class="testbody" type="text/javascript">
 
 /**
  * This test checks we correctly ignore authentication entry
  * for a subpath and use creds from the URL when provided when XHR
  * is used with filled user name and password.
  *
  * 1. connect authenticate.sjs that excepts user1:pass1 password
  * 2. connect authenticate.sjs that this time expects differentuser2:pass2 password
  *    we must use the creds that are provided to the xhr witch are different and expected
  */
 
-SimpleTest.waitForExplicitFinish();
-
-function clearAuthCache()
-{
-  var authMgr = SpecialPowers.Cc['@mozilla.org/network/http-auth-manager;1']
-                             .getService(SpecialPowers.Ci.nsIHttpAuthManager);
-  authMgr.clearAll();
-}
-
-function doxhr(URL, user, pass, code, next)
-{
+function doxhr(URL, user, pass, code, next) {
   var xhr = new XMLHttpRequest();
   if (user && pass)
     xhr.open("POST", URL, true, user, pass);
   else
     xhr.open("POST", URL, true);
-  xhr.onload = function()
-  {
+  xhr.onload = function() {
     is(xhr.status, code, "expected response code " + code);
     next();
   }
-  xhr.onerror = function()
-  {
+  xhr.onerror = function() {
     ok(false, "request passed");
     finishTest();
   }
   xhr.send();
 }
 
-function startTest()
-{
-  clearAuthCache();
+function startTest() {
   doxhr("authenticate.sjs?user=dummy&pass=pass1&realm=realm1&formauth=1", "dummy", "dummy", 403, function() {
     doxhr("authenticate.sjs?user=dummy&pass=pass1&realm=realm1&formauth=1", "dummy", "pass1", 200, finishTest);
   });
 }
 
-function finishTest()
-{
-  clearAuthCache();
+function finishTest() {
   SimpleTest.finish();
 }
 
 </script>
 </body>
 </html>
-
deleted file mode 100644
--- a/toolkit/components/passwordmgr/test/test_autofill_before_load.html
+++ /dev/null
@@ -1,96 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test for filling before the load event</title>
-  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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="endTest();">
-Login Manager test: Bug 221634
-<p id="display"></p>
-<div id="content" style="display: none">
-
-  <form id="form1" action="formtest.js">
-    <input  type="text"       name="uname">
-    <input  type="password"   name="pword">
-
-    <button type="submit">Submit</button>
-    <button type="reset"> Reset</button>
-  </form>
-
-  <img onload="performTest();" src="mlogosm.gif">
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Login Manager: 221634 (password manager needs to fill in forms before the page finishes loading) **/
-commonInit();
-
-var dclHappened      = false;
-var testHappened     = false;
-var pageloadHappened = false;
-
-// We're still loading the page, so make sure nothing has filled in yet.
-is($_(1, "uname").value, "", "Checking unfilled username 1");
-is($_(1, "pword").value, "", "Checking unfilled password 1");
-
-document.addEventListener("DOMContentLoaded", contentLoaded, false);
-
-SimpleTest.waitForExplicitFinish();
-
-
-// Step 1 - Fires at DOMContentLoaded
-function contentLoaded() {
-  ok(!testHappened,     "Sanity check to ensure test hasn't happened yet.")
-  ok(!pageloadHappened, "Sanity check to ensure pageload hasn't happened yet.")
-
-  // We're in DOMContentLoaded, so the pwmgr may or may not have filled in yet.
-
-  // Set a 0-second timeout, which should execute before the pageload event.
-  // setTimeout(reallyDoTest, 0);
-  // ha-ha... That doesn't work. The pageload event comes first, although
-  // it can be hacked into working by adding <img src="404_non_existent_file.gif">
-
-  dclHappened = true;
-}
-
-// Step 2 - Fires when the image loads, which should be immediately after DOMContentLoaded (but before pageload)
-function performTest() {
-  ok(dclHappened,       "Sanity check to make sure DOMContentLoaded already happened");
-  ok(!pageloadHappened, "Sanity check to ensure pageload hasn't happened yet.")
-
-  // Check form1
-  is($_(1, "uname").value, "testuser", "Checking filled username");
-  is($_(1, "pword").value, "testpass", "Checking filled password");
-
-  testHappened = true;
-}
-
-// Step 3 - Fired by |body| onload.
-function endTest() {
-  ok(dclHappened, "Sanity check to make sure DOMContentLoaded already happened");
-  ok(testHappened, "Sanity check to make sure our test ran before pageload");
-
-  // Check form1
-  is($_(1, "uname").value, "testuser", "Rechecking filled username");
-  is($_(1, "pword").value, "testpass", "Rechecking filled password");
-
-  pageloadHappened = true;
-
-  // Make sure the expected number of tests (for this page) have run.
-  // If the event execution gets out of order, only a subset get counted.
-  // (Although there should still be other failures... Belt-n-suspenders!)
-  is(SimpleTest._tests.length, 12, "expected number of executed tests");
-
-  SimpleTest.finish();
-}
-
-</script>
-
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/toolkit/components/passwordmgr/test/test_zzz_finish.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test finalization for Login Manager</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="pwmgr_common.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-Login Manager test: finalization.
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Login Manager: finalization **/
-
-
-// Get the pwmgr service
-var Cc_pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"];
-ok(Cc_pwmgr != null, "Access Cc[@mozilla.org/login-manager;1]");
-
-var Ci_pwmgr = SpecialPowers.Ci.nsILoginManager;
-ok(Ci_pwmgr != null, "Access Ci.nsILoginManager");
-
-var pwmgr = Cc_pwmgr.getService(Ci_pwmgr);
-ok(pwmgr != null, "pwmgr getService()");
-
-
-// Remove all logins, so future test runs start off clean.
-pwmgr.removeAllLogins();
-
-var logins = pwmgr.getAllLogins();
-ok(logins != null, "getAllLogins()");
-is(logins.length, 0, "ensure no remaining logins");
-
-// Remove any disabled hosts
-var disabledHosts = pwmgr.getAllDisabledHosts();
-ok(disabledHosts != null, "getAllDisabledHosts()");
-disabledHosts.forEach(host => pwmgr.setLoginSavingEnabled(host, true));
-
-disabledHosts = pwmgr.getAllDisabledHosts();
-ok(disabledHosts != null, "getAllDisabledHosts()");
-is(disabledHosts.length, 0, "ensure no remaining disabled hosts");
-
-</script>
-</pre>
-</body>
-</html>
-