| 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..400385661fac5c97bfa2eda8c7025852a211aeeb 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,36 +5,56 @@
|
| #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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h"
|
| #include "net/base/net_util.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
|
|
| +namespace base {
|
| +class SingleThreadTaskRunner;
|
| +}
|
| +
|
| namespace net {
|
| -class URLFetcher;
|
| +class NetLog;
|
| }
|
|
|
| namespace data_reduction_proxy {
|
|
|
| -class MockDataReductionProxyConfig : public DataReductionProxyConfig {
|
| +class DataReductionProxyConfigurator;
|
| +class DataReductionProxyEventStore;
|
| +class TestDataReductionProxyParams;
|
| +
|
| +class TestDataReductionProxyConfig : public DataReductionProxyConfig {
|
| public:
|
| - MockDataReductionProxyConfig();
|
| - MockDataReductionProxyConfig(int flags);
|
| - ~MockDataReductionProxyConfig() override;
|
| + TestDataReductionProxyConfig(
|
| + scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
|
| + net::NetLog* net_log,
|
| + DataReductionProxyConfigurator* configurator,
|
| + DataReductionProxyEventStore* event_store);
|
| + TestDataReductionProxyConfig(
|
| + int params_flags,
|
| + unsigned int params_definitions,
|
| + scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
|
| + net::NetLog* net_log,
|
| + DataReductionProxyConfigurator* configurator,
|
| + DataReductionProxyEventStore* event_store);
|
| + ~TestDataReductionProxyConfig() override;
|
|
|
| - MOCK_METHOD0(GetURLFetcherForProbe, net::URLFetcher*());
|
| - MOCK_METHOD1(RecordProbeURLFetchResult, void(ProbeURLFetchResult result));
|
| - MOCK_METHOD3(LogProxyState,
|
| - void(bool enabled, bool restricted, bool at_startup));
|
| + void GetNetworkList(net::NetworkInterfaceList* interfaces,
|
| + int policy) override;
|
|
|
| - // SetProxyConfigs should always call LogProxyState exactly once.
|
| - virtual void SetProxyConfigs(bool enabled,
|
| - bool alternative_enabled,
|
| - bool restricted,
|
| - bool at_startup) override;
|
| + // Allows tests to reset the params being used for configuration.
|
| + void ResetParamFlagsForTest(int flags);
|
|
|
| - virtual void GetNetworkList(net::NetworkInterfaceList* interfaces,
|
| - int policy) override;
|
| + // 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();
|
| @@ -44,6 +64,40 @@ class MockDataReductionProxyConfig : public DataReductionProxyConfig {
|
| scoped_ptr<net::NetworkInterfaceList> network_interfaces_;
|
| };
|
|
|
| +class MockDataReductionProxyConfig : public TestDataReductionProxyConfig {
|
| + public:
|
| + MockDataReductionProxyConfig(
|
| + scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
|
| + net::NetLog* net_log,
|
| + DataReductionProxyConfigurator* configurator,
|
| + DataReductionProxyEventStore* event_store);
|
| + MockDataReductionProxyConfig(
|
| + int flags,
|
| + unsigned int params_definitions,
|
| + scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
|
| + net::NetLog* net_log,
|
| + DataReductionProxyConfigurator* configurator,
|
| + DataReductionProxyEventStore* event_store);
|
| + ~MockDataReductionProxyConfig();
|
| +
|
| + 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.
|
| + void SetProxyConfigs(bool enabled,
|
| + bool alternative_enabled,
|
| + bool restricted,
|
| + bool at_startup) override;
|
| +
|
| + // HandleProbeResponse should always call RecordProbeURLFetchResult exactly
|
| + // once.
|
| + void HandleProbeResponse(const std::string& response,
|
| + const net::URLRequestStatus& status) override;
|
| +};
|
| +
|
| } // namespace data_reduction_proxy
|
|
|
| #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG_TEST_UTILS_H_
|
|
|