diff options
author | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-03 16:12:12 +0000 |
---|---|---|
committer | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-03 16:12:12 +0000 |
commit | bf8f7985cd58e415d27a29dcbccc94585fcb88fd (patch) | |
tree | 310eb6994badc36facda21a39c958915c426c301 /chrome/test | |
parent | 0401f2b8fa5add0f613c5524db9f3f77fd3e8bc3 (diff) | |
download | chromium_src-bf8f7985cd58e415d27a29dcbccc94585fcb88fd.zip chromium_src-bf8f7985cd58e415d27a29dcbccc94585fcb88fd.tar.gz chromium_src-bf8f7985cd58e415d27a29dcbccc94585fcb88fd.tar.bz2 |
Now uses a unique timestamp for each operation in typed url tests.
TypedURL tests would fail if you ever had two URLs added with the same
timestamp, because the history DB in the verifier profile would tweak the
timestamp to avoid duplicate times, leading to a mismatch when we verified
the sync results. We now ensure that all visit timestamps are unique.
BUG=84410
TEST=Run sync_integration_tests on win7.
Review URL: http://codereview.chromium.org/7110001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87788 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
4 files changed, 22 insertions, 13 deletions
diff --git a/chrome/test/live_sync/live_typed_urls_sync_test.cc b/chrome/test/live_sync/live_typed_urls_sync_test.cc index a42356e..9c8e789 100644 --- a/chrome/test/live_sync/live_typed_urls_sync_test.cc +++ b/chrome/test/live_sync/live_typed_urls_sync_test.cc @@ -52,7 +52,8 @@ class GetTypedUrlsTask : public HistoryDBTask { } // namespace LiveTypedUrlsSyncTest::LiveTypedUrlsSyncTest(TestType test_type) - : LiveSyncTest(test_type) {} + : LiveSyncTest(test_type), + timestamp_(base::Time::Now()) {} LiveTypedUrlsSyncTest::~LiveTypedUrlsSyncTest() {} @@ -73,8 +74,18 @@ LiveTypedUrlsSyncTest::GetTypedUrlsFromHistoryService(HistoryService *service) { return rows; } +base::Time LiveTypedUrlsSyncTest::GetTimestamp() { + // The history subsystem doesn't like identical timestamps for page visits, + // and it will massage the visit timestamps if we try to use identical + // values, which can lead to spurious errors. So make sure all timestamps + // are unique. + base::Time original = timestamp_; + timestamp_ += base::TimeDelta::FromMilliseconds(1); + return original; +} + void LiveTypedUrlsSyncTest::AddUrlToHistory(int index, const GURL& url) { - base::Time timestamp = base::Time::Now(); + base::Time timestamp = GetTimestamp(); AddToHistory(GetProfile(index)->GetHistoryServiceWithoutCreating(), url, timestamp); diff --git a/chrome/test/live_sync/live_typed_urls_sync_test.h b/chrome/test/live_sync/live_typed_urls_sync_test.h index 8c4cb6a..f6f8d61 100644 --- a/chrome/test/live_sync/live_typed_urls_sync_test.h +++ b/chrome/test/live_sync/live_typed_urls_sync_test.h @@ -45,6 +45,13 @@ class LiveTypedUrlsSyncTest : public LiveSyncTest { void AssertURLRowsAreEqual(const history::URLRow& left, const history::URLRow& right); + // Returns a unique timestamp to use when generating page visits + // (HistoryService does not like having identical timestamps and will modify + // the timestamps behind the scenes if it encounters them, which leads to + // spurious test failures when the resulting timestamps aren't what we + // expect). + base::Time GetTimestamp(); + private: // Waits for the history DB thread to finish executing its current set of // tasks. @@ -62,6 +69,8 @@ class LiveTypedUrlsSyncTest : public LiveSyncTest { // Helper object to make sure we don't leave tasks running on the history // thread. CancelableRequestConsumerT<int, 0> cancelable_consumer_; + + base::Time timestamp_; DISALLOW_COPY_AND_ASSIGN(LiveTypedUrlsSyncTest); }; diff --git a/chrome/test/live_sync/multiple_client_live_typed_urls_sync_test.cc b/chrome/test/live_sync/multiple_client_live_typed_urls_sync_test.cc index 4d031f9..8adffaf 100644 --- a/chrome/test/live_sync/multiple_client_live_typed_urls_sync_test.cc +++ b/chrome/test/live_sync/multiple_client_live_typed_urls_sync_test.cc @@ -29,12 +29,7 @@ IN_PROC_BROWSER_TEST_F(MultipleClientLiveTypedUrlsSyncTest, AddToOne) { AssertAllProfilesHaveSameURLsAsVerifier(); } -#if defined(OS_WIN) -// This test fails on the "Win7 Sync" bot. See http://crbug.com/84410. -IN_PROC_BROWSER_TEST_F(MultipleClientLiveTypedUrlsSyncTest, FAILS_AddToAll) { -#else IN_PROC_BROWSER_TEST_F(MultipleClientLiveTypedUrlsSyncTest, AddToAll) { -#endif const string16 kHistoryUrl( ASCIIToUTF16("http://www.add-all-history.google.com/")); ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; diff --git a/chrome/test/live_sync/two_client_live_typed_urls_sync_test.cc b/chrome/test/live_sync/two_client_live_typed_urls_sync_test.cc index b9a8623..49777c1 100644 --- a/chrome/test/live_sync/two_client_live_typed_urls_sync_test.cc +++ b/chrome/test/live_sync/two_client_live_typed_urls_sync_test.cc @@ -59,13 +59,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveTypedUrlsSyncTest, AddThenDelete) { } // TCM: 3643277 -#if defined(OS_WIN) -// This test fails on the "Win7 Sync" bot. See http://crbug.com/84410. -IN_PROC_BROWSER_TEST_F(TwoClientLiveTypedUrlsSyncTest, - FAILS_DisableEnableSync) { -#else IN_PROC_BROWSER_TEST_F(TwoClientLiveTypedUrlsSyncTest, DisableEnableSync) { -#endif const string16 kUrl1(ASCIIToUTF16("http://history1.google.com/")); const string16 kUrl2(ASCIIToUTF16("http://history2.google.com/")); ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |