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

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.h

Issue 286013002: Added alternative configuration for the data reduction proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK fix Created 6 years, 7 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/browser/data_reduction_proxy_settings_test_utils.h
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.h b/components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.h
index f0cc6484a13b4b64cf8a72b774abc923ea73291b..eae8bae018e4d2e0bf16678b97cd3f613bb3dcd7 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.h
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.h
@@ -21,13 +21,13 @@ namespace data_reduction_proxy {
class TestDataReductionProxyConfig : public DataReductionProxyConfigurator {
public:
- TestDataReductionProxyConfig()
- : enabled_(false), restricted_(false), fallback_restricted_(false) {}
+ TestDataReductionProxyConfig();
virtual ~TestDataReductionProxyConfig() {}
virtual void Enable(bool restricted,
bool fallback_restricted,
const std::string& primary_origin,
- const std::string& fallback_origin) OVERRIDE;
+ const std::string& fallback_origin,
+ const std::string& ssl_origin) OVERRIDE;
virtual void Disable() OVERRIDE;
virtual void AddHostPatternToBypass(const std::string& pattern) OVERRIDE {}
virtual void AddURLPatternToBypass(const std::string& pattern) OVERRIDE {}
@@ -44,11 +44,23 @@ class TestDataReductionProxyConfig : public DataReductionProxyConfigurator {
// configuration has been disallowed. True if |Enable| is called with
// |fallback_restricted| set to true. Defaults to false.
bool fallback_restricted_;
+
+ // The origins that are passed to |Enable|.
+ std::string origin_;
+ std::string fallback_origin_;
+ std::string ssl_origin_;
};
template <class C>
class MockDataReductionProxySettings : public C {
public:
+ MockDataReductionProxySettings<C>() : DataReductionProxySettings(
+ new DataReductionProxyParams(
+ DataReductionProxyParams::kAllowed |
+ DataReductionProxyParams::kFallbackAllowed |
+ DataReductionProxyParams::kPromoAllowed)) {}
+ MockDataReductionProxySettings<C>(int flags)
+ : C(new DataReductionProxyParams(flags)) {}
MOCK_METHOD0(GetURLFetcher, net::URLFetcher*());
MOCK_METHOD0(GetOriginalProfilePrefs, PrefService*());
MOCK_METHOD0(GetLocalStatePrefs, PrefService*());
@@ -60,24 +72,38 @@ class MockDataReductionProxySettings : public C {
void(ProxyStartupState state));
// SetProxyConfigs should always call LogProxyState exactly once.
- virtual void SetProxyConfigs(
- bool enabled, bool restricted, bool at_startup) OVERRIDE {
+ virtual void SetProxyConfigs(bool enabled,
+ bool alternative_enabled,
+ bool restricted,
+ bool at_startup) OVERRIDE {
EXPECT_CALL(*this, LogProxyState(enabled, restricted, at_startup)).Times(1);
- C::SetProxyConfigs(enabled, restricted, at_startup);
+ C::SetProxyConfigs(enabled, alternative_enabled, restricted, at_startup);
}
};
class DataReductionProxySettingsTestBase : public testing::Test {
public:
+ static void AddTestProxyToCommandLine();
+
DataReductionProxySettingsTestBase();
+ DataReductionProxySettingsTestBase(bool allowed,
+ bool fallback_allowed,
+ bool alt_allowed,
+ bool promo_allowed);
virtual ~DataReductionProxySettingsTestBase();
void AddProxyToCommandLine();
virtual void SetUp() OVERRIDE;
- template <class C> void ResetSettings();
- virtual void ResetSettings() = 0;
+ template <class C> void ResetSettings(bool allowed,
+ bool fallback_allowed,
+ bool alt_allowed,
+ bool promo_allowed);
+ virtual void ResetSettings(bool allowed,
+ bool fallback_allowed,
+ bool alt_allowed,
+ bool promo_allowed) = 0;
template <class C> void SetProbeResult(
const std::string& test_url,
@@ -122,8 +148,12 @@ class ConcreteDataReductionProxySettingsTest
: public DataReductionProxySettingsTestBase {
public:
typedef MockDataReductionProxySettings<C> MockSettings;
- virtual void ResetSettings() OVERRIDE {
- return DataReductionProxySettingsTestBase::ResetSettings<C>();
+ virtual void ResetSettings(bool allowed,
+ bool fallback_allowed,
+ bool alt_allowed,
+ bool promo_allowed) OVERRIDE {
+ return DataReductionProxySettingsTestBase::ResetSettings<C>(
+ allowed, fallback_allowed, alt_allowed, promo_allowed);
}
virtual void SetProbeResult(const std::string& test_url,

Powered by Google App Engine
This is Rietveld 408576698