Chromium Code Reviews| 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..5323a9b12808bbd82ff5c1de106c2e194d804155 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,29 @@ class URLFetcher; |
| namespace data_reduction_proxy { |
| +class TestDataReductionProxyParams; |
| + |
| class MockDataReductionProxyConfig : public DataReductionProxyConfig { |
| public: |
| - MockDataReductionProxyConfig(); |
| - MockDataReductionProxyConfig(int flags); |
| - ~MockDataReductionProxyConfig() override; |
| + MockDataReductionProxyConfig( |
|
bengr
2015/02/03 21:51:58
Thinking ahead a bit, I'd like to have Mock/Fake s
jeremyim
2015/02/04 01:31:21
Done.
|
| + 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, |
| @@ -36,6 +51,18 @@ class MockDataReductionProxyConfig : public DataReductionProxyConfig { |
| virtual void GetNetworkList(net::NetworkInterfaceList* interfaces, |
| int policy) override; |
| + // Allows tests to reset the params being used for configuration. |
| + void ResetParamsForTest(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(); |
| } |