summaryrefslogtreecommitdiffstats
path: root/content/test/test_browser_thread.cc
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-03 13:04:40 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-03 13:04:40 +0000
commit24210ecbd8ed89268c5f67ecb02440c5fadf98a9 (patch)
tree029692c1ca490c3d2b8223d83ec7b5b1a9b7fe0e /content/test/test_browser_thread.cc
parent4926b7d95ed4783c0c1d6aa5e8043fff5b6d6c47 (diff)
downloadchromium_src-24210ecbd8ed89268c5f67ecb02440c5fadf98a9.zip
chromium_src-24210ecbd8ed89268c5f67ecb02440c5fadf98a9.tar.gz
chromium_src-24210ecbd8ed89268c5f67ecb02440c5fadf98a9.tar.bz2
Switch to composition for TestBrowserThread.
This avoids exposing BrowserThreadImpl internals outside of content/, and goes most of the way to not exposing the fact that underneath, it is a base::Thread. There are only three test files that use the TestBrowserThread::DeprecatedGetThreadObject method. TBR=owners BUG=98716 Review URL: http://codereview.chromium.org/8440039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/test/test_browser_thread.cc')
-rw-r--r--content/test/test_browser_thread.cc34
1 files changed, 30 insertions, 4 deletions
diff --git a/content/test/test_browser_thread.cc b/content/test/test_browser_thread.cc
index ca90930..f3e6cc8 100644
--- a/content/test/test_browser_thread.cc
+++ b/content/test/test_browser_thread.cc
@@ -4,18 +4,44 @@
#include "content/test/test_browser_thread.h"
+#include "base/threading/thread.h"
+#include "content/browser/browser_thread_impl.h"
+
namespace content {
-TestBrowserThread::TestBrowserThread(ID identifier)
- : BrowserThreadImpl(identifier) {
+TestBrowserThread::TestBrowserThread(BrowserThread::ID identifier)
+ : impl(new BrowserThreadImpl(identifier)) {
}
-TestBrowserThread::TestBrowserThread(ID identifier, MessageLoop* message_loop)
- : BrowserThreadImpl(identifier, message_loop) {
+TestBrowserThread::TestBrowserThread(BrowserThread::ID identifier,
+ MessageLoop* message_loop)
+ : impl(new BrowserThreadImpl(identifier, message_loop)) {
}
TestBrowserThread::~TestBrowserThread() {
Stop();
}
+bool TestBrowserThread::Start() {
+ return impl->Start();
+}
+
+bool TestBrowserThread::StartIOThread() {
+ base::Thread::Options options;
+ options.message_loop_type = MessageLoop::TYPE_IO;
+ return impl->StartWithOptions(options);
+}
+
+void TestBrowserThread::Stop() {
+ impl->Stop();
+}
+
+bool TestBrowserThread::IsRunning() {
+ return impl->IsRunning();
+}
+
+base::Thread* TestBrowserThread::DeprecatedGetThreadObject() {
+ return impl.get();
+}
+
} // namespace content