| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/resource_coordinator/coordination_unit/coordination_unit_impl
_unittest_util.h" | 5 #include "services/resource_coordinator/coordination_unit/coordination_unit_impl
_unittest_util.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 | 9 |
| 10 namespace resource_coordinator { | 10 namespace resource_coordinator { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 void OnLastServiceRefDestroyed() { | 14 void OnLastServiceRefDestroyed() { |
| 15 // No-op. This is required by service_manager::ServiceContextRefFactory | 15 // No-op. This is required by service_manager::ServiceContextRefFactory |
| 16 // construction but not needed for the tests. | 16 // construction but not needed for the tests. |
| 17 } | 17 } |
| 18 | 18 |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 CoordinationUnitImplTestBase::CoordinationUnitImplTestBase() | 21 CoordinationUnitImplTestBase::CoordinationUnitImplTestBase() |
| 22 : service_ref_factory_(base::Bind(&OnLastServiceRefDestroyed)), | 22 : service_ref_factory_(base::Bind(&OnLastServiceRefDestroyed)), |
| 23 provider_(&service_ref_factory_) {} | 23 provider_(&service_ref_factory_, &coordination_unit_manager_) { |
| 24 // Ensure tests only include the observers that are needed instead |
| 25 // of what is registered by default to run in a browser instance. |
| 26 coordination_unit_manager_.UnregisterAllObserversForTesting(); |
| 27 } |
| 24 | 28 |
| 25 CoordinationUnitImplTestBase::~CoordinationUnitImplTestBase() = default; | 29 CoordinationUnitImplTestBase::~CoordinationUnitImplTestBase() = default; |
| 26 | 30 |
| 27 void CoordinationUnitImplTestBase::TearDown() { | 31 void CoordinationUnitImplTestBase::TearDown() { |
| 28 base::RunLoop().RunUntilIdle(); | 32 base::RunLoop().RunUntilIdle(); |
| 29 } | 33 } |
| 30 | 34 |
| 31 } // namespace resource_coordinator | 35 } // namespace resource_coordinator |
| OLD | NEW |