OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_TE
ST_UTILS_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_TE
ST_UTILS_H_ |
6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_TE
ST_UTILS_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_TE
ST_UTILS_H_ |
7 | 7 |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 DataReductionProxyParams::kPromoAllowed, | 64 DataReductionProxyParams::kPromoAllowed, |
65 TestDataReductionProxyParams::HAS_EVERYTHING & | 65 TestDataReductionProxyParams::HAS_EVERYTHING & |
66 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN & | 66 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN & |
67 ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN)) {} | 67 ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN)) {} |
68 MockDataReductionProxySettings<C>(int flags) | 68 MockDataReductionProxySettings<C>(int flags) |
69 : C(new TestDataReductionProxyParams(flags, | 69 : C(new TestDataReductionProxyParams(flags, |
70 TestDataReductionProxyParams::HAS_EVERYTHING & | 70 TestDataReductionProxyParams::HAS_EVERYTHING & |
71 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN & | 71 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN & |
72 ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN)) {} | 72 ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN)) {} |
73 MOCK_METHOD0(GetURLFetcherForAvailabilityCheck, net::URLFetcher*()); | 73 MOCK_METHOD0(GetURLFetcherForAvailabilityCheck, net::URLFetcher*()); |
74 MOCK_METHOD0(GetURLFetcherForWarmup, net::URLFetcher*()); | |
75 MOCK_METHOD0(GetOriginalProfilePrefs, PrefService*()); | 74 MOCK_METHOD0(GetOriginalProfilePrefs, PrefService*()); |
76 MOCK_METHOD0(GetLocalStatePrefs, PrefService*()); | 75 MOCK_METHOD0(GetLocalStatePrefs, PrefService*()); |
77 MOCK_METHOD3(LogProxyState, void( | 76 MOCK_METHOD3(LogProxyState, void( |
78 bool enabled, bool restricted, bool at_startup)); | 77 bool enabled, bool restricted, bool at_startup)); |
79 MOCK_METHOD1(RecordProbeURLFetchResult, | 78 MOCK_METHOD1(RecordProbeURLFetchResult, |
80 void(ProbeURLFetchResult result)); | 79 void(ProbeURLFetchResult result)); |
81 MOCK_METHOD1(RecordStartupState, | 80 MOCK_METHOD1(RecordStartupState, |
82 void(ProxyStartupState state)); | 81 void(ProxyStartupState state)); |
83 | 82 |
84 // SetProxyConfigs should always call LogProxyState exactly once. | 83 // SetProxyConfigs should always call LogProxyState exactly once. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 bool promo_allowed, | 120 bool promo_allowed, |
122 bool holdback); | 121 bool holdback); |
123 virtual void ResetSettings(bool allowed, | 122 virtual void ResetSettings(bool allowed, |
124 bool fallback_allowed, | 123 bool fallback_allowed, |
125 bool alt_allowed, | 124 bool alt_allowed, |
126 bool promo_allowed, | 125 bool promo_allowed, |
127 bool holdback) = 0; | 126 bool holdback) = 0; |
128 | 127 |
129 template <class C> void SetProbeResult( | 128 template <class C> void SetProbeResult( |
130 const std::string& test_url, | 129 const std::string& test_url, |
131 const std::string& warmup_test_url, | |
132 const std::string& response, | 130 const std::string& response, |
133 ProbeURLFetchResult state, | 131 ProbeURLFetchResult state, |
134 bool success, | 132 bool success, |
135 int expected_calls); | 133 int expected_calls); |
136 virtual void SetProbeResult(const std::string& test_url, | 134 virtual void SetProbeResult(const std::string& test_url, |
137 const std::string& warmup_test_url, | |
138 const std::string& response, | 135 const std::string& response, |
139 ProbeURLFetchResult result, | 136 ProbeURLFetchResult result, |
140 bool success, | 137 bool success, |
141 int expected_calls) = 0; | 138 int expected_calls) = 0; |
142 | 139 |
143 void CheckProxyConfigs(bool expected_enabled, | 140 void CheckProxyConfigs(bool expected_enabled, |
144 bool expected_restricted, | 141 bool expected_restricted, |
145 bool expected_fallback_restricted); | 142 bool expected_fallback_restricted); |
146 void CheckProbe(bool initially_enabled, | 143 void CheckProbe(bool initially_enabled, |
147 const std::string& probe_url, | 144 const std::string& probe_url, |
148 const std::string& warmup_url, | |
149 const std::string& response, | 145 const std::string& response, |
150 bool request_success, | 146 bool request_success, |
151 bool expected_enabled, | 147 bool expected_enabled, |
152 bool expected_restricted, | 148 bool expected_restricted, |
153 bool expected_fallback_restricted); | 149 bool expected_fallback_restricted); |
154 void CheckProbeOnIPChange(const std::string& probe_url, | 150 void CheckProbeOnIPChange(const std::string& probe_url, |
155 const std::string& warmup_url, | |
156 const std::string& response, | 151 const std::string& response, |
157 bool request_success, | 152 bool request_success, |
158 bool expected_enabled, | 153 bool expected_enabled, |
159 bool expected_fallback_restricted); | 154 bool expected_fallback_restricted); |
160 void CheckOnPrefChange(bool enabled, bool expected_enabled, bool managed); | 155 void CheckOnPrefChange(bool enabled, bool expected_enabled, bool managed); |
161 void CheckInitDataReductionProxy(bool enabled_at_startup); | 156 void CheckInitDataReductionProxy(bool enabled_at_startup); |
162 void RegisterSyntheticFieldTrialCallback(bool proxy_enabled) { | 157 void RegisterSyntheticFieldTrialCallback(bool proxy_enabled) { |
163 proxy_enabled_ = proxy_enabled; | 158 proxy_enabled_ = proxy_enabled; |
164 } | 159 } |
165 | 160 |
(...skipping 16 matching lines...) Expand all Loading... |
182 virtual void ResetSettings(bool allowed, | 177 virtual void ResetSettings(bool allowed, |
183 bool fallback_allowed, | 178 bool fallback_allowed, |
184 bool alt_allowed, | 179 bool alt_allowed, |
185 bool promo_allowed, | 180 bool promo_allowed, |
186 bool holdback) OVERRIDE { | 181 bool holdback) OVERRIDE { |
187 return DataReductionProxySettingsTestBase::ResetSettings<C>( | 182 return DataReductionProxySettingsTestBase::ResetSettings<C>( |
188 allowed, fallback_allowed, alt_allowed, promo_allowed, holdback); | 183 allowed, fallback_allowed, alt_allowed, promo_allowed, holdback); |
189 } | 184 } |
190 | 185 |
191 virtual void SetProbeResult(const std::string& test_url, | 186 virtual void SetProbeResult(const std::string& test_url, |
192 const std::string& warmup_test_url, | |
193 const std::string& response, | 187 const std::string& response, |
194 ProbeURLFetchResult result, | 188 ProbeURLFetchResult result, |
195 bool success, | 189 bool success, |
196 int expected_calls) OVERRIDE { | 190 int expected_calls) OVERRIDE { |
197 return DataReductionProxySettingsTestBase::SetProbeResult<C>( | 191 return DataReductionProxySettingsTestBase::SetProbeResult<C>( |
198 test_url, | 192 test_url, |
199 warmup_test_url, | |
200 response, | 193 response, |
201 result, | 194 result, |
202 success, | 195 success, |
203 expected_calls); | 196 expected_calls); |
204 } | 197 } |
205 }; | 198 }; |
206 | 199 |
207 } // namespace data_reduction_proxy | 200 } // namespace data_reduction_proxy |
208 | 201 |
209 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS
_TEST_UTILS_H_ | 202 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS
_TEST_UTILS_H_ |
OLD | NEW |