checkStorageData(["http: 
LoginTest.checkStorageData(storage, ["http: 
function run_test() {try {/* ========== 0 ========== */var testnum = 0;var testdesc = "Initial connection to storage module"storage = Cc["@mozilla.org/login-manager/storage/legacy;1"]                    .createInstance(Ci.nsILoginManagerStorage);if (!storage) throw "Couldn't create storage instance.";/* ========== 1 ========== */testnum++;var testdesc = "Create nsILoginInfo instances for testing with"var dummyuser1 = Cc["@mozilla.org/login-manager/loginInfo;1"]                    .createInstance(Ci.nsILoginInfo);var dummyuser2 = Cc["@mozilla.org/login-manager/loginInfo;1"]                    .createInstance(Ci.nsILoginInfo);var dummyuser3 = Cc["@mozilla.org/login-manager/loginInfo;1"]                    .createInstance(Ci.nsILoginInfo);dummyuser1.hostname      = "http://dummyhost.mozilla.org";dummyuser1.username      = "dummydude";dummyuser1.usernameField = "put_user_here";dummyuser1.password      = "itsasecret";dummyuser1.passwordField = "put_pw_here";dummyuser1.formSubmitURL = "";dummyuser1.httpRealm     = null;dummyuser2.hostname      = "http://dummyhost2.mozilla.org";dummyuser2.username      = "dummydude2";dummyuser2.usernameField = "put_user2_here";dummyuser2.password      = "itsasecret2";dummyuser2.passwordField = "put_pw2_here";dummyuser2.formSubmitURL = "http://cgi.site.com";dummyuser2.httpRealm     = null;dummyuser3.hostname      = "http://dummyhost2.mozilla.org";dummyuser3.username      = "dummydude3";dummyuser3.usernameField = "put_user3_here";dummyuser3.password      = "itsasecret3";dummyuser3.passwordField = "put_pw3_here";dummyuser3.formSubmitURL = "http://cgi.site.com";dummyuser3.httpRealm     = null;var logins, disabledHosts;/* ========== 2 ========== */testnum++;testdesc = "[ensuring file doesn't exist]";var filename="non-existant-file-"+Math.floor(Math.random() * 10000);var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);file.initWithPath(OUTDIR);file.append(filename);var exists = file.exists();if (exists) {    // Go ahead and remove the file, so that this failure    // doesn't repeat itself w/o intervention.    file.remove(false);    do_check_false(exists);}testdesc = "Initialize with no existing file";initStorage(OUTDIR, filename, null, null, null);checkStorageData([], []);testdesc = "Add 1 disabled host only";storage.setLoginSavingEnabled("http://www.nsa.gov", false);disabledHosts = ["http://www.nsa.gov"];checkStorageData(disabledHosts, []);file.remove(false);/* ========== 3 ========== */testnum++;testdesc = "Initialize with existing file (valid, but empty)";initStorage(INDIR, "signons-empty.txt", OUTDIR, "output-01.txt");checkStorageData([], []);testdesc = "Add 1 disabled host only";storage.setLoginSavingEnabled("http://www.nsa.gov", false);disabledHosts = ["http://www.nsa.gov"];checkStorageData(disabledHosts, []);testdesc = "Remove disabled host only";storage.setLoginSavingEnabled("http://www.nsa.gov", true);checkStorageData([], []);/* ========== 4 ========== */testnum++;testdesc = "[clear data and reinitialize with signons-empty.txt]";initStorage(INDIR, "signons-empty.txt", OUTDIR, "output-02.txt");// Previous tests made sure we can write to an existing file, so now just// tweak component to output elsewhere.testdesc = "Add 1 login only";storage.addLogin(dummyuser1);testdesc = "[flush and reload for verification]";initStorage(OUTDIR, "output-02.txt", null, null);testdesc = "Verify output-02.txt";checkStorageData([], [dummyuser1]);/* ========== 5 ========== */testnum++;testdesc = "[clear data and reinitialize with signons-empty.txt]";initStorage(INDIR, "signons-empty.txt", OUTDIR, "output-03.txt");testdesc = "Add 1 disabled host only";storage.setLoginSavingEnabled("http://www.nsa.gov", false);testdesc = "[flush and reload for verification]";initStorage(OUTDIR, "output-03.txt", null, null);testdesc = "Verify output-03.txt";checkStorageData(["http://www.nsa.gov"], []);/* ========== 6 ========== */testnum++;testdesc = "[clear data and reinitialize with signons-empty.txt]";initStorage(INDIR, "signons-empty.txt", OUTDIR, "output-04.txt");testdesc = "Add 1 disabled host and 1 login";storage.setLoginSavingEnabled("http://www.nsa.gov", false);storage.addLogin(dummyuser1);testdesc = "[flush and reload for verification]";initStorage(OUTDIR, "output-04.txt", null, null);testdesc = "Verify output-04.txt";checkStorageData(["http://www.nsa.gov"], [dummyuser1]);/* ========== 7 ========== */testnum++;testdesc = "[clear data and reinitialize with signons-empty.txt]";initStorage(INDIR, "signons-empty.txt", OUTDIR, "output-03.txt");testdesc = "Add 2 logins (to different hosts)";storage.addLogin(dummyuser1);storage.addLogin(dummyuser2);testdesc = "[flush and reload for verification]";initStorage(OUTDIR, "output-03.txt", null, null);testdesc = "Verify output-03.txt";checkStorageData([], [dummyuser2, dummyuser1]);/* ========== 8 ========== */testnum++;testdesc = "[clear data and reinitialize with signons-empty.txt]";initStorage(INDIR, "signons-empty.txt", OUTDIR, "output-04.txt");testdesc = "Add 2 logins (to same host)";storage.addLogin(dummyuser2);storage.addLogin(dummyuser3);testdesc = "[flush and reload for verification]";initStorage(OUTDIR, "output-04.txt", null, null);testdesc = "Verify output-04.txt";logins = [dummyuser3, dummyuser2];checkStorageData([], logins);/* ========== 9 ========== */testnum++;testdesc = "[clear data and reinitialize with signons-empty.txt]";initStorage(INDIR, "signons-empty.txt", OUTDIR, "output-05.txt");testdesc = "Add 3 logins (2 to same host)";storage.addLogin(dummyuser3);storage.addLogin(dummyuser1);storage.addLogin(dummyuser2);testdesc = "[flush and reload for verification]";initStorage(OUTDIR, "output-05.txt", null, null);testdesc = "Verify output-05.txt";logins = [dummyuser1, dummyuser2, dummyuser3];checkStorageData([], logins);/* ========== 10 ========== */testnum++;// test writing a file that already contained entries// test overwriting a file early// test permissions on output file (osx/unix)// test starting with an invalid file, and a non-existant file.// excercise case where we immediately write the data on init, for empty entries// test writing a gazillion entries} catch (e) {    throw ("FAILED in test #" + testnum + " -- " + testdesc + ": " + e); }};
5459	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5459/e1960b229d92c85faf3a7d3debacc1629869333a/test_storage_legacy_2.js/clean/toolkit/components/passwordmgr/test/unit/test_storage_legacy_2.js