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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc

Issue 2426903003: Record Proxy Server scheme accurately (Closed)
Patch Set: addressed comments, moved various other tests from Mock framework 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc
index 86dafdfc9d6d256760639c89d83a4af16c2f8770..ac04ec6a6c1ff97e63644639327de16bd935a96b 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc
@@ -129,6 +129,34 @@ base::TimeTicks TestDataReductionProxyConfig::GetTicksNow() const {
return DataReductionProxyConfig::GetTicksNow();
}
+bool TestDataReductionProxyConfig::WasDataReductionProxyUsed(
+ const net::URLRequest* request,
+ DataReductionProxyTypeInfo* proxy_info) const {
+ if (was_data_reduction_proxy_used_ &&
+ !was_data_reduction_proxy_used_.value()) {
+ return false;
+ }
+ bool was_data_reduction_proxy_used =
+ DataReductionProxyConfig::WasDataReductionProxyUsed(request, proxy_info);
+ if (proxy_info && was_data_reduction_proxy_used && proxy_index_)
+ proxy_info->proxy_index = proxy_index_.value();
+ return was_data_reduction_proxy_used;
+}
+
+void TestDataReductionProxyConfig::SetWasDataReductionProxyNotUsed() {
+ was_data_reduction_proxy_used_ = false;
+}
+
+void TestDataReductionProxyConfig::SetWasDataReductionProxyUsedProxyIndex(
+ int proxy_index) {
+ proxy_index_ = proxy_index;
+}
+
+void TestDataReductionProxyConfig::ResetWasDataReductionProxyUsed() {
+ was_data_reduction_proxy_used_.reset();
+ proxy_index_.reset();
+}
+
MockDataReductionProxyConfig::MockDataReductionProxyConfig(
std::unique_ptr<DataReductionProxyConfigValues> config_values,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,

Powered by Google App Engine
This is Rietveld 408576698