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(nullptr, nullptr); | 56 BackgroundServiceManager background_service_manager; |
57 base::MessageLoop message_loop; | 57 base::MessageLoop message_loop; |
58 mojom::ServicePtr service; | 58 background_service_manager.Init(nullptr); |
59 ServiceContext service_context(base::MakeUnique<ServiceImpl>(), | 59 ServiceContext service_context( |
60 mojom::ServiceRequest(&service)); | 60 base::MakeUnique<ServiceImpl>(), |
61 background_service_manager.RegisterService( | 61 background_service_manager.CreateServiceRequest(kTestName)); |
62 Identity(kTestName, mojom::kRootUserID), std::move(service), nullptr); | |
63 | |
64 mojom::TestServicePtr test_service; | 62 mojom::TestServicePtr test_service; |
65 service_context.connector()->BindInterface(kAppName, &test_service); | 63 service_context.connector()->BindInterface(kAppName, &test_service); |
66 base::RunLoop run_loop; | 64 base::RunLoop run_loop; |
67 bool got_result = false; | 65 bool got_result = false; |
68 test_service->Test( | 66 test_service->Test( |
69 base::Bind(&SetFlagAndRunClosure, &got_result, run_loop.QuitClosure())); | 67 base::Bind(&SetFlagAndRunClosure, &got_result, run_loop.QuitClosure())); |
70 run_loop.Run(); | 68 run_loop.Run(); |
71 EXPECT_TRUE(got_result); | 69 EXPECT_TRUE(got_result); |
72 } | 70 } |
73 | 71 |
74 } // namespace service_manager | 72 } // namespace service_manager |
OLD | NEW |