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

Side by Side Diff: mojo/public/cpp/bindings/tests/e2e_perftest.cc

Issue 2620633004: Remove mojo::edk::test::ScopedIPCSupport (Closed)
Patch Set: . Created 3 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 | « mojo/public/cpp/bindings/tests/BUILD.gn ('k') | remoting/host/daemon_process_win.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <string> 5 #include <string>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/test/perf_time_logger.h" 14 #include "base/test/perf_time_logger.h"
15 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
16 #include "mojo/edk/embedder/embedder.h"
16 #include "mojo/edk/test/mojo_test_base.h" 17 #include "mojo/edk/test/mojo_test_base.h"
17 #include "mojo/edk/test/scoped_ipc_support.h"
18 #include "mojo/public/cpp/bindings/strong_binding.h" 18 #include "mojo/public/cpp/bindings/strong_binding.h"
19 #include "mojo/public/interfaces/bindings/tests/ping_service.mojom.h" 19 #include "mojo/public/interfaces/bindings/tests/ping_service.mojom.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 namespace mojo { 22 namespace mojo {
23 namespace { 23 namespace {
24 24
25 class EchoServiceImpl : public test::EchoService { 25 class EchoServiceImpl : public test::EchoService {
26 public: 26 public:
27 explicit EchoServiceImpl(const base::Closure& quit_closure); 27 explicit EchoServiceImpl(const base::Closure& quit_closure);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 MakeStrongBinding(base::MakeUnique<EchoServiceImpl>(cb), std::move(request)); 164 MakeStrongBinding(base::MakeUnique<EchoServiceImpl>(cb), std::move(request));
165 } 165 }
166 166
167 DEFINE_TEST_CLIENT_TEST_WITH_PIPE(PingService, MojoE2EPerftest, mp) { 167 DEFINE_TEST_CLIENT_TEST_WITH_PIPE(PingService, MojoE2EPerftest, mp) {
168 MojoHandle service_mp; 168 MojoHandle service_mp;
169 EXPECT_EQ("hello", ReadMessageWithHandles(mp, &service_mp, 1)); 169 EXPECT_EQ("hello", ReadMessageWithHandles(mp, &service_mp, 1));
170 170
171 InterfaceRequest<test::EchoService> request; 171 InterfaceRequest<test::EchoService> request;
172 request.Bind(ScopedMessagePipeHandle(MessagePipeHandle(service_mp))); 172 request.Bind(ScopedMessagePipeHandle(MessagePipeHandle(service_mp)));
173 base::RunLoop run_loop; 173 base::RunLoop run_loop;
174 edk::test::GetIoTaskRunner()->PostTask( 174 edk::GetIOTaskRunner()->PostTask(
175 FROM_HERE, 175 FROM_HERE,
176 base::Bind(&CreateAndRunService, base::Passed(&request), 176 base::Bind(&CreateAndRunService, base::Passed(&request),
177 base::Bind(base::IgnoreResult(&base::TaskRunner::PostTask), 177 base::Bind(base::IgnoreResult(&base::TaskRunner::PostTask),
178 message_loop_.task_runner(), FROM_HERE, 178 message_loop_.task_runner(), FROM_HERE,
179 run_loop.QuitClosure()))); 179 run_loop.QuitClosure())));
180 run_loop.Run(); 180 run_loop.Run();
181 } 181 }
182 182
183 TEST_F(MojoE2EPerftest, MultiProcessEchoMainThread) { 183 TEST_F(MojoE2EPerftest, MultiProcessEchoMainThread) {
184 RUN_CHILD_ON_PIPE(PingService, mp) 184 RUN_CHILD_ON_PIPE(PingService, mp)
185 MojoHandle client_mp, service_mp; 185 MojoHandle client_mp, service_mp;
186 CreateMessagePipe(&client_mp, &service_mp); 186 CreateMessagePipe(&client_mp, &service_mp);
187 WriteMessageWithHandles(mp, "hello", &service_mp, 1); 187 WriteMessageWithHandles(mp, "hello", &service_mp, 1);
188 RunTestOnTaskRunner(message_loop_.task_runner().get(), client_mp, 188 RunTestOnTaskRunner(message_loop_.task_runner().get(), client_mp,
189 "MultiProcessEchoMainThread"); 189 "MultiProcessEchoMainThread");
190 END_CHILD() 190 END_CHILD()
191 } 191 }
192 192
193 TEST_F(MojoE2EPerftest, MultiProcessEchoIoThread) { 193 TEST_F(MojoE2EPerftest, MultiProcessEchoIoThread) {
194 RUN_CHILD_ON_PIPE(PingService, mp) 194 RUN_CHILD_ON_PIPE(PingService, mp)
195 MojoHandle client_mp, service_mp; 195 MojoHandle client_mp, service_mp;
196 CreateMessagePipe(&client_mp, &service_mp); 196 CreateMessagePipe(&client_mp, &service_mp);
197 WriteMessageWithHandles(mp, "hello", &service_mp, 1); 197 WriteMessageWithHandles(mp, "hello", &service_mp, 1);
198 RunTestOnTaskRunner(edk::test::GetIoTaskRunner(), client_mp, 198 RunTestOnTaskRunner(edk::GetIOTaskRunner().get(), client_mp,
199 "MultiProcessEchoIoThread"); 199 "MultiProcessEchoIoThread");
200 END_CHILD() 200 END_CHILD()
201 } 201 }
202 202
203 } // namespace 203 } // namespace
204 } // namespace mojo 204 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/BUILD.gn ('k') | remoting/host/daemon_process_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698