Bug 963674 - Remove xul appinfo from xpcshell tests. r=MattN
authorJed Parsons <jedp@mozilla.com>
Fri, 24 Jan 2014 13:23:21 -0800
changeset 181335 8e19c247580d2b23fa24e198ec0fbf32e892f3a0
parent 181334 5b888357a3b28a307640500bb44561b86641187a
child 181336 58c6f797275abdc86748881791a3cbb82964fec9
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs963674
milestone29.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 963674 - Remove xul appinfo from xpcshell tests. r=MattN
toolkit/identity/MinimalIdentity.jsm
toolkit/identity/tests/unit/head_identity.js
toolkit/identity/tests/unit/test_log_utils.js
toolkit/identity/tests/unit/test_minimalidentity.js
toolkit/identity/tests/unit/test_relying_party.js
--- a/toolkit/identity/MinimalIdentity.jsm
+++ b/toolkit/identity/MinimalIdentity.jsm
@@ -88,22 +88,25 @@ function IDService() {
 }
 
 IDService.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, Ci.nsIObserver]),
 
   observe: function observe(aSubject, aTopic, aData) {
     switch (aTopic) {
       case "quit-application-granted":
-        Services.obs.removeObserver(this, "quit-application-granted");
-        // Services.obs.removeObserver(this, "identity-auth-complete");
+        this.shutdown();
         break;
     }
   },
 
+  shutdown: function() {
+    Services.obs.removeObserver(this, "quit-application-granted");
+  },
+
   /**
    * Parse an email into username and domain if it is valid, else return null
    */
   parseEmail: function parseEmail(email) {
     var match = email.match(/^([^@]+)@([^@^/]+.[a-z]+)$/);
     if (match) {
       return {
         username: match[1],
@@ -223,54 +226,54 @@ IDService.prototype = {
    * once the UI-and-display-logic components have received
    * notifications, they call back with direct invocation of the
    * following functions (doLogin, doLogout, or doReady)
    */
 
   doLogin: function doLogin(aRpCallerId, aAssertion, aInternalParams) {
     let rp = this._rpFlows[aRpCallerId];
     if (!rp) {
-      dump("WARNING: doLogin found no rp to go with callerId " + aRpCallerId + "\n");
+      log("WARNING: doLogin found no rp to go with callerId " + aRpCallerId);
       return;
     }
 
     rp.doLogin(aAssertion, aInternalParams);
   },
 
   doLogout: function doLogout(aRpCallerId) {
     let rp = this._rpFlows[aRpCallerId];
     if (!rp) {
-      dump("WARNING: doLogout found no rp to go with callerId " + aRpCallerId + "\n");
+      log("WARNING: doLogout found no rp to go with callerId " + aRpCallerId);
       return;
     }
 
     // Logout from every site with the same origin
     let origin = rp.origin;
     Object.keys(this._rpFlows).forEach(function(key) {
       let rp = this._rpFlows[key];
       if (rp.origin === origin) {
         rp.doLogout();
       }
     }.bind(this));
   },
 
   doReady: function doReady(aRpCallerId) {
     let rp = this._rpFlows[aRpCallerId];
     if (!rp) {
-      dump("WARNING: doReady found no rp to go with callerId " + aRpCallerId + "\n");
+      log("WARNING: doReady found no rp to go with callerId " + aRpCallerId);
       return;
     }
 
     rp.doReady();
   },
 
   doCancel: function doCancel(aRpCallerId) {
     let rp = this._rpFlows[aRpCallerId];
     if (!rp) {
-      dump("WARNING: doCancel found no rp to go with callerId " + aRpCallerId + "\n");
+      log("WARNING: doCancel found no rp to go with callerId " + aRpCallerId);
       return;
     }
 
     rp.doCancel();
   },
 
 
   /*
--- a/toolkit/identity/tests/unit/head_identity.js
+++ b/toolkit/identity/tests/unit/head_identity.js
@@ -40,45 +40,16 @@ const TEST_USER = "user@mozilla.com";
 const TEST_PRIVKEY = "fake-privkey";
 const TEST_CERT = "fake-cert";
 const TEST_IDPPARAMS = {
   domain: "myfavoriteflan.com",
   authentication: "/foo/authenticate.html",
   provisioning: "/foo/provision.html"
 };
 
-let XULAppInfo = {
-  vendor: "Mozilla",
-  name: "XPCShell",
-  ID: "xpcshell@tests.mozilla.org",
-  version: "1",
-  appBuildID: "20100621",
-  platformVersion: "",
-  platformBuildID: "20100621",
-  inSafeMode: false,
-  logConsoleErrors: true,
-  OS: "XPCShell",
-  XPCOMABI: "noarch-spidermonkey",
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, Ci.nsIXULRuntime]),
-  invalidateCachesOnRestart: function invalidateCachesOnRestart() { }
-};
-
-let XULAppInfoFactory = {
-  createInstance: function (outer, iid) {
-    if (outer != null)
-      throw Cr.NS_ERROR_NO_AGGREGATION;
-    return XULAppInfo.QueryInterface(iid);
-  }
-};
-
-let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
-registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"),
-                          "XULAppInfo", "@mozilla.org/xre/app-info;1",
-                          XULAppInfoFactory);
-
 // The following are utility functions for Identity testing
 
 function log(...aMessageArgs) {
   Logger.log.apply(Logger, ["test"].concat(aMessageArgs));
 }
 
 function get_idstore() {
   return IdentityStore;
--- a/toolkit/identity/tests/unit/test_log_utils.js
+++ b/toolkit/identity/tests/unit/test_log_utils.js
@@ -59,16 +59,16 @@ function test_wrappers() {
   reportErrorAlias("Too much red bull");
 }
 
 let TESTS = [
 // XXX fix me 
 //    toggle_debug,
     test_log,
     test_reportError,
-    test_wrappers
+    test_wrappers,
 ];
 
 TESTS.forEach(add_test);
 
 function run_test() {
   run_next_test();
-}
\ No newline at end of file
+}
--- a/toolkit/identity/tests/unit/test_minimalidentity.js
+++ b/toolkit/identity/tests/unit/test_minimalidentity.js
@@ -169,16 +169,16 @@ let TESTS = [
   test_mock_doc,
   test_watch,
   test_request,
   test_request_forceAuthentication,
   test_request_forceIssuer,
   test_logout,
   test_logoutBeforeWatch,
   test_requestBeforeWatch,
-  test_unwatchBeforeWatch
+  test_unwatchBeforeWatch,
 ];
 
 TESTS.forEach(add_test);
 
 function run_test() {
   run_next_test();
 }
--- a/toolkit/identity/tests/unit/test_relying_party.js
+++ b/toolkit/identity/tests/unit/test_relying_party.js
@@ -240,16 +240,16 @@ let TESTS = [
   test_watch_loggedin_ready,
   test_watch_loggedin_login,
   test_watch_loggedin_logout,
   test_watch_notloggedin_ready,
   test_watch_notloggedin_logout,
   test_request,
   test_request_forceAuthentication,
   test_request_forceIssuer,
-  test_logout
+  test_logout,
 ];
 
 TESTS.forEach(add_test);
 
 function run_test() {
   run_next_test();
 }