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 "services/service_manager/background/background_service_manager.h" | 5 #include "services/service_manager/background/background_service_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // and connects to background_service_manager_test_service, verifying we can | 46 // and connects to background_service_manager_test_service, verifying we can |
47 // send a message to the service. | 47 // send a message to the service. |
48 #if defined(OS_ANDROID) | 48 #if defined(OS_ANDROID) |
49 // TODO(crbug.com/589784): This test is disabled, as it fails | 49 // TODO(crbug.com/589784): This test is disabled, as it fails |
50 // on the Android GN bot. | 50 // on the Android GN bot. |
51 #define MAYBE_Basic DISABLED_Basic | 51 #define MAYBE_Basic DISABLED_Basic |
52 #else | 52 #else |
53 #define MAYBE_Basic Basic | 53 #define MAYBE_Basic Basic |
54 #endif | 54 #endif |
55 TEST(BackgroundServiceManagerTest, MAYBE_Basic) { | 55 TEST(BackgroundServiceManagerTest, MAYBE_Basic) { |
56 BackgroundServiceManager background_service_manager; | 56 BackgroundServiceManager background_service_manager(nullptr, nullptr); |
57 base::MessageLoop message_loop; | 57 base::MessageLoop message_loop; |
58 background_service_manager.Init(nullptr); | 58 mojom::ServicePtr service; |
59 ServiceContext service_context( | 59 ServiceContext service_context(base::MakeUnique<ServiceImpl>(), |
60 base::MakeUnique<ServiceImpl>(), | 60 mojom::ServiceRequest(&service)); |
61 background_service_manager.CreateServiceRequest(kTestName)); | 61 background_service_manager.RegisterService( |
| 62 Identity(kTestName, mojom::kRootUserID), std::move(service), nullptr); |
| 63 |
62 mojom::TestServicePtr test_service; | 64 mojom::TestServicePtr test_service; |
63 service_context.connector()->BindInterface(kAppName, &test_service); | 65 service_context.connector()->BindInterface(kAppName, &test_service); |
64 base::RunLoop run_loop; | 66 base::RunLoop run_loop; |
65 bool got_result = false; | 67 bool got_result = false; |
66 test_service->Test( | 68 test_service->Test( |
67 base::Bind(&SetFlagAndRunClosure, &got_result, run_loop.QuitClosure())); | 69 base::Bind(&SetFlagAndRunClosure, &got_result, run_loop.QuitClosure())); |
68 run_loop.Run(); | 70 run_loop.Run(); |
69 EXPECT_TRUE(got_result); | 71 EXPECT_TRUE(got_result); |
70 } | 72 } |
71 | 73 |
72 } // namespace service_manager | 74 } // namespace service_manager |
OLD | NEW |