| 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 "components/offline_pages/background/request_coordinator.h" | 5 #include "components/offline_pages/background/request_coordinator.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 RequestQueue::GetRequestsResult last_get_requests_result_; | 110 RequestQueue::GetRequestsResult last_get_requests_result_; |
| 111 std::vector<SavePageRequest> last_requests_; | 111 std::vector<SavePageRequest> last_requests_; |
| 112 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; | 112 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
| 113 base::ThreadTaskRunnerHandle task_runner_handle_; | 113 base::ThreadTaskRunnerHandle task_runner_handle_; |
| 114 std::unique_ptr<RequestCoordinator> coordinator_; | 114 std::unique_ptr<RequestCoordinator> coordinator_; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 RequestCoordinatorTest::RequestCoordinatorTest() | 117 RequestCoordinatorTest::RequestCoordinatorTest() |
| 118 : last_get_requests_result_(RequestQueue::GetRequestsResult::kStoreFailure), | 118 : last_get_requests_result_(RequestQueue::GetRequestsResult::STORE_FAILURE), |
| 119 task_runner_(new base::TestSimpleTaskRunner), | 119 task_runner_(new base::TestSimpleTaskRunner), |
| 120 task_runner_handle_(task_runner_) {} | 120 task_runner_handle_(task_runner_) {} |
| 121 | 121 |
| 122 RequestCoordinatorTest::~RequestCoordinatorTest() {} | 122 RequestCoordinatorTest::~RequestCoordinatorTest() {} |
| 123 | 123 |
| 124 void RequestCoordinatorTest::SetUp() { | 124 void RequestCoordinatorTest::SetUp() { |
| 125 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); | 125 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); |
| 126 std::unique_ptr<OfflinerFactory> factory(new OfflinerFactoryStub()); | 126 std::unique_ptr<OfflinerFactory> factory(new OfflinerFactoryStub()); |
| 127 std::unique_ptr<RequestQueueInMemoryStore> | 127 std::unique_ptr<RequestQueueInMemoryStore> |
| 128 store(new RequestQueueInMemoryStore()); | 128 store(new RequestQueueInMemoryStore()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 EXPECT_EQ(kUrl, last_requests()[0].url()); | 168 EXPECT_EQ(kUrl, last_requests()[0].url()); |
| 169 EXPECT_EQ(kClientId, last_requests()[0].client_id()); | 169 EXPECT_EQ(kClientId, last_requests()[0].client_id()); |
| 170 | 170 |
| 171 // Expect that the scheduler got notified. | 171 // Expect that the scheduler got notified. |
| 172 SchedulerStub* scheduler_stub = reinterpret_cast<SchedulerStub*>( | 172 SchedulerStub* scheduler_stub = reinterpret_cast<SchedulerStub*>( |
| 173 coordinator()->scheduler()); | 173 coordinator()->scheduler()); |
| 174 EXPECT_TRUE(scheduler_stub->schedule_called()); | 174 EXPECT_TRUE(scheduler_stub->schedule_called()); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace offline_pages | 177 } // namespace offline_pages |
| OLD | NEW |