Bug 995599 - Prevent services tests hitting the network. r=rnewman, a=test-only
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 10 Jun 2014 12:02:39 +1000
changeset 188033 9c086482429557c72f3011ae834ebe81942ebae6
parent 188032 2666d093d7be6069b34992460e69a1a2123cf371
child 188034 46cbab3faf7d4809a970d8b6335cae36ec8205c1
push id361
push userryanvm@gmail.com
push dateFri, 13 Jun 2014 15:45:05 +0000
treeherdermozilla-b2g30_v1_4@46cbab3faf7d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman, test-only
bugs995599
milestone30.0
Bug 995599 - Prevent services tests hitting the network. r=rnewman, a=test-only
services/fxaccounts/tests/xpcshell/test_accounts.js
services/sync/tests/unit/test_fxa_startOver.js
services/sync/tests/unit/test_service_changePassword.js
--- a/services/fxaccounts/tests/xpcshell/test_accounts.js
+++ b/services/fxaccounts/tests/xpcshell/test_accounts.js
@@ -164,17 +164,18 @@ add_task(function test_get_signed_in_use
   // to be read and parsed from storage (e.g. disk via JSONStorage).
   delete account.internal.signedInUser;
   let result = yield account.getSignedInUser();
   do_check_eq(result.email, credentials.email);
   do_check_eq(result.assertion, credentials.assertion);
   do_check_eq(result.kB, credentials.kB);
 
   // sign out
-  yield account.signOut();
+  let localOnly = true;
+  yield account.signOut(localOnly);
 
   // user should be undefined after sign out
   let result = yield account.getSignedInUser();
   do_check_eq(result, null);
 });
 
 // Sanity-check that our mocked client is working correctly
 add_test(function test_client_mock() {
--- a/services/sync/tests/unit/test_fxa_startOver.js
+++ b/services/sync/tests/unit/test_fxa_startOver.js
@@ -22,16 +22,20 @@ add_task(function* test_startover() {
   let xps = Cc["@mozilla.org/weave/service;1"]
             .getService(Components.interfaces.nsISupports)
             .wrappedJSObject;
   do_check_false(xps.fxAccountsEnabled);
 
   // we expect the "legacy" provider (but can't instanceof that, as BrowserIDManager
   // extends it)
   do_check_false(Service.identity instanceof BrowserIDManager);
+
+  Service.serverURL = "https://localhost/";
+  Service.clusterURL = Service.serverURL;
+
   Service.login();
   // We should have a cluster URL
   do_check_true(Service.clusterURL.length > 0);
 
   // remember some stuff so we can reset it after.
   let oldIdentity = Service.identity;
   let oldClusterManager = Service._clusterManager;
   let deferred = Promise.defer();
--- a/services/sync/tests/unit/test_service_changePassword.js
+++ b/services/sync/tests/unit/test_service_changePassword.js
@@ -27,16 +27,17 @@ add_test(function test_change_password()
       requestBody = readBytesFromInputStream(request.bodyInputStream);
       response.setStatusLine(request.httpVersion, statusCode, status);
       response.bodyOutputStream.write(body, body.length);
     };
   }
 
   try {
     Service.baseURI = "http://localhost:9999/";
+    Service.serverURL = "http://localhost:9999/";
     setBasicCredentials("johndoe", "ilovejane");
 
     _("changePassword() returns false for a network error, the password won't change.");
     let res = Service.changePassword("ILoveJane83");
     do_check_false(res);
     do_check_eq(Service.identity.basicPassword, "ilovejane");
 
     _("Let's fire up the server and actually change the password.");