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

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

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.h
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h
index e28ee88db4cad47b45177a25d4de3869e92e2695..f11dc1beff20e7b1affc82d562cd46b4e14705bf 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h
@@ -5,7 +5,9 @@
#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG_TEST_UTILS_H_
#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG_TEST_UTILS_H_
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/single_thread_task_runner.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h"
#include "net/base/net_util.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -16,16 +18,67 @@ class URLFetcher;
namespace data_reduction_proxy {
-class MockDataReductionProxyConfig : public DataReductionProxyConfig {
+class TestDataReductionProxyParams;
+
+class TestDataReductionProxyConfig : public DataReductionProxyConfig {
+ public:
+ TestDataReductionProxyConfig(
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
bengr 2015/02/05 00:46:02 I think this can be forward declared instead of in
jeremyim 2015/02/05 00:59:52 Done.
+ net::NetLog* net_log,
bengr 2015/02/05 00:46:02 Forward declare NetLog, Configurator, EventStore,
jeremyim 2015/02/05 00:59:52 Done. NetworkInterfaceList is a typedef, and prob
+ DataReductionProxyConfigurator* configurator,
+ DataReductionProxyEventStore* event_store);
+ TestDataReductionProxyConfig(
+ int flags,
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
+ net::NetLog* net_log,
+ DataReductionProxyConfigurator* configurator,
+ DataReductionProxyEventStore* event_store);
+ ~TestDataReductionProxyConfig() override;
+
+ void GetNetworkList(net::NetworkInterfaceList* interfaces,
+ int policy) override;
+
+ // Allows tests to reset the params being used for configuration.
+ void ResetParamFlagsForTest(int flags);
+
+ // Retrieves the test params being used for the configuration.
+ TestDataReductionProxyParams* test_params();
+
+ // Allows tests to set the internal state.
+ void SetStateForTest(bool enabled_by_user,
+ bool alternative_enabled_by_user,
+ bool restricted_by_carrier,
+ bool at_startup);
+
+ net::NetworkInterfaceList* interfaces() {
+ return network_interfaces_.get();
+ }
+
+ private:
+ scoped_ptr<net::NetworkInterfaceList> network_interfaces_;
+};
+
+class MockDataReductionProxyConfig : public TestDataReductionProxyConfig {
public:
- MockDataReductionProxyConfig();
- MockDataReductionProxyConfig(int flags);
- ~MockDataReductionProxyConfig() override;
+ MockDataReductionProxyConfig(
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
+ net::NetLog* net_log,
+ DataReductionProxyConfigurator* configurator,
+ DataReductionProxyEventStore* event_store);
+ MockDataReductionProxyConfig(
+ int flags,
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
+ net::NetLog* net_log,
+ DataReductionProxyConfigurator* configurator,
+ DataReductionProxyEventStore* event_store);
+ ~MockDataReductionProxyConfig();
MOCK_METHOD0(GetURLFetcherForProbe, net::URLFetcher*());
MOCK_METHOD1(RecordProbeURLFetchResult, void(ProbeURLFetchResult result));
MOCK_METHOD3(LogProxyState,
void(bool enabled, bool restricted, bool at_startup));
+ MOCK_METHOD3(SetProxyPrefs,
+ void(bool enabled, bool alternative_enabled, bool at_startup));
// SetProxyConfigs should always call LogProxyState exactly once.
virtual void SetProxyConfigs(bool enabled,
@@ -33,15 +86,6 @@ class MockDataReductionProxyConfig : public DataReductionProxyConfig {
bool restricted,
bool at_startup) override;
- virtual void GetNetworkList(net::NetworkInterfaceList* interfaces,
- int policy) override;
-
- net::NetworkInterfaceList* interfaces() {
- return network_interfaces_.get();
- }
-
- private:
- scoped_ptr<net::NetworkInterfaceList> network_interfaces_;
};
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698