diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 22:44:12 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 22:44:12 +0000 |
commit | aed132ed197e7b84184639941051713cb079c0e4 (patch) | |
tree | 97811324196e14727316df034a1cafa73ef925e4 /chrome/browser/visitedlink_unittest.cc | |
parent | 5eee02236e12ff013c35b0ec338b906fdc70c52e (diff) | |
download | chromium_src-aed132ed197e7b84184639941051713cb079c0e4.zip chromium_src-aed132ed197e7b84184639941051713cb079c0e4.tar.gz chromium_src-aed132ed197e7b84184639941051713cb079c0e4.tar.bz2 |
When importing a lot of history, the NOTREACHED in VisitedLinkMaster::AddFingerprint is reached. This causes an exit on debug builds, for production builds part of the history would silently not get imported. The root cause is that the initial size of the hash table only considers one of the two sources of input.
BUG=none
TEST=VisitedLinkTest::BigImport
Review URL: http://codereview.chromium.org/164419
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23773 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/visitedlink_unittest.cc')
-rw-r--r-- | chrome/browser/visitedlink_unittest.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/visitedlink_unittest.cc b/chrome/browser/visitedlink_unittest.cc index 8775f9e..fb4b109 100644 --- a/chrome/browser/visitedlink_unittest.cc +++ b/chrome/browser/visitedlink_unittest.cc @@ -399,6 +399,25 @@ TEST_F(VisitedLinkTest, Rebuild) { EXPECT_FALSE(master_->IsVisited(TestURL(g_test_count))); } +// Test that importing a large number of URLs will work +TEST_F(VisitedLinkTest, BigImport) { + ASSERT_TRUE(InitHistory()); + ASSERT_TRUE(InitVisited(0, false)); + + // Before the table rebuilds, add a large number of URLs + int total_count = VisitedLinkMaster::kDefaultTableSize + 10; + for (int i = 0; i < total_count; i++) + master_->AddURL(TestURL(i)); + + // Wait for the rebuild to complete. + master_->set_rebuild_complete_task(new MessageLoop::QuitTask); + MessageLoop::current()->Run(); + + // Ensure that the right number of URLs are present + int used_count = master_->GetUsedCount(); + ASSERT_EQ(used_count, total_count); +} + TEST_F(VisitedLinkTest, Listener) { ASSERT_TRUE(InitHistory()); ASSERT_TRUE(InitVisited(0, true)); |