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

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

Issue 880963006: Create a new DataReductionProxyConfig class (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_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
new file mode 100644
index 0000000000000000000000000000000000000000..03ba9d6b00049b26d3bdbb1e4c770c48febffa1c
--- /dev/null
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc
@@ -0,0 +1,54 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h"
+
+#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h"
+#include "net/base/net_util.h"
+#include "net/url_request/test_url_fetcher_factory.h"
+#include "net/url_request/url_request_test_util.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace data_reduction_proxy {
+
+MockDataReductionProxyConfig::MockDataReductionProxyConfig()
+ : MockDataReductionProxyConfig(DataReductionProxyParams::kAllowed |
+ DataReductionProxyParams::kFallbackAllowed |
+ DataReductionProxyParams::kPromoAllowed) {
+}
+
+MockDataReductionProxyConfig::MockDataReductionProxyConfig(int flags)
+ : DataReductionProxyConfig(
+ scoped_ptr<TestDataReductionProxyParams>(
+ new TestDataReductionProxyParams(
+ flags,
+ TestDataReductionProxyParams::HAS_EVERYTHING &
+ ~TestDataReductionProxyParams::HAS_DEV_ORIGIN &
+ ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN))
+ .Pass()) {
+ network_interfaces_.reset(new net::NetworkInterfaceList());
+}
+
+MockDataReductionProxyConfig::~MockDataReductionProxyConfig() {
+}
+
+void MockDataReductionProxyConfig::SetProxyConfigs(bool enabled,
+ bool alternative_enabled,
+ bool restricted,
+ bool at_startup) {
+ EXPECT_CALL(*this, LogProxyState(enabled, restricted, at_startup)).Times(1);
+ DataReductionProxyConfig::SetProxyConfigs(enabled, alternative_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