From c38831a108f9f905ce9e68503ee67274939cc950 Mon Sep 17 00:00:00 2001 From: "joi@chromium.org" Date: Fri, 28 Oct 2011 12:44:49 +0000 Subject: Split BrowserThread into public API and private implementation, step 1. Only content/ now has the ability to create BrowserThread objects, with the exception that tests can create the content::TestBrowserThread subclass, and (temporarily) code in chrome/ can create the DeprecatedBrowserThread subclass. A follow-up change will make content/ take care of its own thread creation, remove DeprecatedBrowserThread, and move all state and non-trivial constructors from BrowserThread down to BrowserThreadImpl. Also moved BrowserProcessSubThread into content/ namespace. As part of follow-up cleanup, chrome/ will stop using this class. BUG=98716 TEST=existing Review URL: http://codereview.chromium.org/8392042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107718 0039d316-1c4b-4281-b951-d872f2087c98 --- content/browser/browser_thread_unittest.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'content/browser/browser_thread_unittest.cc') diff --git a/content/browser/browser_thread_unittest.cc b/content/browser/browser_thread_unittest.cc index f5f6e47..11ccecc 100644 --- a/content/browser/browser_thread_unittest.cc +++ b/content/browser/browser_thread_unittest.cc @@ -6,10 +6,13 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" -#include "content/browser/browser_thread.h" +#include "content/browser/browser_thread_impl.h" +#include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +namespace content { + class BrowserThreadTest : public testing::Test { public: void Release() const { @@ -19,8 +22,8 @@ class BrowserThreadTest : public testing::Test { protected: virtual void SetUp() { - ui_thread_.reset(new BrowserThread(BrowserThread::UI)); - file_thread_.reset(new BrowserThread(BrowserThread::FILE)); + ui_thread_.reset(new BrowserThreadImpl(BrowserThread::UI)); + file_thread_.reset(new BrowserThreadImpl(BrowserThread::FILE)); ui_thread_->Start(); file_thread_->Start(); } @@ -79,8 +82,8 @@ class BrowserThreadTest : public testing::Test { }; private: - scoped_ptr ui_thread_; - scoped_ptr file_thread_; + scoped_ptr ui_thread_; + scoped_ptr file_thread_; // It's kind of ugly to make this mutable - solely so we can post the Quit // Task from Release(). This should be fixed. mutable MessageLoop loop_; @@ -156,7 +159,8 @@ TEST_F(BrowserThreadTest, TaskToNonExistentThreadIsDeletedViaMessageLoopProxy) { } TEST_F(BrowserThreadTest, PostTaskViaMessageLoopProxyAfterThreadExits) { - scoped_ptr io_thread(new BrowserThread(BrowserThread::IO)); + scoped_ptr io_thread( + new BrowserThreadImpl(BrowserThread::IO)); io_thread->Start(); io_thread->Stop(); @@ -170,7 +174,8 @@ TEST_F(BrowserThreadTest, PostTaskViaMessageLoopProxyAfterThreadExits) { TEST_F(BrowserThreadTest, PostTaskViaMessageLoopProxyAfterThreadIsDeleted) { { - scoped_ptr io_thread(new BrowserThread(BrowserThread::IO)); + scoped_ptr io_thread( + new BrowserThreadImpl(BrowserThread::IO)); io_thread->Start(); } bool deleted = false; @@ -180,3 +185,5 @@ TEST_F(BrowserThreadTest, PostTaskViaMessageLoopProxyAfterThreadIsDeleted) { EXPECT_FALSE(ret); EXPECT_TRUE(deleted); } + +} -- cgit v1.1