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

Side by Side Diff: chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc

Issue 2808313002: [Offline pages] Make all net error codes retriable. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « chrome/browser/android/offline_pages/background_loader_offliner.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/android/offline_pages/background_loader_offliner.h" 5 #include "chrome/browser/android/offline_pages/background_loader_offliner.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "base/test/scoped_mock_time_message_loop_task_runner.h" 10 #include "base/test/scoped_mock_time_message_loop_task_runner.h"
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // NavigationHandle destruction will trigger DidFinishNavigation code. 430 // NavigationHandle destruction will trigger DidFinishNavigation code.
431 handle.reset(); 431 handle.reset();
432 histograms().ExpectBucketCount( 432 histograms().ExpectBucketCount(
433 "OfflinePages.Background.BackgroundLoadingFailedCode.async_loading", 433 "OfflinePages.Background.BackgroundLoadingFailedCode.async_loading",
434 105, // ERR_NAME_NOT_RESOLVED 434 105, // ERR_NAME_NOT_RESOLVED
435 1); 435 1);
436 offliner()->DidStopLoading(); 436 offliner()->DidStopLoading();
437 PumpLoop(); 437 PumpLoop();
438 438
439 EXPECT_TRUE(completion_callback_called()); 439 EXPECT_TRUE(completion_callback_called());
440 EXPECT_EQ(Offliner::RequestStatus::LOADING_FAILED_NO_RETRY, request_status()); 440 EXPECT_EQ(Offliner::RequestStatus::LOADING_FAILED, request_status());
441 } 441 }
442 442
443 TEST_F(BackgroundLoaderOfflinerTest, NoNextOnInternetDisconnected) { 443 TEST_F(BackgroundLoaderOfflinerTest, NoNextOnInternetDisconnected) {
444 base::Time creation_time = base::Time::Now(); 444 base::Time creation_time = base::Time::Now();
445 SavePageRequest request(kRequestId, kHttpUrl, kClientId, creation_time, 445 SavePageRequest request(kRequestId, kHttpUrl, kClientId, creation_time,
446 kUserRequested); 446 kUserRequested);
447 EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), 447 EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(),
448 progress_callback())); 448 progress_callback()));
449 449
450 // Create handle with net error code. 450 // Create handle with net error code.
(...skipping 27 matching lines...) Expand all
478 model()->CompleteSavingAsSuccess(); 478 model()->CompleteSavingAsSuccess();
479 PumpLoop(); 479 PumpLoop();
480 480
481 EXPECT_TRUE(completion_callback_called()); 481 EXPECT_TRUE(completion_callback_called());
482 EXPECT_EQ(Offliner::RequestStatus::SAVED, request_status()); 482 EXPECT_EQ(Offliner::RequestStatus::SAVED, request_status());
483 EXPECT_FALSE(offliner()->is_loading()); 483 EXPECT_FALSE(offliner()->is_loading());
484 EXPECT_FALSE(SaveInProgress()); 484 EXPECT_FALSE(SaveInProgress());
485 } 485 }
486 486
487 } // namespace offline_pages 487 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/background_loader_offliner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698