Add MORE test debugging for bug 608206. a=afrosdwilsh
authorJustin Dolske <dolske@mozilla.com>
Sun, 14 Nov 2010 23:42:22 -0800
changeset 57499 41673a86c79cfd75e94e2e599df07bb996171de5
parent 57498 2c7111d00bfa67f80685ce3ba9184c3ea2176f50
child 57500 8774ecf70aa398be8b7bffc4dc5e5a6ebdabb9cc
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersafrosdwilsh
bugs608206
milestone2.0b8pre
Add MORE test debugging for bug 608206. a=afrosdwilsh
toolkit/components/passwordmgr/test/test_prompt.html
--- a/toolkit/components/passwordmgr/test/test_prompt.html
+++ b/toolkit/components/passwordmgr/test/test_prompt.html
@@ -140,18 +140,50 @@ var storageObserver = {
                         Ci.nsISupports, Ci.nsISupportsWeakReference];
 
     if (!interfaces.some( function(v) { return iid.equals(v) } ))
       throw Components.results.NS_ERROR_NO_INTERFACE;
     return this;
   },
 
   observe : function (subject, topic, data) {
-    ok(true, "observer for " + topic);
+    ok(true, "observer for " + topic + " / " + data);
+  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
     try {
+      switch (data) {
+        case "addLogin":
+            ok(subject instanceof Ci.nsILoginInfo, "subject QI 1");
+            ok(subject instanceof Ci.nsILoginMetaInfo, "subject QI 2");
+            dumpLogin("added: ", subject);
+            break;
+        case "modifyLogin":
+            ok(subject instanceof Ci.nsIArray, "subject QI");
+            is(subject.length, 2, "should be 2 items");
+            var oldLogin = subject.queryElementAt(0, Ci.nsILoginInfo);
+            var newLogin = subject.queryElementAt(1, Ci.nsILoginInfo);
+            dumpLogin("oldLogin: ", oldLogin);
+            dumpLogin("newLogin: ", newLogin);
+            break;
+        case "removeLogin":
+            ok(subject instanceof Ci.nsILoginInfo, "subject QI 1");
+            ok(subject instanceof Ci.nsILoginMetaInfo, "subject QI 2");
+            dumpLogin("removed: ", subject);
+            break;
+        case "removeAllLogins":
+            is(subject, null, "no subject");
+            break;
+        case "hostSavingEnabled":
+        case "hostSavingDisabled":
+            ok(subject instanceof Ci.nsISupportsString, "subject QI");
+            ok(true, "state is: " + subject.data);
+            break;
+        default:
+            do_throw("Unhandled notification: " + data + " / " + topic);
+      }
+
       if (this.notificationCallbacks.length)
         this.notificationCallbacks.splice(0, 1)[0]();
     } catch (e) { ok(false, "OBSERVER FAILED: " + e); }
   }
 };
 
 var observerService = Cc["@mozilla.org/observer-service;1"]
                       .getService(Ci.nsIObserverService);