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

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

Issue 893003002: Data Reduction Proxy class ownership updates and Settings cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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_bypass_protocol_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
index 406ece1ea47d03346dc481365979839f136fb6a0..6b6c59a7fd305e1b95cbe911926479ec8743c094 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
@@ -13,6 +13,8 @@
#include "base/metrics/field_trial.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_test_utils.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h"
@@ -20,6 +22,7 @@
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers_test_utils.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h"
+#include "net/base/capturing_net_log.h"
#include "net/base/completion_callback.h"
#include "net/base/host_port_pair.h"
#include "net/base/load_flags.h"
@@ -80,8 +83,7 @@ class BadEntropyProvider : public base::FieldTrial::EntropyProvider {
class DataReductionProxyProtocolTest : public testing::Test {
public:
DataReductionProxyProtocolTest() : http_user_agent_settings_("", "") {
- settings_.reset(
- new DataReductionProxySettings(CreateDataReductionProxyParams()));
+ settings_.reset(new DataReductionProxySettings());
proxy_params_.reset(CreateDataReductionProxyParams().release());
simple_interceptor_.reset(new SimpleURLRequestInterceptor());
net::URLRequestFilter::GetInstance()->AddHostnameInterceptor(
@@ -126,15 +128,27 @@ class DataReductionProxyProtocolTest : public testing::Test {
// This is needed to prevent the test context from adding language headers
// to requests.
context_->set_http_user_agent_settings(&http_user_agent_settings_);
- usage_stats_.reset(new DataReductionProxyUsageStats(
- settings_->params(), settings_.get(),
- base::MessageLoopProxy::current()));
-
event_store_.reset(
new DataReductionProxyEventStore(base::MessageLoopProxy::current()));
+ configurator_.reset(new TestDataReductionProxyConfigurator(
+ base::MessageLoopProxy::current(),
bengr 2015/02/03 21:51:58 Please put parameters together on the same line. H
jeremyim 2015/02/04 01:31:21 Done.
+ &net_log_,
+ event_store_.get()));
+ config_.reset(new MockDataReductionProxyConfig(
+ base::MessageLoopProxy::current(),
+ &net_log_,
+ configurator_.get(),
+ event_store_.get()));
+ config_->ResetParamsForTest(CreateDataReductionProxyParams());
+ settings_->ResetConfigForTest(config_.get());
+
+ usage_stats_.reset(new DataReductionProxyUsageStats(
+ config_->params(), settings_.get(),
+ base::MessageLoopProxy::current()));
DataReductionProxyInterceptor* interceptor =
new DataReductionProxyInterceptor(
- settings_->params(), usage_stats_.get(), event_store_.get());
+ config_->params(), usage_stats_.get(), event_store_.get());
+
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory_impl(
new net::URLRequestJobFactoryImpl());
job_factory_.reset(new net::URLRequestInterceptingJobFactory(
@@ -341,12 +355,16 @@ class DataReductionProxyProtocolTest : public testing::Test {
scoped_ptr<ProxyService> proxy_service_;
scoped_ptr<TestDataReductionProxyParams> proxy_params_;
scoped_ptr<DataReductionProxySettings> settings_;
+ scoped_ptr<DataReductionProxyConfigurator> configurator_;
+ scoped_ptr<DataReductionProxyConfig> config_;
scoped_ptr<DataReductionProxyUsageStats> usage_stats_;
scoped_ptr<DataReductionProxyEventStore> event_store_;
net::StaticHttpUserAgentSettings http_user_agent_settings_;
scoped_ptr<net::URLRequestInterceptingJobFactory> job_factory_;
scoped_ptr<TestURLRequestContext> context_;
+
+ net::CapturingNetLog net_log_;
};
// Tests that request are deemed idempotent or not according to the method used.

Powered by Google App Engine
This is Rietveld 408576698