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

Unified Diff: components/offline_pages/background/request_coordinator_unittest.cc

Issue 2450293002: Tune web page background fetching (Closed)
Patch Set: CR feedback per DougArnett Created 4 years, 2 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 | « components/offline_pages/background/request_coordinator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/background/request_coordinator_unittest.cc
diff --git a/components/offline_pages/background/request_coordinator_unittest.cc b/components/offline_pages/background/request_coordinator_unittest.cc
index df195f785f2a3398eef76d59ef4cea19a746fbf8..11c672f76f88b8a5a6de10c8dcdcbdd64fabc3af 100644
--- a/components/offline_pages/background/request_coordinator_unittest.cc
+++ b/components/offline_pages/background/request_coordinator_unittest.cc
@@ -247,6 +247,10 @@ class RequestCoordinatorTest
waiter_.Signal();
}
+ net::NetworkChangeNotifier::ConnectionType GetConnectionType() {
+ return coordinator()->GetConnectionType();
+ }
+
// Callback for Add requests.
void AddRequestDone(RequestQueue::AddRequestResult result,
const SavePageRequest& request);
@@ -497,6 +501,10 @@ TEST_F(RequestCoordinatorTest, SavePageLater) {
DeviceConditions device_conditions(false, 75,
net::NetworkChangeNotifier::CONNECTION_3G);
SetDeviceConditionsForTest(device_conditions);
+ // Set up the fake network conditions for the NetworkConnectionNotifier.
+ SetNetworkConditionsForTest(
+ net::NetworkChangeNotifier::ConnectionType::CONNECTION_3G);
+ // Set up the fake network conditions for the network quality estimator.
SetEffectiveConnectionTypeForTest(
net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_3G);
EnableOfflinerCallback(true);
@@ -1082,8 +1090,10 @@ TEST_F(RequestCoordinatorTest, WatchdogTimeoutForImmediateProcessing) {
// If low end device, pretend it is not so that immediate start happens.
SetIsLowEndDeviceForTest(false);
- // Set good network connection so that adding request will trigger
- // immediate processing.
+ // Set up the fake network conditions for the NetworkConnectionNotifier.
+ SetNetworkConditionsForTest(
+ net::NetworkChangeNotifier::ConnectionType::CONNECTION_3G);
+ // Set up the fake network conditions for the network quality estimator.
SetEffectiveConnectionTypeForTest(
net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_3G);
@@ -1255,6 +1265,10 @@ TEST_F(RequestCoordinatorTest, RemoveRequest) {
TEST_F(RequestCoordinatorTest,
SavePageStartsProcessingWhenConnectedAndNotLowEndDevice) {
+ // Set up the fake network conditions for the NetworkConnectionNotifier.
+ SetNetworkConditionsForTest(
+ net::NetworkChangeNotifier::ConnectionType::CONNECTION_3G);
+ // Set up the fake network conditions for the network quality estimator.
SetEffectiveConnectionTypeForTest(
net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_3G);
EXPECT_NE(
@@ -1320,6 +1334,8 @@ TEST_F(RequestCoordinatorTest,
PumpLoop();
// Now simulate reasonable connection.
+ SetNetworkConditionsForTest(
+ net::NetworkChangeNotifier::ConnectionType::CONNECTION_3G);
SetEffectiveConnectionTypeForTest(
net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_3G);
« no previous file with comments | « components/offline_pages/background/request_coordinator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698