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

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

Issue 333113002: Move data reduction proxy to Chrome-Proxy header for authentication (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flywheel-refactor-net-fake-a-redirect-response-headers-chrome-proxy-auth
Patch Set: errata Created 6 years, 5 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/prefs/testing_pref_service.h" 9 #include "base/prefs/testing_pref_service.h"
10 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h" 10 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h"
11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params_te st_utils.h"
11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
12 #include "net/url_request/test_url_fetcher_factory.h" 13 #include "net/url_request/test_url_fetcher_factory.h"
13 #include "net/url_request/url_request_test_util.h" 14 #include "net/url_request/url_request_test_util.h"
14 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 class PrefService; 18 class PrefService;
18 class TestingPrefServiceSimple; 19 class TestingPrefServiceSimple;
19 20
20 namespace data_reduction_proxy { 21 namespace data_reduction_proxy {
(...skipping 27 matching lines...) Expand all
48 // The origins that are passed to |Enable|. 49 // The origins that are passed to |Enable|.
49 std::string origin_; 50 std::string origin_;
50 std::string fallback_origin_; 51 std::string fallback_origin_;
51 std::string ssl_origin_; 52 std::string ssl_origin_;
52 }; 53 };
53 54
54 template <class C> 55 template <class C>
55 class MockDataReductionProxySettings : public C { 56 class MockDataReductionProxySettings : public C {
56 public: 57 public:
57 MockDataReductionProxySettings<C>() : DataReductionProxySettings( 58 MockDataReductionProxySettings<C>() : DataReductionProxySettings(
58 new DataReductionProxyParams( 59 new TestDataReductionProxyParams(
59 DataReductionProxyParams::kAllowed | 60 DataReductionProxyParams::kAllowed |
60 DataReductionProxyParams::kFallbackAllowed | 61 DataReductionProxyParams::kFallbackAllowed |
61 DataReductionProxyParams::kPromoAllowed)) {} 62 DataReductionProxyParams::kPromoAllowed,
63 TestDataReductionProxyParams::HAS_EVERYTHING &
64 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN)) {}
62 MockDataReductionProxySettings<C>(int flags) 65 MockDataReductionProxySettings<C>(int flags)
63 : C(new DataReductionProxyParams(flags)) {} 66 : C(new TestDataReductionProxyParams(flags,
67 TestDataReductionProxyParams::HAS_EVERYTHING &
68 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN)) {}
64 MOCK_METHOD0(GetURLFetcherForAvailabilityCheck, net::URLFetcher*()); 69 MOCK_METHOD0(GetURLFetcherForAvailabilityCheck, net::URLFetcher*());
65 MOCK_METHOD0(GetURLFetcherForWarmup, net::URLFetcher*()); 70 MOCK_METHOD0(GetURLFetcherForWarmup, net::URLFetcher*());
66 MOCK_METHOD0(GetOriginalProfilePrefs, PrefService*()); 71 MOCK_METHOD0(GetOriginalProfilePrefs, PrefService*());
67 MOCK_METHOD0(GetLocalStatePrefs, PrefService*()); 72 MOCK_METHOD0(GetLocalStatePrefs, PrefService*());
68 MOCK_METHOD3(LogProxyState, void( 73 MOCK_METHOD3(LogProxyState, void(
69 bool enabled, bool restricted, bool at_startup)); 74 bool enabled, bool restricted, bool at_startup));
70 MOCK_METHOD1(RecordProbeURLFetchResult, 75 MOCK_METHOD1(RecordProbeURLFetchResult,
71 void(ProbeURLFetchResult result)); 76 void(ProbeURLFetchResult result));
72 MOCK_METHOD1(RecordStartupState, 77 MOCK_METHOD1(RecordStartupState,
73 void(ProxyStartupState state)); 78 void(ProxyStartupState state));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 const std::string& warmup_url, 140 const std::string& warmup_url,
136 const std::string& response, 141 const std::string& response,
137 bool request_success, 142 bool request_success,
138 bool expected_enabled, 143 bool expected_enabled,
139 bool expected_fallback_restricted); 144 bool expected_fallback_restricted);
140 void CheckOnPrefChange(bool enabled, bool expected_enabled, bool managed); 145 void CheckOnPrefChange(bool enabled, bool expected_enabled, bool managed);
141 void CheckInitDataReductionProxy(bool enabled_at_startup); 146 void CheckInitDataReductionProxy(bool enabled_at_startup);
142 147
143 TestingPrefServiceSimple pref_service_; 148 TestingPrefServiceSimple pref_service_;
144 scoped_ptr<DataReductionProxySettings> settings_; 149 scoped_ptr<DataReductionProxySettings> settings_;
150 scoped_ptr<TestDataReductionProxyParams> expected_params_;
145 base::Time last_update_time_; 151 base::Time last_update_time_;
146 }; 152 };
147 153
148 // Test implementations should be subclasses of an instantiation of this 154 // Test implementations should be subclasses of an instantiation of this
149 // class parameterized for whatever DataReductionProxySettings class 155 // class parameterized for whatever DataReductionProxySettings class
150 // is being tested. 156 // is being tested.
151 template <class C> 157 template <class C>
152 class ConcreteDataReductionProxySettingsTest 158 class ConcreteDataReductionProxySettingsTest
153 : public DataReductionProxySettingsTestBase { 159 : public DataReductionProxySettingsTestBase {
154 public: 160 public:
(...skipping 18 matching lines...) Expand all
173 response, 179 response,
174 result, 180 result,
175 success, 181 success,
176 expected_calls); 182 expected_calls);
177 } 183 }
178 }; 184 };
179 185
180 } // namespace data_reduction_proxy 186 } // namespace data_reduction_proxy
181 187
182 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _TEST_UTILS_H_ 188 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698