From 7d260ff8d6070094510e8fe30a3415e4347b7c4e Mon Sep 17 00:00:00 2001 From: "dietrich%mozilla.com" Date: Wed, 23 Jan 2008 21:23:13 +0000 Subject: [PATCH] Bug 406937 ? Fix places tests using milliseconds for APIs that require microseconds (for ondrej@allpeers.com, r=dietrich) git-svn-id: svn://10.0.0.236/trunk@243852 18797224-902f-48f8-a5cc-f745e15eee43 --- .../places/tests/bookmarks/test_bookmarks.js | 2 +- .../places/tests/bookmarks/test_savedsearches.js | 4 ++-- .../components/places/tests/unit/test_385397.js | 2 +- .../components/places/tests/unit/test_399266.js | 2 +- .../places/tests/unit/test_browserhistory.js | 10 +++++----- .../components/places/tests/unit/test_expiration.js | 4 ++-- .../components/places/tests/unit/test_history.js | 2 +- .../places/tests/unit/test_nsINavHistoryViewer.js | 4 ++-- .../tests/unit/test_resolveNullBookmarkTitles.js | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/mozilla/toolkit/components/places/tests/bookmarks/test_bookmarks.js b/mozilla/toolkit/components/places/tests/bookmarks/test_bookmarks.js index 2e3bba167cc..553336c75b6 100644 --- a/mozilla/toolkit/components/places/tests/bookmarks/test_bookmarks.js +++ b/mozilla/toolkit/components/places/tests/bookmarks/test_bookmarks.js @@ -664,7 +664,7 @@ function run_test() { // bug 378820 var uri1 = uri("http://foo.tld/a"); bmsvc.insertBookmark(testRoot, uri1, bmsvc.DEFAULT_INDEX, ""); - histsvc.addVisit(uri1, Date.now(), null, histsvc.TRANSITION_TYPED, false, 0); + histsvc.addVisit(uri1, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0); testSimpleFolderResult(); } diff --git a/mozilla/toolkit/components/places/tests/bookmarks/test_savedsearches.js b/mozilla/toolkit/components/places/tests/bookmarks/test_savedsearches.js index 96351265ae6..9f88bc80729 100644 --- a/mozilla/toolkit/components/places/tests/bookmarks/test_savedsearches.js +++ b/mozilla/toolkit/components/places/tests/bookmarks/test_savedsearches.js @@ -176,7 +176,7 @@ function run_test() { // add a visit that matches the search term var testURI = uri("http://" + searchTerm + ".com"); - bhist.addPageWithDetails(testURI, searchTerm, Date.now()); + bhist.addPageWithDetails(testURI, searchTerm, Date.now() * 1000); // create a saved-search that matches the visit we added var searchId = bmsvc.insertBookmark(testRoot, @@ -216,7 +216,7 @@ function run_test() { do_check_eq(item.uri, testURI.spec); // history visit // test live-update of query results - add a history visit that matches the query - bhist.addPageWithDetails(uri("http://foo.com"), searchTerm + "blah", Date.now()); + bhist.addPageWithDetails(uri("http://foo.com"), searchTerm + "blah", Date.now() * 1000); do_check_eq(node.childCount, 2); // test live-update of query results - delete a history visit that matches the query diff --git a/mozilla/toolkit/components/places/tests/unit/test_385397.js b/mozilla/toolkit/components/places/tests/unit/test_385397.js index 5e831ba334e..0f1302c544b 100644 --- a/mozilla/toolkit/components/places/tests/unit/test_385397.js +++ b/mozilla/toolkit/components/places/tests/unit/test_385397.js @@ -62,7 +62,7 @@ const TOTAL_SITES = 20; // main function run_test() { - var now = Date.now(); + var now = Date.now() * 1000; // add visits for (var i=0; i < TOTAL_SITES; i++) { var site = "http://www.test-" + i + ".com/"; diff --git a/mozilla/toolkit/components/places/tests/unit/test_399266.js b/mozilla/toolkit/components/places/tests/unit/test_399266.js index 283bac61788..b4cc7cca653 100644 --- a/mozilla/toolkit/components/places/tests/unit/test_399266.js +++ b/mozilla/toolkit/components/places/tests/unit/test_399266.js @@ -49,7 +49,7 @@ try { // adds a test URI visit to the database, and checks for a valid place ID function add_visit(aURI, aType) { var placeID = histsvc.addVisit(uri(aURI), - Date.now(), + Date.now() * 1000, null, // no referrer aType, false, // not redirect diff --git a/mozilla/toolkit/components/places/tests/unit/test_browserhistory.js b/mozilla/toolkit/components/places/tests/unit/test_browserhistory.js index 07e03e373ff..ee6d5d2e142 100644 --- a/mozilla/toolkit/components/places/tests/unit/test_browserhistory.js +++ b/mozilla/toolkit/components/places/tests/unit/test_browserhistory.js @@ -55,7 +55,7 @@ function run_test() { * the History migrator. */ try { - bhist.addPageWithDetails(testURI, "testURI", Date.now()); + bhist.addPageWithDetails(testURI, "testURI", Date.now() * 1000); } catch(ex) { do_throw("addPageWithDetails failed"); } @@ -89,13 +89,13 @@ function run_test() { * If aEntireDomain is true, will assume aHost is a domain, * and remove all pages from the entire domain. */ - bhist.addPageWithDetails(testURI, "testURI", Date.now()); + bhist.addPageWithDetails(testURI, "testURI", Date.now() * 1000); bhist.removePagesFromHost("mozilla.com", true); do_check_eq(0, bhist.count); // test aEntireDomain - bhist.addPageWithDetails(testURI, "testURI", Date.now()); - bhist.addPageWithDetails(uri("http://foobar.mozilla.com"), "testURI2", Date.now()); + bhist.addPageWithDetails(testURI, "testURI", Date.now() * 1000); + bhist.addPageWithDetails(uri("http://foobar.mozilla.com"), "testURI2", Date.now() * 1000); bhist.removePagesFromHost("mozilla.com", false); do_check_eq(1, bhist.count); @@ -115,7 +115,7 @@ function run_test() { * as if it was visited, and then marked as hidden */ //XXX NOT IMPLEMENTED in the history service - //bhist.addPageWithDetails(testURI, "testURI", Date.now()); + //bhist.addPageWithDetails(testURI, "testURI", Date.now() * 1000); //bhist.hidePage(testURI); //do_check_eq(0, bhist.count); } diff --git a/mozilla/toolkit/components/places/tests/unit/test_expiration.js b/mozilla/toolkit/components/places/tests/unit/test_expiration.js index f560f681913..62fa11569f5 100644 --- a/mozilla/toolkit/components/places/tests/unit/test_expiration.js +++ b/mozilla/toolkit/components/places/tests/unit/test_expiration.js @@ -139,9 +139,9 @@ function run_test() { histsvc.addVisit(removeAllTestURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0); var bmURI = uri("http://bookmarked"); bmsvc.insertBookmark(bmsvc.bookmarksMenuFolder, bmURI, bmsvc.DEFAULT_INDEX, "foo"); - //bhist.addPageWithDetails(placeURI, "place uri", Date.now()); + //bhist.addPageWithDetails(placeURI, "place uri", Date.now() * 1000); var placeURI = uri("place:folder=23"); - bhist.addPageWithDetails(placeURI, "place uri", Date.now()); + bhist.addPageWithDetails(placeURI, "place uri", Date.now() * 1000); annosvc.setPageAnnotation(removeAllTestURI, testAnnoName + "Hist", testAnnoVal, 0, annosvc.EXPIRE_WITH_HISTORY); annosvc.setPageAnnotation(removeAllTestURINever, testAnnoName + "Never", testAnnoVal, 0, annosvc.EXPIRE_NEVER); bhist.removeAllPages(); diff --git a/mozilla/toolkit/components/places/tests/unit/test_history.js b/mozilla/toolkit/components/places/tests/unit/test_history.js index ccab226503a..fd25d6b8706 100644 --- a/mozilla/toolkit/components/places/tests/unit/test_history.js +++ b/mozilla/toolkit/components/places/tests/unit/test_history.js @@ -56,7 +56,7 @@ try { */ function add_visit(aURI, aReferrer) { var placeID = histsvc.addVisit(aURI, - Date.now(), + Date.now() * 1000, aReferrer, histsvc.TRANSITION_TYPED, // user typed in URL bar false, // not redirect diff --git a/mozilla/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js b/mozilla/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js index 709ef9a11ec..d922913d2c0 100644 --- a/mozilla/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js +++ b/mozilla/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js @@ -53,7 +53,7 @@ try { // adds a test URI visit to the database, and checks for a valid place ID function add_visit(aURI, aDate) { - var date = aDate || Date.now(); + var date = aDate || Date.now() * 1000; var placeID = histsvc.addVisit(aURI, date, null, // no referrer @@ -152,7 +152,7 @@ function run_test() { do_check_eq(root.uri, viewer.changedItem.uri); // nsINavHistoryResultViewer.itemChanged for a leaf node - bhist.addPageWithDetails(testURI, "baz", Date.now()); + bhist.addPageWithDetails(testURI, "baz", Date.now() * 1000); do_check_eq(viewer.changedItem.title, "baz"); // nsINavHistoryResultViewer.itemRemoved diff --git a/mozilla/toolkit/components/places/tests/unit/test_resolveNullBookmarkTitles.js b/mozilla/toolkit/components/places/tests/unit/test_resolveNullBookmarkTitles.js index b19dea36d95..0b79eed3ebc 100644 --- a/mozilla/toolkit/components/places/tests/unit/test_resolveNullBookmarkTitles.js +++ b/mozilla/toolkit/components/places/tests/unit/test_resolveNullBookmarkTitles.js @@ -71,9 +71,9 @@ function run_test() { tagssvc.tagURI(uri1, ["tag 1"]); tagssvc.tagURI(uri2, ["tag 2"]); - histsvc.addVisit(uri1, Date.now(), null, histsvc.TRANSITION_TYPED, false, 0); + histsvc.addVisit(uri1, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0); histsvc.setPageDetails(uri1, "foo title", 0, false, true); - histsvc.addVisit(uri2, Date.now(), null, histsvc.TRANSITION_TYPED, false, 0); + histsvc.addVisit(uri2, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0); histsvc.setPageDetails(uri2, "bar title", 0, false, true); var options = histsvc.getNewQueryOptions();