OLD | NEW |
---|---|
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_TEST_U TILS_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_TEST_U TILS_H_ |
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_TEST_U TILS_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_TEST_U TILS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 return weak_factory_.GetWeakPtr(); | 229 return weak_factory_.GetWeakPtr(); |
230 } | 230 } |
231 | 231 |
232 // Records the reporting fraction that was set by parsing a config. | 232 // Records the reporting fraction that was set by parsing a config. |
233 void SetPingbackReportingFraction(float pingback_reporting_fraction) override; | 233 void SetPingbackReportingFraction(float pingback_reporting_fraction) override; |
234 | 234 |
235 float pingback_reporting_fraction() const { | 235 float pingback_reporting_fraction() const { |
236 return pingback_reporting_fraction_; | 236 return pingback_reporting_fraction_; |
237 } | 237 } |
238 | 238 |
239 int64_t original_content_length() const { return original_content_length_; } | |
240 | |
241 int64_t actual_content_length() const { return actual_content_length_; } | |
242 | |
243 void UpdateContentLengths( | |
244 int64_t data_used, | |
245 int64_t original_size, | |
246 bool data_reduction_proxy_enabled, | |
247 DataReductionProxyRequestType request_type, | |
248 const scoped_refptr<DataUseGroup>& data_usage_source, | |
249 const std::string& mime_type) override; | |
250 | |
239 private: | 251 private: |
240 // Allowed SetDataReductionProxyService to be re-entrant. | 252 // Allowed SetDataReductionProxyService to be re-entrant. |
241 bool service_set_; | 253 bool service_set_; |
242 | 254 |
243 // Reporting fraction last set via SetPingbackReportingFraction. | 255 // Reporting fraction last set via SetPingbackReportingFraction. |
244 float pingback_reporting_fraction_; | 256 float pingback_reporting_fraction_; |
245 | 257 |
258 // The total original and actual lengths seen so far. | |
259 int64_t original_content_length_; | |
tbansal1
2016/12/20 23:20:48
Is it possible to not define these variables in th
RyanSturm
2016/12/21 00:10:20
Done.
| |
260 int64_t actual_content_length_; | |
261 | |
246 TestDataReductionProxyRequestOptions* test_request_options_; | 262 TestDataReductionProxyRequestOptions* test_request_options_; |
247 }; | 263 }; |
248 | 264 |
249 // Test version of |DataStore|. Uses an in memory hash map to store data. | 265 // Test version of |DataStore|. Uses an in memory hash map to store data. |
250 class TestDataStore : public data_reduction_proxy::DataStore { | 266 class TestDataStore : public data_reduction_proxy::DataStore { |
251 public: | 267 public: |
252 TestDataStore(); | 268 TestDataStore(); |
253 | 269 |
254 ~TestDataStore() override; | 270 ~TestDataStore() override; |
255 | 271 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 std::unique_ptr<TestConfigStorer> config_storer_; | 546 std::unique_ptr<TestConfigStorer> config_storer_; |
531 | 547 |
532 TestDataReductionProxyParams* params_; | 548 TestDataReductionProxyParams* params_; |
533 | 549 |
534 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyTestContext); | 550 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyTestContext); |
535 }; | 551 }; |
536 | 552 |
537 } // namespace data_reduction_proxy | 553 } // namespace data_reduction_proxy |
538 | 554 |
539 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_TES T_UTILS_H_ | 555 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_TES T_UTILS_H_ |
OLD | NEW |