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

Side by Side Diff: content/test/render_thread_impl_browser_test_ipc_helper.cc

Issue 1941003002: Turn on MojoChannel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/test/render_thread_impl_browser_test_ipc_helper.h" 5 #include "content/test/render_thread_impl_browser_test_ipc_helper.h"
6 6
7 #include "content/public/common/mojo_channel_switches.h"
8 #include "mojo/edk/embedder/embedder.h" 7 #include "mojo/edk/embedder/embedder.h"
9 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
10 9
11 namespace content { 10 namespace content {
12 11
13 class RenderThreadImplBrowserIPCTestHelper::DummyListener 12 class RenderThreadImplBrowserIPCTestHelper::DummyListener
14 : public IPC::Listener { 13 : public IPC::Listener {
15 public: 14 public:
16 bool OnMessageReceived(const IPC::Message& message) override { return true; } 15 bool OnMessageReceived(const IPC::Message& message) override { return true; }
17 }; 16 };
18 17
19 RenderThreadImplBrowserIPCTestHelper::RenderThreadImplBrowserIPCTestHelper() { 18 RenderThreadImplBrowserIPCTestHelper::RenderThreadImplBrowserIPCTestHelper() {
20 message_loop_.reset(new base::MessageLoopForIO()); 19 message_loop_.reset(new base::MessageLoopForIO());
21 20
22 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(""); 21 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("");
23 dummy_listener_.reset(new DummyListener()); 22 dummy_listener_.reset(new DummyListener());
24 23
25 SetupIpcThread(); 24 SetupIpcThread();
26 25 SetupMojo();
27 if (ShouldUseMojoChannel()) {
28 SetupMojo();
29 } else {
30 channel_ = IPC::ChannelProxy::Create(channel_id_, IPC::Channel::MODE_SERVER,
31 dummy_listener_.get(),
32 ipc_thread_->task_runner());
33 }
34 } 26 }
35 27
36 RenderThreadImplBrowserIPCTestHelper::~RenderThreadImplBrowserIPCTestHelper() { 28 RenderThreadImplBrowserIPCTestHelper::~RenderThreadImplBrowserIPCTestHelper() {
37 } 29 }
38 30
39 void RenderThreadImplBrowserIPCTestHelper::SetupIpcThread() { 31 void RenderThreadImplBrowserIPCTestHelper::SetupIpcThread() {
40 ipc_thread_.reset(new base::Thread("test_ipc_thread")); 32 ipc_thread_.reset(new base::Thread("test_ipc_thread"));
41 base::Thread::Options options; 33 base::Thread::Options options;
42 options.message_loop_type = base::MessageLoop::TYPE_IO; 34 options.message_loop_type = base::MessageLoop::TYPE_IO;
43 ASSERT_TRUE(ipc_thread_->StartWithOptions(options)); 35 ASSERT_TRUE(ipc_thread_->StartWithOptions(options));
(...skipping 14 matching lines...) Expand all
58 mojo::edk::CreateParentMessagePipe(mojo_ipc_token_)), 50 mojo::edk::CreateParentMessagePipe(mojo_ipc_token_)),
59 dummy_listener_.get(), ipc_thread_->task_runner()); 51 dummy_listener_.get(), ipc_thread_->task_runner());
60 } 52 }
61 53
62 scoped_refptr<base::SingleThreadTaskRunner> 54 scoped_refptr<base::SingleThreadTaskRunner>
63 RenderThreadImplBrowserIPCTestHelper::GetIOTaskRunner() const { 55 RenderThreadImplBrowserIPCTestHelper::GetIOTaskRunner() const {
64 return ipc_thread_->task_runner(); 56 return ipc_thread_->task_runner();
65 } 57 }
66 58
67 } // namespace content 59 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698