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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h

Issue 2802843003: Update CPAT protocol to send lite-page transform acceptance with ect
Patch Set: Merge with testLitePageBTF Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG _TEST_UTILS_H_ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG _TEST_UTILS_H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG _TEST_UTILS_H_ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG _TEST_UTILS_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Allows tests to mark the network as prohibitively slow. 80 // Allows tests to mark the network as prohibitively slow.
81 void SetNetworkProhibitivelySlow(bool network_quality_prohibitively_slow); 81 void SetNetworkProhibitivelySlow(bool network_quality_prohibitively_slow);
82 82
83 bool IsNetworkQualityProhibitivelySlow( 83 bool IsNetworkQualityProhibitivelySlow(
84 const net::NetworkQualityEstimator* network_quality_estimator) override; 84 const net::NetworkQualityEstimator* network_quality_estimator) override;
85 85
86 net::NetworkInterfaceList* interfaces() { 86 net::NetworkInterfaceList* interfaces() {
87 return network_interfaces_.get(); 87 return network_interfaces_.get();
88 } 88 }
89 89
90 void SetLofiAccuracyRecordingIntervals(
91 const std::vector<base::TimeDelta>& lofi_accuracy_recording_intervals);
92
93 const std::vector<base::TimeDelta>& GetLofiAccuracyRecordingIntervals()
94 const override;
95
96 // Sets the |tick_clock_| to |tick_clock|. Ownership of |tick_clock| is not 90 // Sets the |tick_clock_| to |tick_clock|. Ownership of |tick_clock| is not
97 // passed to the callee. 91 // passed to the callee.
98 void SetTickClock(base::TickClock* tick_clock); 92 void SetTickClock(base::TickClock* tick_clock);
99 93
100 base::TimeTicks GetTicksNow() const override; 94 base::TimeTicks GetTicksNow() const override;
101 95
102 bool WasDataReductionProxyUsed( 96 bool WasDataReductionProxyUsed(
103 const net::URLRequest* request, 97 const net::URLRequest* request,
104 DataReductionProxyTypeInfo* proxy_info) const override; 98 DataReductionProxyTypeInfo* proxy_info) const override;
105 99
106 // Sets the data reduction proxy as not used. Subsequent calls to 100 // Sets the data reduction proxy as not used. Subsequent calls to
107 // WasDataReductionProxyUsed() would return false. 101 // WasDataReductionProxyUsed() would return false.
108 void SetWasDataReductionProxyNotUsed(); 102 void SetWasDataReductionProxyNotUsed();
109 103
110 // Sets the proxy index of the data reduction proxy. Subsequent calls to 104 // Sets the proxy index of the data reduction proxy. Subsequent calls to
111 // WasDataReductionProxyUsed are affected. 105 // WasDataReductionProxyUsed are affected.
112 void SetWasDataReductionProxyUsedProxyIndex(int proxy_index); 106 void SetWasDataReductionProxyUsedProxyIndex(int proxy_index);
113 107
114 // Resets the behavior of WasDataReductionProxyUsed() calls. 108 // Resets the behavior of WasDataReductionProxyUsed() calls.
115 void ResetWasDataReductionProxyUsed(); 109 void ResetWasDataReductionProxyUsed();
116 110
117 // Sets if the captive portal probe has been blocked for the current network. 111 // Sets if the captive portal probe has been blocked for the current network.
118 void SetIsCaptivePortal(bool is_captive_portal); 112 void SetIsCaptivePortal(bool is_captive_portal);
119 113
114 void SetConnectionTypeForTesting(
115 net::NetworkChangeNotifier::ConnectionType connection_type) {
116 connection_type_ = connection_type;
117 }
118
120 using DataReductionProxyConfig::UpdateConfigForTesting; 119 using DataReductionProxyConfig::UpdateConfigForTesting;
121 120
122 private: 121 private:
123 bool GetIsCaptivePortal() const override; 122 bool GetIsCaptivePortal() const override;
124 123
125 base::TickClock* tick_clock_; 124 base::TickClock* tick_clock_;
126 125
127 base::Optional<bool> was_data_reduction_proxy_used_; 126 base::Optional<bool> was_data_reduction_proxy_used_;
128 base::Optional<int> proxy_index_; 127 base::Optional<int> proxy_index_;
129 128
130 std::unique_ptr<net::NetworkInterfaceList> network_interfaces_; 129 std::unique_ptr<net::NetworkInterfaceList> network_interfaces_;
131 130
132 bool network_quality_prohibitively_slow_set_; 131 bool network_quality_prohibitively_slow_set_;
133 // True if the network quality is slow enough to turn Lo-Fi ON. 132 // True if the network quality is slow enough to turn Lo-Fi ON (for fallback).
134 bool network_quality_prohibitively_slow_; 133 bool network_quality_prohibitively_slow_;
135 134
136 bool lofi_accuracy_recording_intervals_set_;
137 std::vector<base::TimeDelta> lofi_accuracy_recording_intervals_;
138
139 // Set to true if the captive portal probe for the current network has been 135 // Set to true if the captive portal probe for the current network has been
140 // blocked. 136 // blocked.
141 bool is_captive_portal_; 137 bool is_captive_portal_;
142 138
143 DISALLOW_COPY_AND_ASSIGN(TestDataReductionProxyConfig); 139 DISALLOW_COPY_AND_ASSIGN(TestDataReductionProxyConfig);
144 }; 140 };
145 141
146 // A |TestDataReductionProxyConfig| which permits mocking of methods for 142 // A |TestDataReductionProxyConfig| which permits mocking of methods for
147 // testing. 143 // testing.
148 class MockDataReductionProxyConfig : public TestDataReductionProxyConfig { 144 class MockDataReductionProxyConfig : public TestDataReductionProxyConfig {
(...skipping 19 matching lines...) Expand all
168 MOCK_CONST_METHOD2(IsBypassedByDataReductionProxyLocalRules, 164 MOCK_CONST_METHOD2(IsBypassedByDataReductionProxyLocalRules,
169 bool(const net::URLRequest& request, 165 bool(const net::URLRequest& request,
170 const net::ProxyConfig& data_reduction_proxy_config)); 166 const net::ProxyConfig& data_reduction_proxy_config));
171 MOCK_CONST_METHOD3(AreDataReductionProxiesBypassed, 167 MOCK_CONST_METHOD3(AreDataReductionProxiesBypassed,
172 bool(const net::URLRequest& request, 168 bool(const net::URLRequest& request,
173 const net::ProxyConfig& data_reduction_proxy_config, 169 const net::ProxyConfig& data_reduction_proxy_config,
174 base::TimeDelta* min_retry_delay)); 170 base::TimeDelta* min_retry_delay));
175 MOCK_METHOD2(SecureProxyCheck, 171 MOCK_METHOD2(SecureProxyCheck,
176 void(const GURL& secure_proxy_check_url, 172 void(const GURL& secure_proxy_check_url,
177 FetcherResponseCallback fetcher_callback)); 173 FetcherResponseCallback fetcher_callback));
178 MOCK_METHOD1(
179 IsNetworkQualityProhibitivelySlow,
180 bool(const net::NetworkQualityEstimator* network_quality_estimator));
181 174
182 using DataReductionProxyConfig::UpdateConfigForTesting; 175 using DataReductionProxyConfig::UpdateConfigForTesting;
183 176
184 // Resets the Lo-Fi status to default state. 177 // Resets the Lo-Fi status to default state.
185 void ResetLoFiStatusForTest(); 178 void ResetLoFiStatusForTest();
186 }; 179 };
187 180
188 } // namespace data_reduction_proxy 181 } // namespace data_reduction_proxy
189 182
190 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CON FIG_TEST_UTILS_H_ 183 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CON FIG_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698