Bug 557406 - Intermittent xpcshell failure in test_bookmarks.js | false == true (via shaver, test landing to see orange effect)
authorDietrich Ayala <dietrich@mozilla.com>
Tue, 13 Apr 2010 22:57:36 -0700
changeset 40750 a02d1f25ce6835dad0567bcd187b0e6dbf6cdfa2
parent 40749 d287e7a7b4496d67a123d9b9e2d9ea6fa658ff9b
child 40751 db22a5554a5e0e421401409542b4320a0f09835b
push id12793
push userdietrich@mozilla.com
push dateWed, 14 Apr 2010 05:58:14 +0000
treeherdermozilla-central@a02d1f25ce68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs557406
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 557406 - Intermittent xpcshell failure in test_bookmarks.js | false == true (via shaver, test landing to see orange effect)
toolkit/components/places/tests/bookmarks/test_bookmarks.js
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks.js
@@ -175,18 +175,18 @@ function run_test() {
   do_check_eq(lastModified, dateAdded);
 
   // The time before we set the title, in microseconds.
   var beforeSetTitle = Date.now() * 1000;
   do_check_true(beforeSetTitle >= beforeInsert);
 
   // Workaround possible VM timers issues moving lastModified and dateAdded
   // to the past.
-  bmsvc.setItemLastModified(newId, --lastModified);
-  bmsvc.setItemDateAdded(newId, --dateAdded);
+  bmsvc.setItemLastModified(newId, (lastModified -= 1000));
+  bmsvc.setItemDateAdded(newId, (dateAdded -= 1000));
 
   // set bookmark title
   bmsvc.setItemTitle(newId, "Google");
   do_check_eq(observer._itemChangedId, newId);
   do_check_eq(observer._itemChangedProperty, "title");
   do_check_eq(observer._itemChangedValue, "Google");
 
   // check that dateAdded hasn't changed
@@ -351,18 +351,18 @@ function run_test() {
   try {
     var dateAdded = bmsvc.getItemDateAdded(kwTestItemId);
     // after just inserting, modified should not be set
     var lastModified = bmsvc.getItemLastModified(kwTestItemId);
     do_check_eq(lastModified, dateAdded);
 
     // Workaround possible VM timers issues moving lastModified and dateAdded
     // to the past.
-    bmsvc.setItemLastModified(kwTestItemId, --lastModified);
-    bmsvc.setItemDateAdded(kwTestItemId, --dateAdded);
+    bmsvc.setItemLastModified(kwTestItemId, (lastModified -= 1000));
+    bmsvc.setItemDateAdded(kwTestItemId, (dateAdded -= 1000));
 
     bmsvc.setKeywordForBookmark(kwTestItemId, "bar");
 
     var lastModified2 = bmsvc.getItemLastModified(kwTestItemId);
     LOG("test setKeywordForBookmark");
     LOG("dateAdded = " + dateAdded);
     LOG("lastModified = " + lastModified);
     LOG("lastModified2 = " + lastModified2);
@@ -478,18 +478,18 @@ function run_test() {
                                      bmsvc.DEFAULT_INDEX, "");
   var dateAdded = bmsvc.getItemDateAdded(newId10);
   // after just inserting, modified should not be set
   var lastModified = bmsvc.getItemLastModified(newId10);
   do_check_eq(lastModified, dateAdded);
 
   // Workaround possible VM timers issues moving lastModified and dateAdded
   // to the past.
-  bmsvc.setItemLastModified(newId10, --lastModified);
-  bmsvc.setItemDateAdded(newId10, --dateAdded);
+  bmsvc.setItemLastModified(newId10, (lastModified -= 1000));
+  bmsvc.setItemDateAdded(newId10, (dateAdded -= 1000));
 
   bmsvc.changeBookmarkURI(newId10, uri("http://foo11.com/"));
 
   // check that lastModified is set after we change the bookmark uri
   var lastModified2 = bmsvc.getItemLastModified(newId10);
   LOG("test changeBookmarkURI");
   LOG("dateAdded = " + dateAdded);
   LOG("lastModified = " + lastModified);
@@ -642,32 +642,32 @@ function run_test() {
   bmsvc.insertBookmark(testRoot, uri1, bmsvc.DEFAULT_INDEX, "");
   histsvc.addVisit(uri1, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
 
   testSimpleFolderResult();
 }
 
 function testSimpleFolderResult() {
   // the time before we create a folder, in microseconds
-  // Workaround possible VM timers issues subtracting 1us.
-  var beforeCreate = Date.now() * 1000 - 1;
+  // Workaround possible VM timers issues subtracting 1ms.
+  var beforeCreate = (Date.now() - 1) * 1000;
   do_check_true(beforeCreate > 0);
 
   // create a folder
   var parent = bmsvc.createFolder(root, "test", bmsvc.DEFAULT_INDEX);
 
   var dateCreated = bmsvc.getItemDateAdded(parent);
   LOG("check that the folder was created with a valid dateAdded");
   LOG("beforeCreate = " + beforeCreate);
   LOG("dateCreated = " + dateCreated);
   do_check_true(dateCreated > beforeCreate);
 
   // the time before we insert, in microseconds
-  // Workaround possible VM timers issues subtracting 1us.
-  var beforeInsert = Date.now() * 1000 - 1;
+  // Workaround possible VM timers issues subtracting 1ms.
+  var beforeInsert = (Date.now() - 1) * 1000;
   do_check_true(beforeInsert > 0);
 
   // insert a separator 
   var sep = bmsvc.insertSeparator(parent, bmsvc.DEFAULT_INDEX);
 
   var dateAdded = bmsvc.getItemDateAdded(sep);
   LOG("check that the separator was created with a valid dateAdded");
   LOG("beforeInsert = " + beforeInsert);