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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.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, 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/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 03ba9d6b00049b26d3bdbb1e4c770c48febffa1c..4a15a848d88c0c5d746ce9945004a1bf7eb8e686 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
@@ -12,24 +12,105 @@
namespace data_reduction_proxy {
-MockDataReductionProxyConfig::MockDataReductionProxyConfig()
- : MockDataReductionProxyConfig(DataReductionProxyParams::kAllowed |
- DataReductionProxyParams::kFallbackAllowed |
- DataReductionProxyParams::kPromoAllowed) {
+TestDataReductionProxyConfig::TestDataReductionProxyConfig(
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
+ net::NetLog* net_log,
+ DataReductionProxyConfigurator* configurator,
+ DataReductionProxyEventStore* event_store)
+ : TestDataReductionProxyConfig(
+ DataReductionProxyParams::kAllowed |
+ DataReductionProxyParams::kFallbackAllowed |
+ DataReductionProxyParams::kPromoAllowed,
+ network_task_runner,
+ net_log,
+ configurator,
+ event_store) {
}
-MockDataReductionProxyConfig::MockDataReductionProxyConfig(int flags)
+TestDataReductionProxyConfig::TestDataReductionProxyConfig(
+ int flags,
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
+ net::NetLog* net_log,
+ DataReductionProxyConfigurator* configurator,
+ DataReductionProxyEventStore* event_store)
: DataReductionProxyConfig(
- scoped_ptr<TestDataReductionProxyParams>(
+ network_task_runner,
+ net_log,
+ scoped_ptr<DataReductionProxyParams>(
new TestDataReductionProxyParams(
flags,
TestDataReductionProxyParams::HAS_EVERYTHING &
~TestDataReductionProxyParams::HAS_DEV_ORIGIN &
~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN))
- .Pass()) {
+ .Pass(),
+ configurator,
+ event_store) {
network_interfaces_.reset(new net::NetworkInterfaceList());
}
+TestDataReductionProxyConfig::~TestDataReductionProxyConfig() {
+}
+
+void TestDataReductionProxyConfig::GetNetworkList(
+ net::NetworkInterfaceList* interfaces,
+ int policy) {
+ if (!network_interfaces_.get())
+ return;
+ for (size_t i = 0; i < network_interfaces_->size(); ++i)
+ interfaces->push_back(network_interfaces_->at(i));
+}
+
+void TestDataReductionProxyConfig::ResetParamFlagsForTest(int flags) {
+ params_.reset(
+ scoped_ptr<DataReductionProxyParams>(
+ new TestDataReductionProxyParams(
+ flags,
+ TestDataReductionProxyParams::HAS_EVERYTHING &
+ ~TestDataReductionProxyParams::HAS_DEV_ORIGIN &
+ ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN))
+ .release());
+}
+
+TestDataReductionProxyParams* TestDataReductionProxyConfig::test_params() {
+ return static_cast<TestDataReductionProxyParams*>(params_.get());
+}
+
+void TestDataReductionProxyConfig::SetStateForTest(
+ bool enabled_by_user,
+ bool alternative_enabled_by_user,
+ bool restricted_by_carrier,
+ bool at_startup) {
+ enabled_by_user_ = enabled_by_user;
+ alternative_enabled_by_user_ = alternative_enabled_by_user;
+ restricted_by_carrier_ = restricted_by_carrier;
+ SetProxyConfigs(enabled_by_user_, alternative_enabled_by_user_,
+ restricted_by_carrier_, at_startup);
+}
+
+MockDataReductionProxyConfig::MockDataReductionProxyConfig(
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
+ net::NetLog* net_log,
+ DataReductionProxyConfigurator* configurator,
+ DataReductionProxyEventStore* event_store)
+ : TestDataReductionProxyConfig(network_task_runner,
+ net_log,
+ configurator,
+ event_store) {
+}
+
+MockDataReductionProxyConfig::MockDataReductionProxyConfig(
+ int flags,
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
+ net::NetLog* net_log,
+ DataReductionProxyConfigurator* configurator,
+ DataReductionProxyEventStore* event_store)
+ : TestDataReductionProxyConfig(flags,
+ network_task_runner,
+ net_log,
+ configurator,
+ event_store) {
+}
+
MockDataReductionProxyConfig::~MockDataReductionProxyConfig() {
}
@@ -42,13 +123,4 @@ void MockDataReductionProxyConfig::SetProxyConfigs(bool enabled,
restricted, at_startup);
}
-void MockDataReductionProxyConfig::GetNetworkList(
- net::NetworkInterfaceList* interfaces,
- int policy) {
- if (!network_interfaces_.get())
- return;
- for (size_t i = 0; i < network_interfaces_->size(); ++i)
- interfaces->push_back(network_interfaces_->at(i));
-}
-
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698