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

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

Issue 1946573002: Revert of 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"
7 #include "mojo/edk/embedder/embedder.h" 8 #include "mojo/edk/embedder/embedder.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 10
10 namespace content { 11 namespace content {
11 12
12 class RenderThreadImplBrowserIPCTestHelper::DummyListener 13 class RenderThreadImplBrowserIPCTestHelper::DummyListener
13 : public IPC::Listener { 14 : public IPC::Listener {
14 public: 15 public:
15 bool OnMessageReceived(const IPC::Message& message) override { return true; } 16 bool OnMessageReceived(const IPC::Message& message) override { return true; }
16 }; 17 };
17 18
18 RenderThreadImplBrowserIPCTestHelper::RenderThreadImplBrowserIPCTestHelper() { 19 RenderThreadImplBrowserIPCTestHelper::RenderThreadImplBrowserIPCTestHelper() {
19 message_loop_.reset(new base::MessageLoopForIO()); 20 message_loop_.reset(new base::MessageLoopForIO());
20 21
21 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(""); 22 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("");
22 dummy_listener_.reset(new DummyListener()); 23 dummy_listener_.reset(new DummyListener());
23 24
24 SetupIpcThread(); 25 SetupIpcThread();
25 SetupMojo(); 26
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 }
26 } 34 }
27 35
28 RenderThreadImplBrowserIPCTestHelper::~RenderThreadImplBrowserIPCTestHelper() { 36 RenderThreadImplBrowserIPCTestHelper::~RenderThreadImplBrowserIPCTestHelper() {
29 } 37 }
30 38
31 void RenderThreadImplBrowserIPCTestHelper::SetupIpcThread() { 39 void RenderThreadImplBrowserIPCTestHelper::SetupIpcThread() {
32 ipc_thread_.reset(new base::Thread("test_ipc_thread")); 40 ipc_thread_.reset(new base::Thread("test_ipc_thread"));
33 base::Thread::Options options; 41 base::Thread::Options options;
34 options.message_loop_type = base::MessageLoop::TYPE_IO; 42 options.message_loop_type = base::MessageLoop::TYPE_IO;
35 ASSERT_TRUE(ipc_thread_->StartWithOptions(options)); 43 ASSERT_TRUE(ipc_thread_->StartWithOptions(options));
(...skipping 14 matching lines...) Expand all
50 mojo::edk::CreateParentMessagePipe(mojo_ipc_token_)), 58 mojo::edk::CreateParentMessagePipe(mojo_ipc_token_)),
51 dummy_listener_.get(), ipc_thread_->task_runner()); 59 dummy_listener_.get(), ipc_thread_->task_runner());
52 } 60 }
53 61
54 scoped_refptr<base::SingleThreadTaskRunner> 62 scoped_refptr<base::SingleThreadTaskRunner>
55 RenderThreadImplBrowserIPCTestHelper::GetIOTaskRunner() const { 63 RenderThreadImplBrowserIPCTestHelper::GetIOTaskRunner() const {
56 return ipc_thread_->task_runner(); 64 return ipc_thread_->task_runner();
57 } 65 }
58 66
59 } // namespace content 67 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | tools/ipc_fuzzer/message_replay/replay_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698