diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-02 05:59:37 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-02 05:59:37 +0000 |
commit | 6fad26338ed6119903826156f307e20fe6657c31 (patch) | |
tree | 5c6baed35fce907a0cea47ed6091c941db8ebfd1 /chrome/browser/visitedlink_unittest.cc | |
parent | f75c8f13b967b01babc9454506e9d2ed00519e39 (diff) | |
download | chromium_src-6fad26338ed6119903826156f307e20fe6657c31.zip chromium_src-6fad26338ed6119903826156f307e20fe6657c31.tar.gz chromium_src-6fad26338ed6119903826156f307e20fe6657c31.tar.bz2 |
Third patch in getting rid of caching MessageLoop pointers and always using ChromeThread instead.
BUG=25354
Review URL: http://codereview.chromium.org/342068
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30687 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/visitedlink_unittest.cc')
-rw-r--r-- | chrome/browser/visitedlink_unittest.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/chrome/browser/visitedlink_unittest.cc b/chrome/browser/visitedlink_unittest.cc index 7b238f6..d8906f7 100644 --- a/chrome/browser/visitedlink_unittest.cc +++ b/chrome/browser/visitedlink_unittest.cc @@ -12,6 +12,7 @@ #include "base/process_util.h" #include "base/shared_memory.h" #include "base/string_util.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/visitedlink_master.h" #include "chrome/browser/visitedlink_event_listener.h" #include "chrome/browser/renderer_host/browser_render_process_host.h" @@ -71,6 +72,9 @@ class TrackingVisitedLinkEventListener : public VisitedLinkMaster::Listener { class VisitedLinkTest : public testing::Test { protected: + VisitedLinkTest() + : ui_thread_(ChromeThread::UI, &message_loop_), + file_thread_(ChromeThread::FILE, &message_loop_) {} // Initialize the history system. This should be called before InitVisited(). bool InitHistory() { history_service_ = new HistoryService; @@ -84,7 +88,7 @@ class VisitedLinkTest : public testing::Test { // the VisitedLinkMaster constructor. bool InitVisited(int initial_size, bool suppress_rebuild) { // Initialize the visited link system. - master_.reset(new VisitedLinkMaster(NULL, &listener_, history_service_, + master_.reset(new VisitedLinkMaster(&listener_, history_service_, suppress_rebuild, visited_file_, initial_size)); return master_->Init(); @@ -170,6 +174,8 @@ class VisitedLinkTest : public testing::Test { } MessageLoop message_loop_; + ChromeThread ui_thread_; + ChromeThread file_thread_; // Filenames for the services; FilePath history_dir_; @@ -452,8 +458,7 @@ class VisitCountingProfile : public TestingProfile { virtual VisitedLinkMaster* GetVisitedLinkMaster() { if (!visited_link_master_.get()) { - visited_link_master_.reset( - new VisitedLinkMaster(NULL, event_listener_, this)); + visited_link_master_.reset(new VisitedLinkMaster(event_listener_, this)); visited_link_master_->Init(); } return visited_link_master_.get(); @@ -570,7 +575,14 @@ class VisitedLinkRenderProcessHostFactory class VisitedLinkEventsTest : public RenderViewHostTestHarness { public: - VisitedLinkEventsTest() : RenderViewHostTestHarness() {} + VisitedLinkEventsTest() + : RenderViewHostTestHarness(), + file_thread_(ChromeThread::FILE, &message_loop_) {} + ~VisitedLinkEventsTest() { + // This ends up using the file thread to schedule the delete. + profile_.reset(); + message_loop_.RunAllPending(); + } virtual void SetFactoryMode() {} virtual void SetUp() { SetFactoryMode(); @@ -596,6 +608,7 @@ class VisitedLinkEventsTest : public RenderViewHostTestHarness { private: scoped_ptr<VisitedLinkEventListener> event_listener_; + ChromeThread file_thread_; DISALLOW_COPY_AND_ASSIGN(VisitedLinkEventsTest); }; |