diff options
author | dglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-03 17:38:39 +0000 |
---|---|---|
committer | dglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-03 17:38:39 +0000 |
commit | 3e90d4a00082fd985ab610cd2faff84b5c597a4e (patch) | |
tree | 4d2f0da17f4fb68bab53381c9f49351380a24127 /chrome/browser/visitedlink_perftest.cc | |
parent | fd694982d0e1ee8b3e1753d9c48b01c1a633ac27 (diff) | |
download | chromium_src-3e90d4a00082fd985ab610cd2faff84b5c597a4e.zip chromium_src-3e90d4a00082fd985ab610cd2faff84b5c597a4e.tar.gz chromium_src-3e90d4a00082fd985ab610cd2faff84b5c597a4e.tar.bz2 |
Fix Acid3 Test 48: LINKTEST, Chromium side....
R=brettw
BUG=http://crbug.com/231
BUG=http://crubg.com/5160
TEST=ExpireHistoryTest.ArchiveSomeOldHistory
TEST=ExpireHistoryTest.ExpiringVisitsReader
TEST=VisitedLinkTest.Listener
TEST=VisitedLinkTest.Resizing
TEST=VisitedLinkRelayTest.*
TEST=VisitedLinkEventsTest.*
Review URL: http://codereview.chromium.org/113591
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19910 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/visitedlink_perftest.cc')
-rw-r--r-- | chrome/browser/visitedlink_perftest.cc | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/chrome/browser/visitedlink_perftest.cc b/chrome/browser/visitedlink_perftest.cc index cb2da7f..c1c6afa 100644 --- a/chrome/browser/visitedlink_perftest.cc +++ b/chrome/browser/visitedlink_perftest.cc @@ -30,10 +30,20 @@ GURL TestURL(const char* prefix, int i) { return GURL(StringPrintf("%s%d", prefix, i)); } -// we have no slaves, so this broadcase is a NOP -VisitedLinkMaster::PostNewTableEvent DummyBroadcastNewTableEvent; -void DummyBroadcastNewTableEvent(base::SharedMemory *table) { -} +// We have no slaves, so all methods on this listener are a no-ops. +class DummyVisitedLinkEventListener : public VisitedLinkMaster::Listener { + public: + DummyVisitedLinkEventListener() {} + virtual void NewTable(base::SharedMemory* table) {} + virtual void Add(VisitedLinkCommon::Fingerprint) {} + virtual void Reset() {} + + static DummyVisitedLinkEventListener* GetInstance() { + static DummyVisitedLinkEventListener instance; + return &instance; + } +}; + // Call at the beginning of the test to retrieve the database name. void InitDBName(std::wstring* db_name) { @@ -80,8 +90,8 @@ class VisitedLink : public testing::Test { // useful to make another set of tests to test these things in isolation. TEST_F(VisitedLink, TestAddAndQuery) { // init - VisitedLinkMaster master(NULL, DummyBroadcastNewTableEvent, NULL, true, - FilePath(db_name_), 0); + VisitedLinkMaster master(NULL, DummyVisitedLinkEventListener::GetInstance(), + NULL, true, FilePath(db_name_), 0); ASSERT_TRUE(master.Init()); PerfTimeLogger timer("Visited_link_add_and_query"); @@ -111,8 +121,8 @@ TEST_F(VisitedLink, TestLoad) { { PerfTimeLogger table_initialization_timer("Table_initialization"); - VisitedLinkMaster master(NULL, DummyBroadcastNewTableEvent, NULL, true, - FilePath(db_name_), 0); + VisitedLinkMaster master(NULL, DummyVisitedLinkEventListener::GetInstance(), + NULL, true, FilePath(db_name_), 0); // time init with empty table PerfTimeLogger initTimer("Empty_visited_link_init"); @@ -151,8 +161,12 @@ TEST_F(VisitedLink, TestLoad) { { PerfTimer cold_timer; - VisitedLinkMaster master(NULL, DummyBroadcastNewTableEvent, NULL, true, - FilePath(db_name_), 0); + VisitedLinkMaster master(NULL, + DummyVisitedLinkEventListener::GetInstance(), + NULL, + true, + FilePath(db_name_), + 0); bool success = master.Init(); TimeDelta elapsed = cold_timer.Elapsed(); ASSERT_TRUE(success); @@ -164,8 +178,12 @@ TEST_F(VisitedLink, TestLoad) { { PerfTimer hot_timer; - VisitedLinkMaster master(NULL, DummyBroadcastNewTableEvent, NULL, true, - FilePath(db_name_), 0); + VisitedLinkMaster master(NULL, + DummyVisitedLinkEventListener::GetInstance(), + NULL, + true, + FilePath(db_name_), + 0); bool success = master.Init(); TimeDelta elapsed = hot_timer.Elapsed(); ASSERT_TRUE(success); |