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

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

Issue 873913002: Revert of Disable Mojo on RenderThreadImplBrowserTest on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ipc/mojo/ipc_channel_mojo_host.h" 7 #include "ipc/mojo/ipc_channel_mojo_host.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 class RenderThreadImplBrowserIPCTestHelper::DummyListener 12 class RenderThreadImplBrowserIPCTestHelper::DummyListener
13 : public IPC::Listener { 13 : public IPC::Listener {
14 public: 14 public:
15 bool OnMessageReceived(const IPC::Message& message) override { return true; } 15 bool OnMessageReceived(const IPC::Message& message) override { return true; }
16 }; 16 };
17 17
18 RenderThreadImplBrowserIPCTestHelper::RenderThreadImplBrowserIPCTestHelper() { 18 RenderThreadImplBrowserIPCTestHelper::RenderThreadImplBrowserIPCTestHelper() {
19 message_loop_.reset(new base::MessageLoopForIO()); 19 message_loop_.reset(new base::MessageLoopForIO());
20 20
21 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(""); 21 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("");
22 dummy_listener_.reset(new DummyListener()); 22 dummy_listener_.reset(new DummyListener());
23 23
24 SetupIpcThread(); 24 SetupIpcThread();
25 25
26 // TODO(crbug.com/451221): Mojo should be used here even for Android. 26 if (IPC::ChannelMojo::ShouldBeUsed()) {
27 // Currently SetupMojo() calls InitializeMojo() which can be called at most
28 // once for each process. This implices that every test case using
29 // RenderThreadImplBrowserIPCTestHelper has to run in a dedicated process, but
30 // that is false on OS_ANDROID. There is no way to call InitializeMojo() only
31 // if it isn't initialized yet.
32 #if defined(OS_ANDROID)
33 bool use_mojo_channel = false;
34 #else
35 bool use_mojo_channel = IPC::ChannelMojo::ShouldBeUsed();
36 #endif
37 if (use_mojo_channel) {
38 SetupMojo(); 27 SetupMojo();
39 } else { 28 } else {
40 channel_ = IPC::ChannelProxy::Create(channel_id_, IPC::Channel::MODE_SERVER, 29 channel_ = IPC::ChannelProxy::Create(channel_id_, IPC::Channel::MODE_SERVER,
41 dummy_listener_.get(), 30 dummy_listener_.get(),
42 ipc_thread_->task_runner()); 31 ipc_thread_->task_runner());
43 } 32 }
44 } 33 }
45 34
46 RenderThreadImplBrowserIPCTestHelper::~RenderThreadImplBrowserIPCTestHelper() { 35 RenderThreadImplBrowserIPCTestHelper::~RenderThreadImplBrowserIPCTestHelper() {
47 } 36 }
(...skipping 16 matching lines...) Expand all
64 channel_id_), 53 channel_id_),
65 dummy_listener_.get(), ipc_thread_->task_runner()); 54 dummy_listener_.get(), ipc_thread_->task_runner());
66 55
67 mojo_application_host_->Init(); 56 mojo_application_host_->Init();
68 mojo_application_host_->Activate(channel_.get(), 57 mojo_application_host_->Activate(channel_.get(),
69 base::GetCurrentProcessHandle()); 58 base::GetCurrentProcessHandle());
70 mojo_host_->OnClientLaunched(base::GetCurrentProcessHandle()); 59 mojo_host_->OnClientLaunched(base::GetCurrentProcessHandle());
71 } 60 }
72 61
73 } // namespace content 62 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698