Bug 819507 - Stop relying on deprecated behavior in passwordmgr mozStorage tests. r=dolske
authorBobby Holley <bobbyholley@gmail.com>
Fri, 08 Feb 2013 10:39:01 +0000
changeset 121277 07d17a3ff4f98e859c83a92a9f400bc2debb25b2
parent 121276 e2d470f1c6160ad21be557ed2cc9c265d337ff07
child 121278 88543d623c3f55d59a7afa9d4e65836abfb3ccc8
push id24282
push userryanvm@gmail.com
push dateFri, 08 Feb 2013 22:23:58 +0000
treeherdermozilla-central@c1ee454506f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs819507
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 819507 - Stop relying on deprecated behavior in passwordmgr mozStorage tests. r=dolske
toolkit/components/passwordmgr/test/unit/test_storage_mozStorage_6.js
--- a/toolkit/components/passwordmgr/test/unit/test_storage_mozStorage_6.js
+++ b/toolkit/components/passwordmgr/test/unit/test_storage_mozStorage_6.js
@@ -210,57 +210,16 @@ do_check_eq(logins[0].guid, guid2, "chec
 logins = storage.findLogins({}, "http://testhost3", null, "newRealm");
 do_check_eq(logins.length, 1, "expecting 1 login");
 logins[0].QueryInterface(Ci.nsILoginMetaInfo);
 do_check_eq(logins[0].guid, guid3, "checking guid3");
 
 
 /* ========== 11 ========== */
 testnum++;
-testdesc = "login w/o nsILoginMetaInfo impl";
-
-var wonkyDelegate = new nsLoginInfo;
-wonkyDelegate.init("http://wonky", null, "wonkyness",
-                   "wonkyuser", "wonkypass", "u", "p");
-
-var wonkyLogin = {
-    QueryInterface : function (iid) {
-                        var interfaces = [Ci.nsILoginInfo, Ci.nsISupports];
-                        if (!interfaces.some( function(v) { return iid.equals(v) }))
-                            throw Components.results.NS_ERROR_NO_INTERFACE;
-                        return this;
-                    },
-    hostname:      wonkyDelegate.hostname,
-    formSubmitURL: wonkyDelegate.formSubmitURL,
-    httpRealm:     wonkyDelegate.httpRealm,
-    username:      wonkyDelegate.username,
-    password:      wonkyDelegate.password,
-    usernameField: wonkyDelegate.usernameField,
-    passwordField: wonkyDelegate.passwordField,
-    equals:        wonkyDelegate.equals,
-    matches:       wonkyDelegate.matches,
-    clone:         wonkyDelegate.clone
-};
-
-storage.addLogin(wonkyLogin);
-LoginTest.checkStorageData(storage, [], [testuser1, testuser2, testuser3, wonkyLogin]);
-
-logins = storage.findLogins({}, "http://wonky", null, "");
-do_check_eq(logins.length, 1, "expecting 1 login");
-logins[0].QueryInterface(Ci.nsILoginMetaInfo);
-do_check_true(isGUID.test(logins[0].guid), "wonky guid is set");
-
-storage.modifyLogin(wonkyLogin, wonkyLogin);
-LoginTest.checkStorageData(storage, [], [testuser1, testuser2, testuser3, wonkyLogin]);
-storage.removeLogin(wonkyLogin);
-LoginTest.checkStorageData(storage, [], [testuser1, testuser2, testuser3]);
-
-
-/* ========== 12 ========== */
-testnum++;
 testdesc = "check values for v4 DB addLogin";
 
 var timeuser1 = new nsLoginInfo();
 timeuser1.init("http://time1", "", null, "timeuser1", "origpass1", "foo", "bar");
 
 storage.addLogin(timeuser1);
 LoginTest.checkStorageData(storage, [], [testuser1, testuser2, testuser3, timeuser1]);
 
@@ -275,17 +234,17 @@ let time1 = tu1.timeCreated;
 
 // Check that times and usage count were initialized properly.
 do_check_true(LoginTest.is_about_now(time1));
 do_check_eq(time1, tu1.timeLastUsed);
 do_check_eq(time1, tu1.timePasswordChanged);
 do_check_eq(1, tu1.timesUsed);
 
 
-/* ========== 13 ========== */
+/* ========== 12 ========== */
 testnum++;
 testdesc = "check values for v4 DB addLogin part 2";
 
 var timeuser2 = new nsLoginInfo();
 timeuser2.init("http://time2", "", null, "timeuser2", "origpass2", "foo", "bar");
 timeuser2.QueryInterface(Ci.nsILoginMetaInfo);
 // This time pre-init the times and usage count.
 timeuser2.timeCreated = 123;
@@ -306,17 +265,17 @@ tu2.QueryInterface(Ci.nsILoginMetaInfo);
 
 // Check that values we specified were set, instead of defaults.
 do_check_eq(123, tu2.timeCreated);
 do_check_eq(456, tu2.timeLastUsed);
 do_check_eq(789, tu2.timePasswordChanged);
 do_check_eq(42, tu2.timesUsed);
 
 
-/* ========== 14 ========== */
+/* ========== 13 ========== */
 testnum++;
 testdesc = "check values for v4 DB modifyLogin";
 
 let modData = Cc["@mozilla.org/hash-property-bag;1"].createInstance(Ci.nsIWritablePropertyBag);
 modData.setProperty("timesUsed", 8);
 
 storage.modifyLogin(timeuser2, modData);
 
@@ -337,17 +296,17 @@ tu2.QueryInterface(Ci.nsILoginMetaInfo);
 // Check that values we specified were set, instead of defaults.
 do_check_eq("newpass2", tu2.password);
 do_check_eq(123, tu2.timeCreated);
 do_check_eq(456, tu2.timeLastUsed);
 do_check_true(LoginTest.is_about_now(tu2.timePasswordChanged));
 do_check_eq(8, tu2.timesUsed);
 
 
-/* ========== 15 ========== */
+/* ========== 14 ========== */
 testnum++;
 testdesc = "check values for v4 DB modifyLogin part 2";
 
 modData = Cc["@mozilla.org/hash-property-bag;1"].createInstance(Ci.nsIWritablePropertyBag);
 modData.setProperty("timesUsedIncrement", 2);
 
 storage.modifyLogin(timeuser2, modData);
 
@@ -369,17 +328,17 @@ tu2.QueryInterface(Ci.nsILoginMetaInfo);
 // Check that values we specified were set, instead of defaults.
 do_check_eq("newpass2again\u0394\u00e8", tu2.password);
 do_check_eq(123, tu2.timeCreated);
 do_check_eq(456, tu2.timeLastUsed);
 do_check_eq(888, tu2.timePasswordChanged);
 do_check_eq(10, tu2.timesUsed);
 
 
-/* ========== 16 ========== */
+/* ========== 15 ========== */
 testnum++;
 testdesc = "check values for v4 DB modifyLogin part 3";
 
 modData = Cc["@mozilla.org/hash-property-bag;1"].createInstance(Ci.nsIWritablePropertyBag);
 modData.setProperty("timeCreated",  5444333222111);
 modData.setProperty("timeLastUsed", 22222);
 
 storage.modifyLogin(timeuser2, modData);