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

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

Issue 2019973002: [mojo-edk] Bind a child token to child launches and port reservations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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/public/browser/browser_child_process_host.h ('k') | mojo/edk/embedder/embedder.h » ('j') | 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 "mojo/edk/embedder/embedder.h" 7 #include "mojo/edk/embedder/embedder.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 {
(...skipping 20 matching lines...) Expand all
31 void RenderThreadImplBrowserIPCTestHelper::SetupIpcThread() { 31 void RenderThreadImplBrowserIPCTestHelper::SetupIpcThread() {
32 ipc_thread_.reset(new base::Thread("test_ipc_thread")); 32 ipc_thread_.reset(new base::Thread("test_ipc_thread"));
33 base::Thread::Options options; 33 base::Thread::Options options;
34 options.message_loop_type = base::MessageLoop::TYPE_IO; 34 options.message_loop_type = base::MessageLoop::TYPE_IO;
35 ASSERT_TRUE(ipc_thread_->StartWithOptions(options)); 35 ASSERT_TRUE(ipc_thread_->StartWithOptions(options));
36 } 36 }
37 37
38 void RenderThreadImplBrowserIPCTestHelper::SetupMojo() { 38 void RenderThreadImplBrowserIPCTestHelper::SetupMojo() {
39 InitializeMojo(); 39 InitializeMojo();
40 40
41 std::string child_token = mojo::edk::GenerateRandomToken();
41 ipc_support_.reset(new IPC::ScopedIPCSupport(ipc_thread_->task_runner())); 42 ipc_support_.reset(new IPC::ScopedIPCSupport(ipc_thread_->task_runner()));
42 mojo_application_host_.reset(new MojoApplicationHost()); 43 mojo_application_host_.reset(new MojoApplicationHost(child_token));
43 mojo_application_token_ = mojo_application_host_->GetToken(); 44 mojo_application_token_ = mojo_application_host_->GetToken();
44 45
45 mojo_ipc_token_ = mojo::edk::GenerateRandomToken(); 46 mojo_ipc_token_ = mojo::edk::GenerateRandomToken();
46 47
47 mojo::MessagePipe pipe; 48 mojo::MessagePipe pipe;
48 channel_ = IPC::ChannelProxy::Create( 49 channel_ = IPC::ChannelProxy::Create(
49 IPC::ChannelMojo::CreateServerFactory( 50 IPC::ChannelMojo::CreateServerFactory(
50 mojo::edk::CreateParentMessagePipe(mojo_ipc_token_)), 51 mojo::edk::CreateParentMessagePipe(mojo_ipc_token_, child_token)),
51 dummy_listener_.get(), ipc_thread_->task_runner()); 52 dummy_listener_.get(), ipc_thread_->task_runner());
52 } 53 }
53 54
54 scoped_refptr<base::SingleThreadTaskRunner> 55 scoped_refptr<base::SingleThreadTaskRunner>
55 RenderThreadImplBrowserIPCTestHelper::GetIOTaskRunner() const { 56 RenderThreadImplBrowserIPCTestHelper::GetIOTaskRunner() const {
56 return ipc_thread_->task_runner(); 57 return ipc_thread_->task_runner();
57 } 58 }
58 59
59 } // namespace content 60 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/browser_child_process_host.h ('k') | mojo/edk/embedder/embedder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698