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

Unified Diff: chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc

Issue 2797013002: [Offline pages] Update background loader to override the WebContentsObserver methods expected (Closed)
Patch Set: fix offliner tests 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc
diff --git a/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc b/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc
index efe87a842c48a67e866ba2289069df584dc0b83c..3ba2c56c42f0def539ba0fa83b8c88cfef718840 100644
--- a/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc
+++ b/chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc
@@ -147,14 +147,13 @@ class BackgroundLoaderOfflinerTest : public testing::Test {
const base::HistogramTester& histograms() const { return histogram_tester_; }
int64_t progress() { return progress_; }
+ void PumpLoop() { base::RunLoop().RunUntilIdle(); }
+
void CompleteLoading() {
- // For some reason, setting loading to True will call DidStopLoading
- // on the observers.
- offliner()->web_contents_tester()->TestSetIsLoading(true);
+ offliner()->DocumentOnLoadCompletedInMainFrame();
+ PumpLoop();
}
- void PumpLoop() { base::RunLoop().RunUntilIdle(); }
-
private:
void OnCompletion(const SavePageRequest& request,
Offliner::RequestStatus status);
@@ -433,7 +432,7 @@ TEST_F(BackgroundLoaderOfflinerTest, FailsOnErrorPage) {
"OfflinePages.Background.BackgroundLoadingFailedCode.async_loading",
105, // ERR_NAME_NOT_RESOLVED
1);
- offliner()->DidStopLoading();
+ CompleteLoading();
PumpLoop();
EXPECT_TRUE(completion_callback_called());
@@ -457,7 +456,7 @@ TEST_F(BackgroundLoaderOfflinerTest, NoNextOnInternetDisconnected) {
offliner()->DidFinishNavigation(handle.get());
// NavigationHandle is always destroyed after finishing navigation.
handle.reset();
- offliner()->DidStopLoading();
+ CompleteLoading();
PumpLoop();
EXPECT_TRUE(completion_callback_called());
@@ -473,7 +472,7 @@ TEST_F(BackgroundLoaderOfflinerTest, OnlySavesOnceOnMultipleLoads) {
// First load
CompleteLoading();
// Second load
- offliner()->DidStopLoading();
+ CompleteLoading();
PumpLoop();
model()->CompleteSavingAsSuccess();
PumpLoop();
« 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