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

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

Issue 866973004: 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 if (IPC::ChannelMojo::ShouldBeUsed()) { 26 // TODO(crbug.com/451221): Mojo should be used here even for Android.
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)
sky 2015/01/23 00:43:49 Is there some other switch you can use rather than
33 bool use_mojo_channel = false;
34 #else
35 bool use_mojo_channel = IPC::ChannelMojo::ShouldBeUsed();
36 #endif
37 if (use_mojo_channel) {
27 SetupMojo(); 38 SetupMojo();
28 } else { 39 } else {
29 channel_ = IPC::ChannelProxy::Create(channel_id_, IPC::Channel::MODE_SERVER, 40 channel_ = IPC::ChannelProxy::Create(channel_id_, IPC::Channel::MODE_SERVER,
30 dummy_listener_.get(), 41 dummy_listener_.get(),
31 ipc_thread_->task_runner()); 42 ipc_thread_->task_runner());
32 } 43 }
33 } 44 }
34 45
35 RenderThreadImplBrowserIPCTestHelper::~RenderThreadImplBrowserIPCTestHelper() { 46 RenderThreadImplBrowserIPCTestHelper::~RenderThreadImplBrowserIPCTestHelper() {
36 } 47 }
(...skipping 16 matching lines...) Expand all
53 channel_id_), 64 channel_id_),
54 dummy_listener_.get(), ipc_thread_->task_runner()); 65 dummy_listener_.get(), ipc_thread_->task_runner());
55 66
56 mojo_application_host_->Init(); 67 mojo_application_host_->Init();
57 mojo_application_host_->Activate(channel_.get(), 68 mojo_application_host_->Activate(channel_.get(),
58 base::GetCurrentProcessHandle()); 69 base::GetCurrentProcessHandle());
59 mojo_host_->OnClientLaunched(base::GetCurrentProcessHandle()); 70 mojo_host_->OnClientLaunched(base::GetCurrentProcessHandle());
60 } 71 }
61 72
62 } // namespace content 73 } // 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