Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6827)

Unified Diff: chrome/renderer/render_thread_unittest.cc

Issue 155944: Switch the first thread in a child process to be the main thread... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/render_thread_unittest.cc
===================================================================
--- chrome/renderer/render_thread_unittest.cc (revision 21342)
+++ chrome/renderer/render_thread_unittest.cc (working copy)
@@ -18,7 +18,8 @@
virtual void SetUp() {
// Need a MODE_SERVER to make MODE_CLIENTs (like a RenderThread) happy.
channel_ = new IPC::Channel(kThreadName, IPC::Channel::MODE_SERVER, NULL);
- mock_process_.reset(new MockProcess(new RenderThread(kThreadName)));
+ mock_process_.reset(new MockProcess());
+ mock_process_->set_main_thread(new RenderThread(kThreadName));
}
virtual void TearDown() {
@@ -34,15 +35,13 @@
}
protected:
- MessageLoopForIO message_loop_;
+ MessageLoop message_loop_;
scoped_ptr<MockProcess> mock_process_;
IPC::Channel *channel_;
};
TEST_F(RenderThreadTest, TestGlobal) {
- // Can't reach the RenderThread object on other threads, since it's not
- // thread-safe!
- ASSERT_FALSE(RenderThread::current());
+ ASSERT_TRUE(RenderThread::current());
}
TEST_F(RenderThreadTest, TestVisitedMsg) {
@@ -55,7 +54,7 @@
ASSERT_TRUE(msg);
// Message goes nowhere, but this confirms Init() has happened.
// Unusually (?), RenderThread() Start()s itself in it's constructor.
- mock_process_->child_thread()->Send(msg);
+ mock_process_->main_thread()->Send(msg);
// No need to delete msg; per Message::Send() documentation, "The
// implementor takes ownership of the given Message regardless of

Powered by Google App Engine
This is Rietveld 408576698