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

Side by Side Diff: mojo/runner/child/native_apptest.cc

Issue 1455833005: Convert ConnectToApplication to take a params class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 1 month 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/mojo_services.gyp ('k') | mojo/services/network/http_server_apptest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "mojo/application/public/cpp/application_impl.h" 7 #include "mojo/application/public/cpp/application_impl.h"
8 #include "mojo/application/public/cpp/application_test_base.h" 8 #include "mojo/application/public/cpp/application_test_base.h"
9 #include "mojo/converters/network/network_type_converters.h" 9 #include "mojo/converters/network/network_type_converters.h"
10 #include "mojo/runner/child/test_native_service.mojom.h" 10 #include "mojo/runner/child/test_native_service.mojom.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace runner { 13 namespace runner {
14 namespace { 14 namespace {
15 void InvertCallback(bool* result, bool from_native) { 15 void InvertCallback(bool* result, bool from_native) {
16 *result = from_native; 16 *result = from_native;
17 } 17 }
18 } // namespace 18 } // namespace
19 19
20 using NativeAppTest = mojo::test::ApplicationTestBase; 20 using NativeAppTest = mojo::test::ApplicationTestBase;
21 21
22 TEST_F(NativeAppTest, Connect) { 22 TEST_F(NativeAppTest, Connect) {
23 test::TestNativeServicePtr native_service; 23 test::TestNativeServicePtr native_service;
24 application_impl()->ConnectToService( 24 application_impl()->ConnectToService(
25 mojo::URLRequest::From( 25 "exe:mojo_runner_child_apptest_native_target", &native_service);
26 std::string("exe:mojo_runner_child_apptest_native_target")),
27 &native_service);
28 26
29 bool result = false; 27 bool result = false;
30 native_service->Invert( 28 native_service->Invert(
31 true, base::Bind(&InvertCallback, base::Unretained(&result))); 29 true, base::Bind(&InvertCallback, base::Unretained(&result)));
32 native_service.WaitForIncomingResponse(); 30 native_service.WaitForIncomingResponse();
33 EXPECT_FALSE(result); 31 EXPECT_FALSE(result);
34 32
35 native_service->Invert( 33 native_service->Invert(
36 false, base::Bind(&InvertCallback, base::Unretained(&result))); 34 false, base::Bind(&InvertCallback, base::Unretained(&result)));
37 native_service.WaitForIncomingResponse(); 35 native_service.WaitForIncomingResponse();
38 EXPECT_TRUE(result); 36 EXPECT_TRUE(result);
39 } 37 }
40 38
41 } // namespace runner 39 } // namespace runner
42 } // namespace mojo 40 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/mojo_services.gyp ('k') | mojo/services/network/http_server_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698