| OLD | NEW | 
|---|
| 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 <stddef.h> | 5 #include <stddef.h> | 
| 6 #include <stdint.h> | 6 #include <stdint.h> | 
| 7 | 7 | 
| 8 #include <memory> | 8 #include <memory> | 
| 9 #include <utility> | 9 #include <utility> | 
| 10 | 10 | 
| 11 #include "base/bind.h" | 11 #include "base/bind.h" | 
| 12 #include "base/guid.h" | 12 #include "base/guid.h" | 
| 13 #include "base/macros.h" | 13 #include "base/macros.h" | 
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" | 
| 15 #include "base/test/test_suite.h" | 15 #include "base/test/test_suite.h" | 
| 16 #include "mojo/public/cpp/bindings/binding_set.h" | 16 #include "mojo/public/cpp/bindings/binding_set.h" | 
| 17 #include "services/service_manager/public/cpp/names.h" | 17 #include "services/service_manager/public/cpp/names.h" | 
| 18 #include "services/service_manager/public/cpp/service_test.h" | 18 #include "services/service_manager/public/cpp/service_test.h" | 
| 19 #include "services/service_manager/public/interfaces/service_manager.mojom.h" | 19 #include "services/service_manager/public/interfaces/service_manager.mojom.h" | 
| 20 #include "services/service_manager/tests/connect/connect_test.mojom.h" | 20 #include "services/service_manager/tests/connect/connect_test.mojom.h" | 
| 21 | 21 | 
| 22 // Tests that multiple services can be packaged in a single service by | 22 // Tests that multiple services can be packaged in a single service by | 
| 23 // implementing ServiceFactory; that these services can be specified by | 23 // implementing ServiceFactory; that these services can be specified by | 
| 24 // the package's manifest and are thus registered with the PackageManager. | 24 // the package's manifest and are thus registered with the PackageManager. | 
| 25 | 25 | 
| 26 namespace shell { | 26 namespace service_manager { | 
| 27 | 27 | 
| 28 namespace { | 28 namespace { | 
| 29 | 29 | 
| 30 const char kTestPackageName[] = "service:connect_test_package"; | 30 const char kTestPackageName[] = "service:connect_test_package"; | 
| 31 const char kTestAppName[] = "service:connect_test_app"; | 31 const char kTestAppName[] = "service:connect_test_app"; | 
| 32 const char kTestAppAName[] = "service:connect_test_a"; | 32 const char kTestAppAName[] = "service:connect_test_a"; | 
| 33 const char kTestAppBName[] = "service:connect_test_b"; | 33 const char kTestAppBName[] = "service:connect_test_b"; | 
| 34 const char kTestClassAppName[] = "service:connect_test_class_app"; | 34 const char kTestClassAppName[] = "service:connect_test_class_app"; | 
| 35 const char kTestSingletonAppName[] = "service:connect_test_singleton_app"; | 35 const char kTestSingletonAppName[] = "service:connect_test_singleton_app"; | 
| 36 const char kTestDriverName[] = "exe:connect_test_driver"; | 36 const char kTestDriverName[] = "exe:connect_test_driver"; | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 49                        const std::string& in_string_2) { | 49                        const std::string& in_string_2) { | 
| 50   *out_string_1 = in_string_1; | 50   *out_string_1 = in_string_1; | 
| 51   *out_string_2 = in_string_2; | 51   *out_string_2 = in_string_2; | 
| 52   loop->Quit(); | 52   loop->Quit(); | 
| 53 } | 53 } | 
| 54 | 54 | 
| 55 void ReceiveConnectionResult(mojom::ConnectResult* out_result, | 55 void ReceiveConnectionResult(mojom::ConnectResult* out_result, | 
| 56                              Identity* out_target, | 56                              Identity* out_target, | 
| 57                              base::RunLoop* loop, | 57                              base::RunLoop* loop, | 
| 58                              int32_t in_result, | 58                              int32_t in_result, | 
| 59                              const shell::Identity& in_identity) { | 59                              const service_manager::Identity& in_identity) { | 
| 60   *out_result = static_cast<mojom::ConnectResult>(in_result); | 60   *out_result = static_cast<mojom::ConnectResult>(in_result); | 
| 61   *out_target = in_identity; | 61   *out_target = in_identity; | 
| 62   loop->Quit(); | 62   loop->Quit(); | 
| 63 } | 63 } | 
| 64 | 64 | 
| 65 void QuitLoop(base::RunLoop* loop) { | 65 void QuitLoop(base::RunLoop* loop) { | 
| 66   loop->Quit(); | 66   loop->Quit(); | 
| 67 } | 67 } | 
| 68 | 68 | 
| 69 }  // namespace | 69 }  // namespace | 
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 405   { | 405   { | 
| 406     base::RunLoop loop; | 406     base::RunLoop loop; | 
| 407     inherit_connection->AddConnectionCompletedClosure( | 407     inherit_connection->AddConnectionCompletedClosure( | 
| 408         base::Bind(&QuitLoop, &loop)); | 408         base::Bind(&QuitLoop, &loop)); | 
| 409     loop.Run(); | 409     loop.Run(); | 
| 410     EXPECT_EQ(inherit_connection->GetRemoteIdentity().user_id(), | 410     EXPECT_EQ(inherit_connection->GetRemoteIdentity().user_id(), | 
| 411               connection->GetRemoteIdentity().user_id()); | 411               connection->GetRemoteIdentity().user_id()); | 
| 412   } | 412   } | 
| 413 } | 413 } | 
| 414 | 414 | 
| 415 }  // namespace shell | 415 }  // namespace service_manager | 
| OLD | NEW | 
|---|