Bug 1018624 - Asynchronously load password storage in tests, r=Standard8, a=bustage-fix for CLOSED TREE.
--HG-- extra : rebase_source : e04c59e970ee122a47e5cf73cf263ccf1f040eff
This commit is contained in:
Родитель
396d5bc299
Коммит
46ec8c572e
|
@ -32,7 +32,7 @@ const kUsername = "test.smtp@fakeserver";
|
|||
const kPassword1 = "wrong";
|
||||
const kPassword2 = "smtptest";
|
||||
|
||||
function run_test() {
|
||||
add_task(function *() {
|
||||
registerAlertTestUtils();
|
||||
|
||||
function createHandler(d) {
|
||||
|
@ -49,7 +49,7 @@ function run_test() {
|
|||
server.setDebugLevel(fsDebugAll);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-smtp.sqlite")
|
||||
yield setupForPassword("signons-smtp.sqlite");
|
||||
|
||||
// Test file
|
||||
var testFile = do_get_file("data/message1.eml");
|
||||
|
@ -99,4 +99,8 @@ function run_test() {
|
|||
while (thread.hasPendingEvents())
|
||||
thread.processNextEvent(true);
|
||||
}
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ const kUsername = "testsmtp";
|
|||
// This is the same as in the signons file.
|
||||
const kPassword = "smtptest";
|
||||
|
||||
function run_test() {
|
||||
add_task(function *() {
|
||||
function createHandler(d) {
|
||||
var handler = new SMTP_RFC2821_handler(d);
|
||||
// Username needs to match signons.txt
|
||||
|
@ -27,7 +27,7 @@ function run_test() {
|
|||
server = setupServerDaemon(createHandler);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8.sqlite")
|
||||
|
||||
// Test file
|
||||
var testFile = do_get_file("data/message1.eml");
|
||||
|
@ -72,4 +72,8 @@ function run_test() {
|
|||
while (thread.hasPendingEvents())
|
||||
thread.processNextEvent(true);
|
||||
}
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -13,10 +13,9 @@ const kProtocol = "smtp";
|
|||
const kHostname = "localhost";
|
||||
const kServerUrl = kProtocol + "://" + kHostname;
|
||||
|
||||
function run_test()
|
||||
{
|
||||
add_task(function *() {
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8-multiple.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8-multiple.sqlite")
|
||||
|
||||
// Set up the basic accounts and folders.
|
||||
localAccountUtils.loadLocalMailAccount();
|
||||
|
@ -62,4 +61,8 @@ function run_test()
|
|||
// should be one login left for kUser2
|
||||
do_check_eq(count.value, 0);
|
||||
do_check_eq(logins.length, 0);
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ function confirmEx(aDialogTitle, aText, aButtonFlags, aButton0Title,
|
|||
}
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
add_task(function *() {
|
||||
function createHandler(d) {
|
||||
var handler = new SMTP_RFC2821_handler(d);
|
||||
// Username needs to match signons.txt
|
||||
|
@ -66,7 +66,7 @@ function run_test() {
|
|||
server = setupServerDaemon(createHandler);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8.sqlite")
|
||||
|
||||
registerAlertTestUtils();
|
||||
|
||||
|
@ -121,4 +121,8 @@ function run_test() {
|
|||
while (thread.hasPendingEvents())
|
||||
thread.processNextEvent(true);
|
||||
}
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ function promptPasswordPS(aParent, aDialogTitle, aText, aPassword, aCheckMsg,
|
|||
return false;
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
add_task(function *() {
|
||||
function createHandler(d) {
|
||||
var handler = new SMTP_RFC2821_handler(d);
|
||||
// Username needs to match signons.txt
|
||||
|
@ -77,7 +77,7 @@ function run_test() {
|
|||
server = setupServerDaemon(createHandler);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8.sqlite")
|
||||
|
||||
registerAlertTestUtils();
|
||||
|
||||
|
@ -149,4 +149,8 @@ function run_test() {
|
|||
while (thread.hasPendingEvents())
|
||||
thread.processNextEvent(true);
|
||||
}
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ function promptPasswordPS(aParent, aDialogTitle, aText, aPassword, aCheckMsg,
|
|||
return false;
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
add_task(function *() {
|
||||
function createHandler(d) {
|
||||
var handler = new SMTP_RFC2821_handler(d);
|
||||
handler.dropOnAuthFailure = true;
|
||||
|
@ -76,7 +76,7 @@ function run_test() {
|
|||
server = setupServerDaemon(createHandler);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8.sqlite")
|
||||
|
||||
registerAlertTestUtils();
|
||||
|
||||
|
@ -105,7 +105,7 @@ function run_test() {
|
|||
false, {}, {});
|
||||
|
||||
server.performTest();
|
||||
}
|
||||
});
|
||||
|
||||
var URLListener = {
|
||||
OnStartRunningUrl: function(url) { },
|
||||
|
@ -133,3 +133,7 @@ var URLListener = {
|
|||
|
||||
}
|
||||
};
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -57,11 +57,11 @@ function promptPasswordPS(aParent, aDialogTitle, aText, aPassword, aCheckMsg,
|
|||
return false;
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
add_task(function *() {
|
||||
do_test_pending();
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8-imap.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8-imap.sqlite")
|
||||
|
||||
registerAlertTestUtils();
|
||||
|
||||
|
@ -136,7 +136,7 @@ function run_test() {
|
|||
do_check_eq(logins[0].password, kValidPassword);
|
||||
|
||||
do_timeout(500, endTest);
|
||||
}
|
||||
});
|
||||
|
||||
function endTest() {
|
||||
incomingServer.closeCachedConnections();
|
||||
|
@ -148,3 +148,7 @@ function endTest() {
|
|||
|
||||
do_test_finished();
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ function testNext() {
|
|||
}
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
add_task(function *() {
|
||||
// Disable new mail notifications
|
||||
Services.prefs.setBoolPref("mail.biff.play_sound", false);
|
||||
Services.prefs.setBoolPref("mail.biff.show_alert", false);
|
||||
|
@ -113,7 +113,7 @@ function run_test() {
|
|||
Services.prefs.setBoolPref("mail.biff.animate_dock_icon", false);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8.sqlite");
|
||||
|
||||
// Set up the Server
|
||||
var serverArray = setupServerDaemon();
|
||||
|
@ -143,4 +143,8 @@ function run_test() {
|
|||
do_test_pending();
|
||||
|
||||
testNext();
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ function testNext() {
|
|||
}
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
add_task(function *() {
|
||||
// Disable new mail notifications
|
||||
Services.prefs.setBoolPref("mail.biff.play_sound", false);
|
||||
Services.prefs.setBoolPref("mail.biff.show_alert", false);
|
||||
|
@ -141,7 +141,7 @@ function run_test() {
|
|||
Services.prefs.setCharPref("mail.server.server2.userName", "othername");
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8-alt.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8-alt.sqlite");
|
||||
|
||||
// Set up the Server
|
||||
var serverArray = setupServerDaemon();
|
||||
|
@ -178,4 +178,8 @@ function run_test() {
|
|||
do_test_pending();
|
||||
|
||||
testNext();
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -14,10 +14,9 @@ const kProtocol = "pop3";
|
|||
const kHostname = "localhost";
|
||||
const kServerUrl = "mailbox://" + kHostname;
|
||||
|
||||
function run_test()
|
||||
{
|
||||
add_task(function *() {
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8-multiple.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8-multiple.sqlite");
|
||||
|
||||
// Set up the basic accounts and folders.
|
||||
// We would use createPop3ServerAndLocalFolders() however we want to have
|
||||
|
@ -63,4 +62,8 @@ function run_test()
|
|||
// should be one login left for kUser2
|
||||
do_check_eq(count.value, 0);
|
||||
do_check_eq(logins.length, 0);
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -148,8 +148,7 @@ function actually_run_test() {
|
|||
do_test_finished();
|
||||
}
|
||||
|
||||
function run_test()
|
||||
{
|
||||
add_task(function *() {
|
||||
// Disable new mail notifications
|
||||
Services.prefs.setBoolPref("mail.biff.play_sound", false);
|
||||
Services.prefs.setBoolPref("mail.biff.show_alert", false);
|
||||
|
@ -158,7 +157,7 @@ function run_test()
|
|||
Services.prefs.setBoolPref("signon.debug", true);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8.sqlite");
|
||||
|
||||
registerAlertTestUtils();
|
||||
|
||||
|
@ -190,4 +189,8 @@ function run_test()
|
|||
do_test_pending();
|
||||
|
||||
actually_run_test();
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ var daemon = setupNNTPDaemon();
|
|||
// Define these up here for checking with the transaction
|
||||
var test = null;
|
||||
|
||||
function run_test() {
|
||||
add_task(function *() {
|
||||
yield Services.logins.initializationPromise;
|
||||
|
||||
daemon.groupCredentials = {
|
||||
"test.subscribe.empty": ["group1", "pass1"],
|
||||
"test.filter": ["group2", "pass2"]
|
||||
|
@ -71,4 +73,8 @@ function run_test() {
|
|||
var thread = gThreadManager.currentThread;
|
||||
while (thread.hasPendingEvents())
|
||||
thread.processNextEvent(true);
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ var daemon = setupNNTPDaemon();
|
|||
// Define these up here for checking with the transaction
|
||||
var test = null;
|
||||
|
||||
function run_test() {
|
||||
add_task(function *() {
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8.sqlite");
|
||||
|
||||
var server = makeServer(NNTP_RFC4643_extension, daemon);
|
||||
server.start();
|
||||
|
@ -48,4 +48,8 @@ function run_test() {
|
|||
var thread = gThreadManager.currentThread;
|
||||
while (thread.hasPendingEvents())
|
||||
thread.processNextEvent(true);
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ var daemon = setupNNTPDaemon();
|
|||
// Define these up here for checking with the transaction
|
||||
var test = null;
|
||||
|
||||
function run_test() {
|
||||
add_task(function *() {
|
||||
let server = makeServer(NNTP_RFC4643_extension, daemon);
|
||||
server.start();
|
||||
|
||||
|
@ -56,7 +56,7 @@ function run_test() {
|
|||
Services.prefs.setCharPref("mail.server.server2.type", "nntp");
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8-alt.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8-alt.sqlite");
|
||||
|
||||
try {
|
||||
// Note, the uri is for hostname "invalid" which is the original uri. See
|
||||
|
@ -98,4 +98,8 @@ function run_test() {
|
|||
var thread = gThreadManager.currentThread;
|
||||
while (thread.hasPendingEvents())
|
||||
thread.processNextEvent(true);
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -14,10 +14,9 @@ const kProtocol = "nntp";
|
|||
const kHostname = "localhost";
|
||||
const kServerUrl = "news://" + kHostname;
|
||||
|
||||
function run_test()
|
||||
{
|
||||
add_task(function *() {
|
||||
// Prepare files for passwords (generated by a script in bug 925489).
|
||||
setupForPassword("signons-mailnews1.8.sqlite")
|
||||
yield setupForPassword("signons-mailnews1.8.sqlite")
|
||||
|
||||
// Set up the basic accounts and folders.
|
||||
localAccountUtils.loadLocalMailAccount();
|
||||
|
@ -46,4 +45,8 @@ function run_test()
|
|||
|
||||
// should be no passwords left...
|
||||
do_check_eq(count.value, 0);
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
if (typeof gDEPTH == "undefined")
|
||||
do_throw("gDEPTH must be defined when using passwordStorage.js");
|
||||
|
||||
Components.utils.import("resource:///modules/Services.jsm");
|
||||
|
||||
/**
|
||||
* Use the given storage database as the current signon database.
|
||||
* @returns Promise When the storage database is usable.
|
||||
*/
|
||||
function setupForPassword(storageName) {
|
||||
let keyDB = do_get_file(gDEPTH + "mailnews/data/key3.db");
|
||||
keyDB.copyTo(do_get_profile(), "key3.db");
|
||||
|
||||
let signons = do_get_file(gDEPTH + "mailnews/data/" + storageName);
|
||||
signons.copyTo(do_get_profile(), "signons.sqlite");
|
||||
return Services.logins.initializationPromise;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче