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

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

Issue 2226403002: Remove Channel token from InProcessChildThreadParams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moar-channels
Patch Set: rebase Created 4 years, 4 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 | « content/test/render_thread_impl_browser_test_ipc_helper.h ('k') | 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/test/render_thread_impl_browser_test_ipc_helper.h"
6
7 #include "mojo/edk/embedder/embedder.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace content {
11
12 class RenderThreadImplBrowserIPCTestHelper::DummyListener
13 : public IPC::Listener {
14 public:
15 bool OnMessageReceived(const IPC::Message& message) override { return true; }
16 };
17
18 RenderThreadImplBrowserIPCTestHelper::RenderThreadImplBrowserIPCTestHelper() {
19 message_loop_.reset(new base::MessageLoopForIO());
20
21 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("");
22 dummy_listener_.reset(new DummyListener());
23
24 SetupIpcThread();
25 SetupMojo();
26 }
27
28 RenderThreadImplBrowserIPCTestHelper::~RenderThreadImplBrowserIPCTestHelper() {
29 }
30
31 void RenderThreadImplBrowserIPCTestHelper::SetupIpcThread() {
32 ipc_thread_.reset(new base::Thread("test_ipc_thread"));
33 base::Thread::Options options;
34 options.message_loop_type = base::MessageLoop::TYPE_IO;
35 ASSERT_TRUE(ipc_thread_->StartWithOptions(options));
36 }
37
38 void RenderThreadImplBrowserIPCTestHelper::SetupMojo() {
39 InitializeMojo();
40
41 std::string child_token = mojo::edk::GenerateRandomToken();
42 ipc_support_.reset(
43 new mojo::edk::test::ScopedIPCSupport(ipc_thread_->task_runner()));
44 mojo_application_token_ = mojo::edk::GenerateRandomToken();
45
46 mojo_ipc_token_ = mojo::edk::GenerateRandomToken();
47
48 mojo::MessagePipe pipe;
49 channel_ = IPC::ChannelProxy::Create(
50 IPC::ChannelMojo::CreateServerFactory(
51 mojo::edk::CreateParentMessagePipe(mojo_ipc_token_, child_token),
52 ipc_thread_->task_runner()),
53 dummy_listener_.get(), ipc_thread_->task_runner());
54 }
55
56 scoped_refptr<base::SingleThreadTaskRunner>
57 RenderThreadImplBrowserIPCTestHelper::GetIOTaskRunner() const {
58 return ipc_thread_->task_runner();
59 }
60
61 } // namespace content
OLDNEW
« no previous file with comments | « content/test/render_thread_impl_browser_test_ipc_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698