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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 loop.Run(); | 192 loop.Run(); |
193 } | 193 } |
194 | 194 |
195 private: | 195 private: |
196 std::unique_ptr<InstanceState> TrackInstances() { | 196 std::unique_ptr<InstanceState> TrackInstances() { |
197 mojom::ServiceManagerPtr service_manager; | 197 mojom::ServiceManagerPtr service_manager; |
198 connector()->ConnectToInterface(service_manager::mojom::kServiceName, | 198 connector()->ConnectToInterface(service_manager::mojom::kServiceName, |
199 &service_manager); | 199 &service_manager); |
200 mojom::ServiceManagerListenerPtr listener; | 200 mojom::ServiceManagerListenerPtr listener; |
201 base::RunLoop loop; | 201 base::RunLoop loop; |
202 InstanceState* state = new InstanceState(GetProxy(&listener), &loop); | 202 InstanceState* state = new InstanceState(MakeRequest(&listener), &loop); |
203 service_manager->AddListener(std::move(listener)); | 203 service_manager->AddListener(std::move(listener)); |
204 loop.Run(); | 204 loop.Run(); |
205 return base::WrapUnique(state); | 205 return base::WrapUnique(state); |
206 } | 206 } |
207 | 207 |
208 std::unique_ptr<InstanceState> instances_; | 208 std::unique_ptr<InstanceState> instances_; |
209 | 209 |
210 DISALLOW_COPY_AND_ASSIGN(LifecycleTest); | 210 DISALLOW_COPY_AND_ASSIGN(LifecycleTest); |
211 }; | 211 }; |
212 | 212 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 lifecycle.set_connection_error_handler(base::Bind(&QuitLoop, &loop)); | 419 lifecycle.set_connection_error_handler(base::Bind(&QuitLoop, &loop)); |
420 process.Terminate(9, true); | 420 process.Terminate(9, true); |
421 loop.Run(); | 421 loop.Run(); |
422 | 422 |
423 WaitForInstanceDestruction(); | 423 WaitForInstanceDestruction(); |
424 EXPECT_FALSE(instances()->HasInstanceForName(kTestExeName)); | 424 EXPECT_FALSE(instances()->HasInstanceForName(kTestExeName)); |
425 EXPECT_EQ(0u, instances()->GetNewInstanceCount()); | 425 EXPECT_EQ(0u, instances()->GetNewInstanceCount()); |
426 } | 426 } |
427 | 427 |
428 } // namespace service_manager | 428 } // namespace service_manager |
OLD | NEW |