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

Unified Diff: components/offline_pages/background/request_coordinator.h

Issue 2279913002: Start processing immediately if there is network (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
Index: components/offline_pages/background/request_coordinator.h
diff --git a/components/offline_pages/background/request_coordinator.h b/components/offline_pages/background/request_coordinator.h
index 623015d4799a03aa03e76216a60ddace1c4ade19..a9d6f02cb92f5878884b566862f806fd0c95701d 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -209,6 +209,16 @@ class RequestCoordinator : public KeyedService,
// if needed.
void GetOffliner();
+ // Method to wrap calls to getting the connection type so it can be
+ // changed for tests.
+ net::NetworkChangeNotifier::ConnectionType GetConnectionType();
+
+ void SetNetworkConditionsForTest(
+ net::NetworkChangeNotifier::ConnectionType connection) {
+ use_test_connection_type_ = true;
+ test_connection_type_ = connection;
+ }
+
void SetOfflinerTimeoutForTest(const base::TimeDelta& timeout) {
offliner_timeout_ = timeout;
}
@@ -225,6 +235,10 @@ class RequestCoordinator : public KeyedService,
bool is_busy_;
// True if the current request has been canceled.
bool is_stopped_;
+ // True if we should use the test connection type instead of the actual type.
+ bool use_test_connection_type_;
+ // For use by tests, a fake network connection type
+ net::NetworkChangeNotifier::ConnectionType test_connection_type_;
// Unowned pointer to the current offliner, if any.
Offliner* offliner_;
base::Time operation_start_time_;

Powered by Google App Engine
This is Rietveld 408576698