2008-01-29 17:34:36 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<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 **/
|
|
|
|
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
|
|
|
|
|
|
|
|
|
|
// Get the pwmgr service
|
|
|
|
var Cc_pwmgr = Components.classes["@mozilla.org/login-manager;1"];
|
|
|
|
ok(Cc_pwmgr != null, "Access Cc[@mozilla.org/login-manager;1]");
|
|
|
|
|
|
|
|
var Ci_pwmgr = Components.interfaces.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();
|
|
|
|
|
2009-11-08 01:22:11 -08:00
|
|
|
var logins = pwmgr.getAllLogins();
|
2008-01-29 17:34:36 -08:00
|
|
|
ok(logins != null, "getAllLogins()");
|
|
|
|
is(logins.length, 0, "ensure no remaining logins");
|
|
|
|
|
|
|
|
// Remove any disabled hosts
|
2009-11-08 01:22:11 -08:00
|
|
|
var disabledHosts = pwmgr.getAllDisabledHosts();
|
2008-01-29 17:34:36 -08:00
|
|
|
ok(disabledHosts != null, "getAllDisabledHosts()");
|
|
|
|
disabledHosts.forEach(function(host) pwmgr.setLoginSavingEnabled(host, true));
|
|
|
|
|
2009-11-08 01:22:11 -08:00
|
|
|
disabledHosts = pwmgr.getAllDisabledHosts();
|
2008-01-29 17:34:36 -08:00
|
|
|
ok(disabledHosts != null, "getAllDisabledHosts()");
|
|
|
|
is(disabledHosts.length, 0, "ensure no remaining disabled hosts");
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|