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

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

Issue 2355163002: [Offline Pages] Breaks out new TIMED_OUT Offliner status for RequestCoordinator watchdog timeout in… (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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 PumpLoop(); 818 PumpLoop();
819 819
820 // Wait for timeout to expire. Use a TaskRunner with a DelayedTaskRunner 820 // Wait for timeout to expire. Use a TaskRunner with a DelayedTaskRunner
821 // which won't time out immediately, so the watchdog thread doesn't kill valid 821 // which won't time out immediately, so the watchdog thread doesn't kill valid
822 // tasks too soon. 822 // tasks too soon.
823 WaitForCallback(); 823 WaitForCallback();
824 PumpLoop(); 824 PumpLoop();
825 825
826 EXPECT_FALSE(is_starting()); 826 EXPECT_FALSE(is_starting());
827 EXPECT_TRUE(OfflinerWasCanceled()); 827 EXPECT_TRUE(OfflinerWasCanceled());
828 EXPECT_EQ(Offliner::RequestStatus::REQUEST_COORDINATOR_CANCELED, 828 EXPECT_EQ(Offliner::RequestStatus::REQUEST_COORDINATOR_TIMED_OUT,
829 last_offlining_status()); 829 last_offlining_status());
830 } 830 }
831 831
832 TEST_F(RequestCoordinatorTest, TimeBudgetExceeded) { 832 TEST_F(RequestCoordinatorTest, TimeBudgetExceeded) {
833 // Build two requests to use with the pre-renderer, and put it on the queue. 833 // Build two requests to use with the pre-renderer, and put it on the queue.
834 offline_pages::SavePageRequest request1( 834 offline_pages::SavePageRequest request1(
835 kRequestId1, kUrl1, kClientId1, base::Time::Now(), kUserRequested); 835 kRequestId1, kUrl1, kClientId1, base::Time::Now(), kUserRequested);
836 offline_pages::SavePageRequest request2( 836 offline_pages::SavePageRequest request2(
837 kRequestId1 + 1, kUrl1, kClientId1, base::Time::Now(), kUserRequested); 837 kRequestId1 + 1, kUrl1, kClientId1, base::Time::Now(), kUserRequested);
838 request2.set_completed_attempt_count(kAttemptCount); 838 request2.set_completed_attempt_count(kAttemptCount);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 // Now whether processing triggered immediately depends on whether test 1025 // Now whether processing triggered immediately depends on whether test
1026 // is run on svelte device or not. 1026 // is run on svelte device or not.
1027 if (base::SysInfo::IsLowEndDevice()) { 1027 if (base::SysInfo::IsLowEndDevice()) {
1028 EXPECT_FALSE(is_busy()); 1028 EXPECT_FALSE(is_busy());
1029 } else { 1029 } else {
1030 EXPECT_TRUE(is_busy()); 1030 EXPECT_TRUE(is_busy());
1031 } 1031 }
1032 } 1032 }
1033 1033
1034 } // namespace offline_pages 1034 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698