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/core/background/request_coordinator.h" | 5 #include "components/offline_pages/core/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 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 // Wait for async get to finish. | 1294 // Wait for async get to finish. |
1295 WaitForCallback(); | 1295 WaitForCallback(); |
1296 PumpLoop(); | 1296 PumpLoop(); |
1297 | 1297 |
1298 // Check that the statuses found in the callback match what we expect. | 1298 // Check that the statuses found in the callback match what we expect. |
1299 EXPECT_EQ(2UL, last_requests().size()); | 1299 EXPECT_EQ(2UL, last_requests().size()); |
1300 EXPECT_EQ(kRequestId1, last_requests().at(0)->request_id()); | 1300 EXPECT_EQ(kRequestId1, last_requests().at(0)->request_id()); |
1301 EXPECT_EQ(kRequestId2, last_requests().at(1)->request_id()); | 1301 EXPECT_EQ(kRequestId2, last_requests().at(1)->request_id()); |
1302 } | 1302 } |
1303 | 1303 |
1304 #if defined(OS_IOS) | 1304 TEST_F(RequestCoordinatorTest, PauseAndResumeObserver) { |
1305 // Flaky on IOS. http://crbug/663311 | |
1306 #define MAYBE_PauseAndResumeObserver DISABLED_PauseAndResumeObserver | |
1307 #else | |
1308 #define MAYBE_PauseAndResumeObserver PauseAndResumeObserver | |
1309 #endif | |
1310 TEST_F(RequestCoordinatorTest, MAYBE_PauseAndResumeObserver) { | |
1311 // Set low-end device status to actual status. | 1305 // Set low-end device status to actual status. |
1312 SetIsLowEndDeviceForTest(base::SysInfo::IsLowEndDevice()); | 1306 SetIsLowEndDeviceForTest(base::SysInfo::IsLowEndDevice()); |
1313 | 1307 |
1314 // Add a request to the queue. | 1308 // Add a request to the queue. |
1315 AddRequest1(); | 1309 AddRequest1(); |
1316 PumpLoop(); | 1310 PumpLoop(); |
1317 | 1311 |
1318 // Pause the request. | 1312 // Pause the request. |
1319 std::vector<int64_t> request_ids; | 1313 std::vector<int64_t> request_ids; |
1320 request_ids.push_back(kRequestId1); | 1314 request_ids.push_back(kRequestId1); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 PumpLoop(); | 1573 PumpLoop(); |
1580 | 1574 |
1581 // The last time would trigger the snapshot on last retry and succeed. | 1575 // The last time would trigger the snapshot on last retry and succeed. |
1582 EXPECT_FALSE(OfflinerWasCanceled()); | 1576 EXPECT_FALSE(OfflinerWasCanceled()); |
1583 EXPECT_EQ(RequestCoordinator::BackgroundSavePageResult::SUCCESS, | 1577 EXPECT_EQ(RequestCoordinator::BackgroundSavePageResult::SUCCESS, |
1584 observer().last_status()); | 1578 observer().last_status()); |
1585 EXPECT_TRUE(observer().completed_called()); | 1579 EXPECT_TRUE(observer().completed_called()); |
1586 } | 1580 } |
1587 | 1581 |
1588 } // namespace offline_pages | 1582 } // namespace offline_pages |
OLD | NEW |