OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/bind.h" |
| 6 #include "base/macros.h" |
| 7 #include "mojo/application/public/cpp/application_impl.h" |
| 8 #include "mojo/application/public/cpp/application_test_base.h" |
| 9 #include "mojo/converters/network/network_type_converters.h" |
| 10 #include "mojo/runner/child/test_native_service.mojom.h" |
| 11 |
| 12 namespace mojo { |
| 13 namespace runner { |
| 14 namespace { |
| 15 void InvertCallback(bool* result, bool from_native) { |
| 16 *result = from_native; |
| 17 } |
| 18 } // namespace |
| 19 |
| 20 using NativeAppTest = mojo::test::ApplicationTestBase; |
| 21 |
| 22 TEST_F(NativeAppTest, Connect) { |
| 23 test::TestNativeServicePtr native_service; |
| 24 application_impl()->ConnectToService( |
| 25 mojo::URLRequest::From( |
| 26 std::string("exe:mojo_runner_child_apptest_native_target")), |
| 27 &native_service); |
| 28 |
| 29 bool result = false; |
| 30 native_service->Invert( |
| 31 true, base::Bind(&InvertCallback, base::Unretained(&result))); |
| 32 native_service.WaitForIncomingResponse(); |
| 33 EXPECT_FALSE(result); |
| 34 |
| 35 native_service->Invert( |
| 36 false, base::Bind(&InvertCallback, base::Unretained(&result))); |
| 37 native_service.WaitForIncomingResponse(); |
| 38 EXPECT_TRUE(result); |
| 39 } |
| 40 |
| 41 } // namespace runner |
| 42 } // namespace mojo |
OLD | NEW |