Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1325)

Side by Side Diff: components/offline_pages/background/request_coordinator_unittest.cc

Issue 2347783003: [OfflinePages, NetworkQualityEstimator] Use NetworkQualityEstimator to decide on triggering Backgro… (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 void RequestCoordinatorTest::SetUp() { 301 void RequestCoordinatorTest::SetUp() {
302 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); 302 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy());
303 std::unique_ptr<OfflinerFactory> factory(new OfflinerFactoryStub()); 303 std::unique_ptr<OfflinerFactory> factory(new OfflinerFactoryStub());
304 // Save the offliner for use by the tests. 304 // Save the offliner for use by the tests.
305 offliner_ = 305 offliner_ =
306 reinterpret_cast<OfflinerStub*>(factory->GetOffliner(policy.get())); 306 reinterpret_cast<OfflinerStub*>(factory->GetOffliner(policy.get()));
307 std::unique_ptr<RequestQueueInMemoryStore> 307 std::unique_ptr<RequestQueueInMemoryStore>
308 store(new RequestQueueInMemoryStore()); 308 store(new RequestQueueInMemoryStore());
309 std::unique_ptr<RequestQueue> queue(new RequestQueue(std::move(store))); 309 std::unique_ptr<RequestQueue> queue(new RequestQueue(std::move(store)));
310 std::unique_ptr<Scheduler> scheduler_stub(new SchedulerStub()); 310 std::unique_ptr<Scheduler> scheduler_stub(new SchedulerStub());
311 // TODO(dougarnett): Add NetworkQualityProvider and tests for its use.
312 std::unique_ptr<net::NetworkQualityEstimator::NetworkQualityProvider> nqe(
313 nullptr);
311 coordinator_.reset(new RequestCoordinator( 314 coordinator_.reset(new RequestCoordinator(
312 std::move(policy), std::move(factory), std::move(queue), 315 std::move(policy), std::move(factory), std::move(queue),
313 std::move(scheduler_stub))); 316 std::move(scheduler_stub), std::move(nqe)));
314 coordinator_->AddObserver(&observer_); 317 coordinator_->AddObserver(&observer_);
315 } 318 }
316 319
317 void RequestCoordinatorTest::PumpLoop() { 320 void RequestCoordinatorTest::PumpLoop() {
318 task_runner_->RunUntilIdle(); 321 task_runner_->RunUntilIdle();
319 } 322 }
320 323
321 void RequestCoordinatorTest::GetRequestsDone( 324 void RequestCoordinatorTest::GetRequestsDone(
322 RequestQueue::GetRequestsResult result, 325 RequestQueue::GetRequestsResult result,
323 std::vector<std::unique_ptr<SavePageRequest>> requests) { 326 std::vector<std::unique_ptr<SavePageRequest>> requests) {
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 // Now whether processing triggered immediately depends on whether test 1028 // Now whether processing triggered immediately depends on whether test
1026 // is run on svelte device or not. 1029 // is run on svelte device or not.
1027 if (base::SysInfo::IsLowEndDevice()) { 1030 if (base::SysInfo::IsLowEndDevice()) {
1028 EXPECT_FALSE(is_busy()); 1031 EXPECT_FALSE(is_busy());
1029 } else { 1032 } else {
1030 EXPECT_TRUE(is_busy()); 1033 EXPECT_TRUE(is_busy());
1031 } 1034 }
1032 } 1035 }
1033 1036
1034 } // namespace offline_pages 1037 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698