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

Side by Side Diff: ipc/mojo/ipc_mojo_bootstrap_unittest.cc

Issue 1185133006: IPC: Make ChannelReader inherit from SupportsAttachmentBrokering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from tsepez. Created 5 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 | « ipc/mojo/ipc_mojo_bootstrap.cc ('k') | ipc/mojo/ipc_mojo_perftest.cc » ('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 "ipc/mojo/ipc_mojo_bootstrap.h" 5 #include "ipc/mojo/ipc_mojo_bootstrap.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "ipc/ipc_test_base.h" 10 #include "ipc/ipc_test_base.h"
(...skipping 29 matching lines...) Expand all
40 40
41 void TestingDelegate::OnBootstrapError() { 41 void TestingDelegate::OnBootstrapError() {
42 base::MessageLoop::current()->Quit(); 42 base::MessageLoop::current()->Quit();
43 } 43 }
44 44
45 TEST_F(IPCMojoBootstrapTest, Connect) { 45 TEST_F(IPCMojoBootstrapTest, Connect) {
46 Init("IPCMojoBootstrapTestClient"); 46 Init("IPCMojoBootstrapTestClient");
47 47
48 TestingDelegate delegate; 48 TestingDelegate delegate;
49 scoped_ptr<IPC::MojoBootstrap> bootstrap = IPC::MojoBootstrap::Create( 49 scoped_ptr<IPC::MojoBootstrap> bootstrap = IPC::MojoBootstrap::Create(
50 GetTestChannelHandle(), IPC::Channel::MODE_SERVER, &delegate); 50 GetTestChannelHandle(), IPC::Channel::MODE_SERVER, &delegate, nullptr);
51 51
52 ASSERT_TRUE(bootstrap->Connect()); 52 ASSERT_TRUE(bootstrap->Connect());
53 #if defined(OS_POSIX) 53 #if defined(OS_POSIX)
54 ASSERT_TRUE(StartClientWithFD(bootstrap->GetClientFileDescriptor())); 54 ASSERT_TRUE(StartClientWithFD(bootstrap->GetClientFileDescriptor()));
55 #else 55 #else
56 ASSERT_TRUE(StartClient()); 56 ASSERT_TRUE(StartClient());
57 #endif 57 #endif
58 bootstrap->OnClientLaunched(client_process().Handle()); 58 bootstrap->OnClientLaunched(client_process().Handle());
59 59
60 base::MessageLoop::current()->Run(); 60 base::MessageLoop::current()->Run();
61 61
62 EXPECT_TRUE(delegate.passed()); 62 EXPECT_TRUE(delegate.passed());
63 EXPECT_TRUE(WaitForClientShutdown()); 63 EXPECT_TRUE(WaitForClientShutdown());
64 } 64 }
65 65
66 // A long running process that connects to us. 66 // A long running process that connects to us.
67 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(IPCMojoBootstrapTestClient) { 67 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(IPCMojoBootstrapTestClient) {
68 base::MessageLoopForIO main_message_loop; 68 base::MessageLoopForIO main_message_loop;
69 69
70 TestingDelegate delegate; 70 TestingDelegate delegate;
71 scoped_ptr<IPC::MojoBootstrap> bootstrap = IPC::MojoBootstrap::Create( 71 scoped_ptr<IPC::MojoBootstrap> bootstrap = IPC::MojoBootstrap::Create(
72 IPCTestBase::GetChannelName("IPCMojoBootstrapTestClient"), 72 IPCTestBase::GetChannelName("IPCMojoBootstrapTestClient"),
73 IPC::Channel::MODE_CLIENT, 73 IPC::Channel::MODE_CLIENT,
74 &delegate); 74 &delegate,
75 nullptr);
75 76
76 bootstrap->Connect(); 77 bootstrap->Connect();
77 78
78 base::MessageLoop::current()->Run(); 79 base::MessageLoop::current()->Run();
79 80
80 EXPECT_TRUE(delegate.passed()); 81 EXPECT_TRUE(delegate.passed());
81 82
82 return 0; 83 return 0;
83 } 84 }
84 85
85 } // namespace 86 } // namespace
OLDNEW
« no previous file with comments | « ipc/mojo/ipc_mojo_bootstrap.cc ('k') | ipc/mojo/ipc_mojo_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698