diff options
Diffstat (limited to 'content/browser/browser_thread_unittest.cc')
-rw-r--r-- | content/browser/browser_thread_unittest.cc | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/content/browser/browser_thread_unittest.cc b/content/browser/browser_thread_unittest.cc index 3f1f8cd..9b23057 100644 --- a/content/browser/browser_thread_unittest.cc +++ b/content/browser/browser_thread_unittest.cc @@ -4,10 +4,10 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/location.h" #include "base/memory/scoped_ptr.h" -#include "base/message_loop/message_loop.h" -#include "base/message_loop/message_loop_proxy.h" #include "base/sequenced_task_runner_helpers.h" +#include "base/single_thread_task_runner.h" #include "content/browser/browser_thread_impl.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -19,7 +19,7 @@ class BrowserThreadTest : public testing::Test { public: void Release() const { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + loop_.task_runner()->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); } protected: @@ -37,7 +37,8 @@ class BrowserThreadTest : public testing::Test { static void BasicFunction(base::MessageLoop* message_loop) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + message_loop->task_runner()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); } class DeletedOnFile @@ -53,7 +54,8 @@ class BrowserThreadTest : public testing::Test { ~DeletedOnFile() { CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - message_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + message_loop_->task_runner()->PostTask(FROM_HERE, + base::MessageLoop::QuitClosure()); } base::MessageLoop* message_loop_; @@ -88,24 +90,24 @@ TEST_F(BrowserThreadTest, ReleasedOnCorrectThread) { base::MessageLoop::current()->Run(); } -TEST_F(BrowserThreadTest, PostTaskViaMessageLoopProxy) { - scoped_refptr<base::MessageLoopProxy> message_loop_proxy = +TEST_F(BrowserThreadTest, PostTaskViaTaskRunner) { + scoped_refptr<base::SingleThreadTaskRunner> task_runner = BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); - message_loop_proxy->PostTask( + task_runner->PostTask( FROM_HERE, base::Bind(&BasicFunction, base::MessageLoop::current())); base::MessageLoop::current()->Run(); } -TEST_F(BrowserThreadTest, ReleaseViaMessageLoopProxy) { - scoped_refptr<base::MessageLoopProxy> message_loop_proxy = +TEST_F(BrowserThreadTest, ReleaseViaTaskRunner) { + scoped_refptr<base::SingleThreadTaskRunner> task_runner = BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); - message_loop_proxy->ReleaseSoon(FROM_HERE, this); + task_runner->ReleaseSoon(FROM_HERE, this); base::MessageLoop::current()->Run(); } TEST_F(BrowserThreadTest, PostTaskAndReply) { // Most of the heavy testing for PostTaskAndReply() is done inside the - // MessageLoopProxy test. This just makes sure we get piped through at all. + // task runner test. This just makes sure we get piped through at all. ASSERT_TRUE(BrowserThread::PostTaskAndReply( BrowserThread::FILE, FROM_HERE, |