Bug 1114713 - Fix intermittent test failures by removing a event-cycling setTimeout call. r=mikedeboer, a=test-only
authorMark Banner <standard8@mozilla.com>
Tue, 24 Feb 2015 13:17:29 +0000
changeset 280715 42d279a1e1f7c42db650ada48114e6194453c2ce
parent 280714 0a882df01fc3dadfc369431670787fe6b998bf47
child 280716 a3214625cd30c9f73290c343f890ed8506a30aad
push id113
push userryanvm@gmail.com
push dateThu, 05 Nov 2015 16:09:15 +0000
reviewersmikedeboer, test-only
bugs1114713
milestone38.0a2
Bug 1114713 - Fix intermittent test failures by removing a event-cycling setTimeout call. r=mikedeboer, a=test-only
browser/components/loop/test/desktop-local/contacts_test.js
browser/components/loop/test/desktop-local/panel_test.js
--- a/browser/components/loop/test/desktop-local/contacts_test.js
+++ b/browser/components/loop/test/desktop-local/contacts_test.js
@@ -13,17 +13,17 @@ describe("loop.contacts", function() {
 
   var fakeAddContactButtonText = "Fake Add Contact";
   var fakeEditContactButtonText = "Fake Edit Contact";
   var fakeDoneButtonText = "Fake Done";
   var sandbox;
   var fakeWindow;
   var notifications;
 
-  beforeEach(function(done) {
+  beforeEach(function() {
     sandbox = sinon.sandbox.create();
     navigator.mozLoop = {
       getStrings: function(entityName) {
         var textContentValue = "fakeText";
         if (entityName == "add_contact_button") {
           textContentValue = fakeAddContactButtonText;
         } else if (entityName == "edit_contact_title") {
           textContentValue = fakeEditContactButtonText;
@@ -35,18 +35,16 @@ describe("loop.contacts", function() {
     };
 
     fakeWindow = {
       close: sandbox.stub(),
     };
     loop.shared.mixins.setRootObject(fakeWindow);
 
     document.mozL10n.initialize(navigator.mozLoop);
-    // XXX prevent a race whenever mozL10n hasn't been initialized yet
-    setTimeout(done, 0);
   });
 
   afterEach(function() {
     loop.shared.mixins.setRootObject(window);
     sandbox.restore();
   });
 
 
--- a/browser/components/loop/test/desktop-local/panel_test.js
+++ b/browser/components/loop/test/desktop-local/panel_test.js
@@ -12,17 +12,17 @@ var sharedUtils = loop.shared.utils;
 
 describe("loop.panel", function() {
   "use strict";
 
   var sandbox, notifications;
   var fakeXHR, fakeWindow, fakeMozLoop;
   var requests = [];
 
-  beforeEach(function(done) {
+  beforeEach(function() {
     sandbox = sinon.sandbox.create();
     fakeXHR = sandbox.useFakeXMLHttpRequest();
     requests = [];
     // https://github.com/cjohansen/Sinon.JS/issues/393
     fakeXHR.xhr.onCreate = function (xhr) {
       requests.push(xhr);
     };
 
@@ -60,18 +60,16 @@ describe("loop.panel", function() {
         },
         on: sandbox.stub()
       },
       confirm: sandbox.stub(),
       notifyUITour: sandbox.stub()
     };
 
     document.mozL10n.initialize(navigator.mozLoop);
-    // XXX prevent a race whenever mozL10n hasn't been initialized yet
-    setTimeout(done, 0);
   });
 
   afterEach(function() {
     delete navigator.mozLoop;
     loop.shared.mixins.setRootObject(window);
     sandbox.restore();
   });