| 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 "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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |