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

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.h

Issue 473723002: Update data reduction proxy statistics prefs less often on desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tooManyWritesPatch
Patch Set: Fixing net internals bandwidth page Created 6 years, 3 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 unified diff | Download patch
OLDNEW
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"
11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h" 11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h"
12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params_te st_utils.h" 12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params_te st_utils.h"
13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
14 #include "net/base/net_util.h" 14 #include "net/base/net_util.h"
15 #include "net/url_request/test_url_fetcher_factory.h" 15 #include "net/url_request/test_url_fetcher_factory.h"
16 #include "net/url_request/url_request_test_util.h" 16 #include "net/url_request/url_request_test_util.h"
17 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 class PrefService; 20 class PrefService;
21 class TestingPrefServiceSimple; 21 class TestingPrefServiceSimple;
22 22
23 namespace data_reduction_proxy { 23 namespace data_reduction_proxy {
24 24
25 class DataReductionProxyStatisticsPrefs;
26
25 class TestDataReductionProxyConfig : public DataReductionProxyConfigurator { 27 class TestDataReductionProxyConfig : public DataReductionProxyConfigurator {
26 public: 28 public:
27 TestDataReductionProxyConfig(); 29 TestDataReductionProxyConfig();
28 virtual ~TestDataReductionProxyConfig() {} 30 virtual ~TestDataReductionProxyConfig() {}
29 virtual void Enable(bool restricted, 31 virtual void Enable(bool restricted,
30 bool fallback_restricted, 32 bool fallback_restricted,
31 const std::string& primary_origin, 33 const std::string& primary_origin,
32 const std::string& fallback_origin, 34 const std::string& fallback_origin,
33 const std::string& ssl_origin) OVERRIDE; 35 const std::string& ssl_origin) OVERRIDE;
34 virtual void Disable() OVERRIDE; 36 virtual void Disable() OVERRIDE;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void RegisterSyntheticFieldTrialCallback(bool proxy_enabled) { 159 void RegisterSyntheticFieldTrialCallback(bool proxy_enabled) {
158 proxy_enabled_ = proxy_enabled; 160 proxy_enabled_ = proxy_enabled;
159 } 161 }
160 162
161 TestingPrefServiceSimple pref_service_; 163 TestingPrefServiceSimple pref_service_;
162 scoped_ptr<DataReductionProxyConfigurator> configurator_; 164 scoped_ptr<DataReductionProxyConfigurator> configurator_;
163 scoped_ptr<DataReductionProxySettings> settings_; 165 scoped_ptr<DataReductionProxySettings> settings_;
164 scoped_ptr<TestDataReductionProxyParams> expected_params_; 166 scoped_ptr<TestDataReductionProxyParams> expected_params_;
165 base::Time last_update_time_; 167 base::Time last_update_time_;
166 bool proxy_enabled_; 168 bool proxy_enabled_;
169 scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs_;
167 }; 170 };
168 171
169 // Test implementations should be subclasses of an instantiation of this 172 // Test implementations should be subclasses of an instantiation of this
170 // class parameterized for whatever DataReductionProxySettings class 173 // class parameterized for whatever DataReductionProxySettings class
171 // is being tested. 174 // is being tested.
172 template <class C> 175 template <class C>
173 class ConcreteDataReductionProxySettingsTest 176 class ConcreteDataReductionProxySettingsTest
174 : public DataReductionProxySettingsTestBase { 177 : public DataReductionProxySettingsTestBase {
175 public: 178 public:
176 typedef MockDataReductionProxySettings<C> MockSettings; 179 typedef MockDataReductionProxySettings<C> MockSettings;
(...skipping 16 matching lines...) Expand all
193 response, 196 response,
194 result, 197 result,
195 success, 198 success,
196 expected_calls); 199 expected_calls);
197 } 200 }
198 }; 201 };
199 202
200 } // namespace data_reduction_proxy 203 } // namespace data_reduction_proxy
201 204
202 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _TEST_UTILS_H_ 205 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698