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

Unified Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc

Issue 684223003: Data Reduction Proxy Interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Thestig comment and test fix Created 5 years, 10 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/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc
index e0aa147a265ec0ed7e299506a717b36c32b90f0f..c60027032dd7ea53ea0b1524d967e0d29736ce2b 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc
@@ -27,7 +27,11 @@ namespace data_reduction_proxy {
TestDataReductionProxyParams::TestDataReductionProxyParams(
int flags, unsigned int has_definitions)
: DataReductionProxyParams(flags, false),
- has_definitions_(has_definitions) {
+ has_definitions_(has_definitions),
+ mock_is_bypassed_by_data_reduction_proxy_local_rules_(false),
+ mock_are_data_reduction_proxies_bypassed_(false),
+ is_bypassed_by_data_reduction_proxy_local_rules_return_value_(false),
+ are_data_reduction_proxies_bypassed_return_value_(false) {
init_result_ = Init(
flags & DataReductionProxyParams::kAllowed,
flags & DataReductionProxyParams::kFallbackAllowed,
@@ -39,6 +43,38 @@ bool TestDataReductionProxyParams::init_result() const {
return init_result_;
}
+bool TestDataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules(
+ const net::URLRequest& request,
+ const net::ProxyConfig& data_reduction_proxy_config) const {
+ if (mock_is_bypassed_by_data_reduction_proxy_local_rules_)
+ return is_bypassed_by_data_reduction_proxy_local_rules_return_value_;
+ return DataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules(
+ request, data_reduction_proxy_config);
+}
+
+bool TestDataReductionProxyParams::AreDataReductionProxiesBypassed(
+ const net::URLRequest& request,
+ const net::ProxyConfig& data_reduction_proxy_config,
+ base::TimeDelta* min_retry_delay) const {
+ if (mock_are_data_reduction_proxies_bypassed_)
+ return are_data_reduction_proxies_bypassed_return_value_;
+ return DataReductionProxyParams::AreDataReductionProxiesBypassed(
+ request, data_reduction_proxy_config, min_retry_delay);
+}
+
+void TestDataReductionProxyParams::MockAreDataReductionProxiesBypassed(
+ bool return_value) {
+ mock_are_data_reduction_proxies_bypassed_ = true;
+ are_data_reduction_proxies_bypassed_return_value_ = return_value;
+}
+
+void
+TestDataReductionProxyParams::MockIsBypassedByDataReductionProxyLocalRules(
+ bool return_value) {
+ mock_is_bypassed_by_data_reduction_proxy_local_rules_ = true;
+ is_bypassed_by_data_reduction_proxy_local_rules_return_value_ = return_value;
+}
+
// Test values to replace the values specified in preprocessor defines.
std::string TestDataReductionProxyParams::DefaultDevOrigin() {
return kDefaultDevOrigin;

Powered by Google App Engine
This is Rietveld 408576698