| Index: chrome/browser/android/offline_pages/offline_page_tab_helper_unittest.cc
|
| diff --git a/chrome/browser/android/offline_pages/offline_page_tab_helper_unittest.cc b/chrome/browser/android/offline_pages/offline_page_tab_helper_unittest.cc
|
| index d061b5c731f65fffbf17a1bcc403430bbd4758ce..f06f74bd22ce87390c18cbbebe728090aaed1019 100644
|
| --- a/chrome/browser/android/offline_pages/offline_page_tab_helper_unittest.cc
|
| +++ b/chrome/browser/android/offline_pages/offline_page_tab_helper_unittest.cc
|
| @@ -364,20 +364,21 @@ TEST_F(OfflinePageTabHelperTest, SelectBestPageForCurrentTab) {
|
| StartLoad(kTestPageUrl);
|
| // Gives a chance to run delayed task to do redirection.
|
| RunUntilIdle();
|
|
|
| const OfflinePageItem* item =
|
| OfflinePageUtils::GetOfflinePageFromWebContents(web_contents());
|
| EXPECT_EQ(expected_offline_id, item->offline_id);
|
| EXPECT_EQ(expected_offline_url, item->GetOfflineURL());
|
| EXPECT_EQ(kLastNNamespace, item->client_id.name_space);
|
| EXPECT_EQ(base::IntToString(kTabId), item->client_id.id);
|
| + EXPECT_FALSE(offline_page_tab_helper()->is_offline_preview());
|
| }
|
|
|
| TEST_F(OfflinePageTabHelperTest, PageFor2GSlow) {
|
| SimulateHasNetworkConnectivity(true);
|
| TestingProfile* test_profile = profile();
|
| UINetworkQualityEstimatorService* nqe_service =
|
| UINetworkQualityEstimatorServiceFactory::GetForProfile(test_profile);
|
| nqe_service->SetEffectiveConnectionTypeForTesting(
|
| net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G);
|
|
|
| @@ -397,28 +398,31 @@ TEST_F(OfflinePageTabHelperTest, PageFor2GSlow) {
|
|
|
| StartLoad(kTestPageUrl);
|
| // Gives a chance to run delayed task to do redirection.
|
| RunUntilIdle();
|
|
|
| // This page should be fresh enough to cause a redirect.
|
| item = OfflinePageUtils::GetOfflinePageFromWebContents(web_contents());
|
| EXPECT_EQ(offline_url(), item->GetOfflineURL());
|
| EXPECT_EQ(online_url(), item->url);
|
|
|
| + EXPECT_TRUE(offline_page_tab_helper()->is_offline_preview());
|
| +
|
| clock()->Advance(base::TimeDelta::FromDays(8));
|
| StartLoad(kTestPageUrl);
|
| // Gives a chance to run delayed task to do redirection.
|
| RunUntilIdle();
|
|
|
| // This page should not be fresh enough to cause a redirect.
|
| item = OfflinePageUtils::GetOfflinePageFromWebContents(web_contents());
|
| EXPECT_EQ(nullptr, item);
|
| + EXPECT_FALSE(offline_page_tab_helper()->is_offline_preview());
|
| }
|
|
|
| // This test saves another copy of page from Async Loading namespace
|
| // and verifies it is redirected to it (as it is more recent).
|
| TEST_F(OfflinePageTabHelperTest, SwitchToOfflineAsyncLoadedPageOnNoNetwork) {
|
| // Saves an offline page.
|
| OfflinePageModel* model =
|
| OfflinePageModelFactory::GetForBrowserContext(browser_context());
|
| std::unique_ptr<OfflinePageTestArchiver> archiver(BuildArchiver(
|
| kTestPageUrl,
|
| @@ -436,13 +440,14 @@ TEST_F(OfflinePageTabHelperTest, SwitchToOfflineAsyncLoadedPageOnNoNetwork) {
|
| SimulateHasNetworkConnectivity(false);
|
| StartLoad(kTestPageUrl);
|
| // Gives a chance to run delayed task to do redirection.
|
| RunUntilIdle();
|
|
|
| const OfflinePageItem* item =
|
| OfflinePageUtils::GetOfflinePageFromWebContents(web_contents());
|
| EXPECT_EQ(expected_offline_id, item->offline_id);
|
| EXPECT_EQ(expected_offline_url, item->GetOfflineURL());
|
| EXPECT_EQ(kAsyncNamespace, item->client_id.name_space);
|
| + EXPECT_FALSE(offline_page_tab_helper()->is_offline_preview());
|
| }
|
|
|
| } // namespace offline_pages
|
|
|