Bug 836369 - Intermittent test_history_tracker.js | test failed | true == false. r=trivial,test-only
authorRichard Newman <rnewman@mozilla.com>
Wed, 30 Jan 2013 15:30:53 -0800
changeset 120417 f5789352370eb948a13e210a9bc2cf455337ea26
parent 120416 220ee1b126c31d4aa53efc0017c07f6912c7f428
child 120418 774ba579fd394883d42e0db89a44211fbbba785b
push id24251
push userryanvm@gmail.com
push dateThu, 31 Jan 2013 20:56:22 +0000
treeherdermozilla-central@683b08dc1afd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstrivial, test-only
bugs836369
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 836369 - Intermittent test_history_tracker.js | test failed | true == false. r=trivial,test-only
services/sync/tests/unit/test_history_tracker.js
--- a/services/sync/tests/unit/test_history_tracker.js
+++ b/services/sync/tests/unit/test_history_tracker.js
@@ -38,44 +38,46 @@ function addVisit() {
     visits: [ {
       visitDate: Date.now() * 1000,
       transitionType: PlacesUtils.history.TRANSITION_LINK
     } ]
   };
 
   let cb = Async.makeSpinningCallback();
   PlacesUtils.asyncHistory.updatePlaces(place, {
-    handleError: function Add_handleError() {
+    handleError: function () {
       _("Error adding visit for " + uriString);
       cb(new Error("Error adding history entry"));
     },
-    handleResult: function Add_handleResult() {
+
+    handleResult: function () {
+    },
+
+    handleCompletion: function () {
       _("Added visit for " + uriString);
       cb();
-    },
-    handleCompletion: function Add_handleCompletion() {
-       // Nothing to do
-     }
-   });
+    }
+  });
 
   // Spin the event loop to embed this async call in a sync API.
   cb.wait();
   return uri;
 }
 
 function run_test() {
   initTestLogging("Trace");
   Log4Moz.repository.getLogger("Sync.Tracker.History").level = Log4Moz.Level.Trace;
   run_next_test();
 }
 
 add_test(function test_empty() {
-  _("Verify we've got an empty tracker to work with.");
+  _("Verify we've got an empty, disabled tracker to work with.");
   do_check_empty(tracker.changedIDs);
   do_check_eq(tracker.score, 0);
+  do_check_false(tracker._enabled);
   run_next_test();
 });
 
 add_test(function test_not_tracking(next) {
   _("Create history item. Won't show because we haven't started tracking yet");
   addVisit();
   Utils.nextTick(function() {
     do_check_empty(tracker.changedIDs);
@@ -95,17 +97,16 @@ add_test(function test_start_tracking() 
     run_next_test();
   };
 
   _("Tell the tracker to start tracking changes.");
   onScoreUpdated(function() {
     _("Score updated in test_start_tracking.");
     do_check_attribute_count(tracker.changedIDs, 1);
     do_check_eq(tracker.score, SCORE_INCREMENT_SMALL);
-    run_next_test();
   });
 
   Svc.Obs.notify("weave:engine:start-tracking");
   addVisit();
 });
 
 add_test(function test_start_tracking_twice() {
   _("Verifying preconditions from test_start_tracking.");
@@ -121,26 +122,29 @@ add_test(function test_start_tracking_tw
   });
 
   Svc.Obs.notify("weave:engine:start-tracking");
   addVisit();
 });
 
 add_test(function test_track_delete() {
   _("Deletions are tracked.");
+
+  // This isn't present because we weren't tracking when it was visited.
   let uri = Utils.makeURI("http://getfirefox.com/0");
   let guid = engine._store.GUIDForUri(uri);
   do_check_false(guid in tracker.changedIDs);
 
   onScoreUpdated(function() {
     do_check_true(guid in tracker.changedIDs);
     do_check_attribute_count(tracker.changedIDs, 3);
     do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE + 2 * SCORE_INCREMENT_SMALL);
     run_next_test();
   });
+
   do_check_eq(tracker.score, 2 * SCORE_INCREMENT_SMALL);
   PlacesUtils.history.removePage(uri);
 });
 
 add_test(function test_dont_track_expiration() {
   _("Expirations are not tracked.");
   let uriToExpire = addVisit();
   let guidToExpire = engine._store.GUIDForUri(uriToExpire);