| 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 <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER) != 0); | 516 RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER) != 0); |
| 517 | 517 |
| 518 // Expect that a request got placed on the queue. | 518 // Expect that a request got placed on the queue. |
| 519 coordinator()->queue()->GetRequests( | 519 coordinator()->queue()->GetRequests( |
| 520 base::Bind(&RequestCoordinatorTest::GetRequestsDone, | 520 base::Bind(&RequestCoordinatorTest::GetRequestsDone, |
| 521 base::Unretained(this))); | 521 base::Unretained(this))); |
| 522 | 522 |
| 523 // Wait for callbacks to finish, both request queue and offliner. | 523 // Wait for callbacks to finish, both request queue and offliner. |
| 524 PumpLoop(); | 524 PumpLoop(); |
| 525 // Will not be called since the offliner is disabled. | 525 // Will not be called since the offliner is disabled. |
| 526 EXPECT_FALSE(immediate_schedule_callback_called()); | 526 // On low-end devices the callback will be called with false since the |
| 527 // processing started but failed due to svelte devices. |
| 528 if (base::SysInfo::IsLowEndDevice()) { |
| 529 EXPECT_TRUE(immediate_schedule_callback_called()); |
| 530 } else { |
| 531 EXPECT_FALSE(immediate_schedule_callback_called()); |
| 532 } |
| 527 | 533 |
| 528 // Check the request queue is as expected. | 534 // Check the request queue is as expected. |
| 529 EXPECT_EQ(1UL, last_requests().size()); | 535 EXPECT_EQ(1UL, last_requests().size()); |
| 530 EXPECT_EQ(kUrl1, last_requests().at(0)->url()); | 536 EXPECT_EQ(kUrl1, last_requests().at(0)->url()); |
| 531 EXPECT_EQ(kClientId1, last_requests().at(0)->client_id()); | 537 EXPECT_EQ(kClientId1, last_requests().at(0)->client_id()); |
| 532 | 538 |
| 533 // Expect that the scheduler got notified. | 539 // Expect that the scheduler got notified. |
| 534 SchedulerStub* scheduler_stub = reinterpret_cast<SchedulerStub*>( | 540 SchedulerStub* scheduler_stub = reinterpret_cast<SchedulerStub*>( |
| 535 coordinator()->scheduler()); | 541 coordinator()->scheduler()); |
| 536 EXPECT_TRUE(scheduler_stub->schedule_called()); | 542 EXPECT_TRUE(scheduler_stub->schedule_called()); |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 // Now whether processing triggered immediately depends on whether test | 1360 // Now whether processing triggered immediately depends on whether test |
| 1355 // is run on svelte device or not. | 1361 // is run on svelte device or not. |
| 1356 if (base::SysInfo::IsLowEndDevice()) { | 1362 if (base::SysInfo::IsLowEndDevice()) { |
| 1357 EXPECT_FALSE(is_busy()); | 1363 EXPECT_FALSE(is_busy()); |
| 1358 } else { | 1364 } else { |
| 1359 EXPECT_TRUE(is_busy()); | 1365 EXPECT_TRUE(is_busy()); |
| 1360 } | 1366 } |
| 1361 } | 1367 } |
| 1362 | 1368 |
| 1363 } // namespace offline_pages | 1369 } // namespace offline_pages |
| OLD | NEW |