| 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 "chrome/browser/android/offline_pages/test_request_coordinator_builder.
h" | 5 #include "chrome/browser/android/offline_pages/test_request_coordinator_builder.
h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "components/offline_pages/background/network_quality_provider_stub.h" | 9 #include "components/offline_pages/core/background/network_quality_provider_stub
.h" |
| 10 #include "components/offline_pages/background/offliner_factory_stub.h" | 10 #include "components/offline_pages/core/background/offliner_factory_stub.h" |
| 11 #include "components/offline_pages/background/offliner_policy.h" | 11 #include "components/offline_pages/core/background/offliner_policy.h" |
| 12 #include "components/offline_pages/background/request_coordinator.h" | 12 #include "components/offline_pages/core/background/request_coordinator.h" |
| 13 #include "components/offline_pages/background/request_queue.h" | 13 #include "components/offline_pages/core/background/request_queue.h" |
| 14 #include "components/offline_pages/background/request_queue_in_memory_store.h" | 14 #include "components/offline_pages/core/background/request_queue_in_memory_store
.h" |
| 15 #include "components/offline_pages/background/scheduler_stub.h" | 15 #include "components/offline_pages/core/background/scheduler_stub.h" |
| 16 #include "content/public/browser/browser_context.h" | 16 #include "content/public/browser/browser_context.h" |
| 17 | 17 |
| 18 namespace offline_pages { | 18 namespace offline_pages { |
| 19 | 19 |
| 20 std::unique_ptr<KeyedService> BuildTestRequestCoordinator( | 20 std::unique_ptr<KeyedService> BuildTestRequestCoordinator( |
| 21 content::BrowserContext* context) { | 21 content::BrowserContext* context) { |
| 22 // Use original policy. | 22 // Use original policy. |
| 23 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); | 23 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); |
| 24 | 24 |
| 25 // Use the in-memory store. | 25 // Use the in-memory store. |
| 26 std::unique_ptr<RequestQueueInMemoryStore> store( | 26 std::unique_ptr<RequestQueueInMemoryStore> store( |
| 27 new RequestQueueInMemoryStore()); | 27 new RequestQueueInMemoryStore()); |
| 28 // Use the regular test queue (should work). | 28 // Use the regular test queue (should work). |
| 29 std::unique_ptr<RequestQueue> queue(new RequestQueue(std::move(store))); | 29 std::unique_ptr<RequestQueue> queue(new RequestQueue(std::move(store))); |
| 30 | 30 |
| 31 // Initialize the rest with stubs. | 31 // Initialize the rest with stubs. |
| 32 std::unique_ptr<OfflinerFactory> offliner_factory(new OfflinerFactoryStub()); | 32 std::unique_ptr<OfflinerFactory> offliner_factory(new OfflinerFactoryStub()); |
| 33 std::unique_ptr<Scheduler> scheduler_stub(new SchedulerStub()); | 33 std::unique_ptr<Scheduler> scheduler_stub(new SchedulerStub()); |
| 34 | 34 |
| 35 // NetworkQualityProviderStub should be set by the test on the context first. | 35 // NetworkQualityProviderStub should be set by the test on the context first. |
| 36 NetworkQualityProviderStub* network_quality_provider = | 36 NetworkQualityProviderStub* network_quality_provider = |
| 37 NetworkQualityProviderStub::GetUserData(context); | 37 NetworkQualityProviderStub::GetUserData(context); |
| 38 | 38 |
| 39 return std::unique_ptr<RequestCoordinator>(new RequestCoordinator( | 39 return std::unique_ptr<RequestCoordinator>(new RequestCoordinator( |
| 40 std::move(policy), std::move(offliner_factory), std::move(queue), | 40 std::move(policy), std::move(offliner_factory), std::move(queue), |
| 41 std::move(scheduler_stub), network_quality_provider)); | 41 std::move(scheduler_stub), network_quality_provider)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // namespace offline_pages | 44 } // namespace offline_pages |
| OLD | NEW |