summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history/history_unittest.cc
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-06 17:03:33 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-06 17:03:33 +0000
commitc5b88d8d0642a8a8b1e623439a443ccc6322d0f5 (patch)
treec428090843d96de998ff81f8f4a557e22102e5d8 /chrome/browser/history/history_unittest.cc
parent2e0edab8a891ce9cdc3228d4e31a691563fd0828 (diff)
downloadchromium_src-c5b88d8d0642a8a8b1e623439a443ccc6322d0f5.zip
chromium_src-c5b88d8d0642a8a8b1e623439a443ccc6322d0f5.tar.gz
chromium_src-c5b88d8d0642a8a8b1e623439a443ccc6322d0f5.tar.bz2
Move timestamp de-duping logic from HistoryBackend to NavigationController
Encapsulate the de-duping logic in a new class TimeSmoother. Improve the logic to avoid dupes completely unless the clock jumps backwards. Note that moving the de-duping logic to NavigationController means that timestamps are de-duped per-tab. But this is okay given the problem we're trying to solve (which I added a comment about). Add function to override timestamp generation for testing. BUG=128449 Review URL: https://chromiumcodereview.appspot.com/11043028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160578 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history/history_unittest.cc')
-rw-r--r--chrome/browser/history/history_unittest.cc40
1 files changed, 0 insertions, 40 deletions
diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc
index bddb08d..f4fa4d4 100644
--- a/chrome/browser/history/history_unittest.cc
+++ b/chrome/browser/history/history_unittest.cc
@@ -496,46 +496,6 @@ TEST_F(HistoryTest, AddPage) {
EXPECT_FALSE(query_url_row_.hidden()); // Because loaded in main frame.
}
-TEST_F(HistoryTest, AddPageSameTimes) {
- scoped_refptr<HistoryService> history(new HistoryService);
- history_service_ = history;
- ASSERT_TRUE(history->Init(history_dir_, NULL));
-
- Time now = Time::Now();
- const GURL test_urls[] = {
- GURL("http://timer.first.page/"),
- GURL("http://timer.second.page/"),
- GURL("http://timer.third.page/"),
- };
-
- // Make sure that two pages added at the same time with no intervening
- // additions have different timestamps.
- history->AddPage(test_urls[0], now, NULL, 0, GURL(),
- history::RedirectList(), content::PAGE_TRANSITION_LINK,
- history::SOURCE_BROWSED, false);
- EXPECT_TRUE(QueryURL(history, test_urls[0]));
- EXPECT_EQ(1, query_url_row_.visit_count());
- EXPECT_TRUE(now == query_url_row_.last_visit()); // gtest doesn't like Time
-
- history->AddPage(test_urls[1], now, NULL, 0, GURL(),
- history::RedirectList(), content::PAGE_TRANSITION_LINK,
- history::SOURCE_BROWSED, false);
- EXPECT_TRUE(QueryURL(history, test_urls[1]));
- EXPECT_EQ(1, query_url_row_.visit_count());
- EXPECT_TRUE(now + TimeDelta::FromMicroseconds(1) ==
- query_url_row_.last_visit());
-
- // Make sure the next page, at a different time, is also correct.
- history->AddPage(test_urls[2], now + TimeDelta::FromMinutes(1),
- NULL, 0, GURL(), history::RedirectList(),
- content::PAGE_TRANSITION_LINK, history::SOURCE_BROWSED,
- false);
- EXPECT_TRUE(QueryURL(history, test_urls[2]));
- EXPECT_EQ(1, query_url_row_.visit_count());
- EXPECT_TRUE(now + TimeDelta::FromMinutes(1) ==
- query_url_row_.last_visit());
-}
-
TEST_F(HistoryTest, AddRedirect) {
scoped_refptr<HistoryService> history(new HistoryService);
history_service_ = history;