| 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/offline_page_tab_helper.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_tab_helper.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 EXPECT_EQ(kLastNNamespace, item->client_id.name_space); | 368 EXPECT_EQ(kLastNNamespace, item->client_id.name_space); |
| 369 EXPECT_EQ(kTabId, item->client_id.id); | 369 EXPECT_EQ(kTabId, item->client_id.id); |
| 370 } | 370 } |
| 371 | 371 |
| 372 TEST_F(OfflinePageTabHelperTest, PageFor2GSlow) { | 372 TEST_F(OfflinePageTabHelperTest, PageFor2GSlow) { |
| 373 SimulateHasNetworkConnectivity(true); | 373 SimulateHasNetworkConnectivity(true); |
| 374 TestingProfile* test_profile = profile(); | 374 TestingProfile* test_profile = profile(); |
| 375 UINetworkQualityEstimatorService* nqe_service = | 375 UINetworkQualityEstimatorService* nqe_service = |
| 376 UINetworkQualityEstimatorServiceFactory::GetForProfile(test_profile); | 376 UINetworkQualityEstimatorServiceFactory::GetForProfile(test_profile); |
| 377 nqe_service->SetEffectiveConnectionTypeForTesting( | 377 nqe_service->SetEffectiveConnectionTypeForTesting( |
| 378 net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_SLOW_2G); | 378 net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G); |
| 379 | 379 |
| 380 clock()->SetNow(base::Time::Now()); | 380 clock()->SetNow(base::Time::Now()); |
| 381 | 381 |
| 382 StartLoad(kTestPageUrl); | 382 StartLoad(kTestPageUrl); |
| 383 // Gives a chance to run delayed task to do redirection. | 383 // Gives a chance to run delayed task to do redirection. |
| 384 RunUntilIdle(); | 384 RunUntilIdle(); |
| 385 | 385 |
| 386 // This is not included in the field trial, so it should not cause a redirect. | 386 // This is not included in the field trial, so it should not cause a redirect. |
| 387 const OfflinePageItem* item = | 387 const OfflinePageItem* item = |
| 388 OfflinePageUtils::GetOfflinePageFromWebContents(web_contents()); | 388 OfflinePageUtils::GetOfflinePageFromWebContents(web_contents()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 RunUntilIdle(); | 435 RunUntilIdle(); |
| 436 | 436 |
| 437 const OfflinePageItem* item = | 437 const OfflinePageItem* item = |
| 438 OfflinePageUtils::GetOfflinePageFromWebContents(web_contents()); | 438 OfflinePageUtils::GetOfflinePageFromWebContents(web_contents()); |
| 439 EXPECT_EQ(expected_offline_id, item->offline_id); | 439 EXPECT_EQ(expected_offline_id, item->offline_id); |
| 440 EXPECT_EQ(expected_offline_url, item->GetOfflineURL()); | 440 EXPECT_EQ(expected_offline_url, item->GetOfflineURL()); |
| 441 EXPECT_EQ(kAsyncNamespace, item->client_id.name_space); | 441 EXPECT_EQ(kAsyncNamespace, item->client_id.name_space); |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace offline_pages | 444 } // namespace offline_pages |
| OLD | NEW |