OLD | NEW |
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 "services/shell/public/cpp/application_test_base.h" | 7 #include "services/shell/public/cpp/application_test_base.h" |
8 #include "services/shell/runner/child/test_native_service.mojom.h" | 8 #include "services/shell/runner/child/test_native_service.mojom.h" |
9 | 9 |
10 namespace mojo { | |
11 namespace shell { | 10 namespace shell { |
| 11 |
12 namespace { | 12 namespace { |
| 13 |
13 void InvertCallback(bool* result, bool from_native) { | 14 void InvertCallback(bool* result, bool from_native) { |
14 *result = from_native; | 15 *result = from_native; |
15 } | 16 } |
| 17 |
16 } // namespace | 18 } // namespace |
17 | 19 |
18 using NativeAppTest = mojo::test::ApplicationTestBase; | 20 using NativeAppTest = test::ApplicationTestBase; |
19 | 21 |
20 TEST_F(NativeAppTest, Connect) { | 22 TEST_F(NativeAppTest, Connect) { |
21 test::TestNativeServicePtr native_service; | 23 test::TestNativeServicePtr native_service; |
22 connector()->ConnectToInterface("exe:mojo_runner_child_apptest_native_target", | 24 connector()->ConnectToInterface("exe:mojo_runner_child_apptest_native_target", |
23 &native_service); | 25 &native_service); |
24 | 26 |
25 bool result = false; | 27 bool result = false; |
26 native_service->Invert( | 28 native_service->Invert( |
27 true, base::Bind(&InvertCallback, base::Unretained(&result))); | 29 true, base::Bind(&InvertCallback, base::Unretained(&result))); |
28 native_service.WaitForIncomingResponse(); | 30 native_service.WaitForIncomingResponse(); |
29 EXPECT_FALSE(result); | 31 EXPECT_FALSE(result); |
30 | 32 |
31 native_service->Invert( | 33 native_service->Invert( |
32 false, base::Bind(&InvertCallback, base::Unretained(&result))); | 34 false, base::Bind(&InvertCallback, base::Unretained(&result))); |
33 native_service.WaitForIncomingResponse(); | 35 native_service.WaitForIncomingResponse(); |
34 EXPECT_TRUE(result); | 36 EXPECT_TRUE(result); |
35 } | 37 } |
36 | 38 |
37 } // namespace shell | 39 } // namespace shell |
38 } // namespace mojo | |
OLD | NEW |