| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ | 4 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ |
| 5 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ | 5 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ |
| 6 | 6 |
| 7 #include <string> |
| 8 |
| 7 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" | 9 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" |
| 8 | 10 |
| 9 namespace predictors { | 11 namespace predictors { |
| 10 | 12 |
| 11 ResourceData CreateResourceData(const std::string& resource_url, | 13 ResourceData CreateResourceData(const std::string& resource_url, |
| 12 content::ResourceType resource_type, | 14 content::ResourceType resource_type, |
| 13 int number_of_hits, | 15 int number_of_hits, |
| 14 int number_of_misses, | 16 int number_of_misses, |
| 15 int consecutive_misses, | 17 int consecutive_misses, |
| 16 double average_position, | 18 double average_position, |
| 17 net::RequestPriority priority, | 19 net::RequestPriority priority, |
| 18 bool has_validators, | 20 bool has_validators, |
| 19 bool always_revalidate); | 21 bool always_revalidate); |
| 20 | 22 |
| 23 void InitializeRedirectStat(RedirectStat* redirect, |
| 24 const std::string& url, |
| 25 int number_of_hits, |
| 26 int number_of_misses, |
| 27 int consecutive_misses); |
| 28 |
| 29 RedirectData CreateRedirectData(const std::string& primary_key); |
| 30 |
| 21 // For printing failures nicely. | 31 // For printing failures nicely. |
| 22 void PrintTo(const ResourceData& resource, ::std::ostream* os); | |
| 23 void PrintTo(const ResourcePrefetchPredictorTables::PrefetchData& data, | 32 void PrintTo(const ResourcePrefetchPredictorTables::PrefetchData& data, |
| 24 ::std::ostream* os); | 33 ::std::ostream* os); |
| 34 void PrintTo(const ResourceData& resource, ::std::ostream* os); |
| 35 void PrintTo(const RedirectStat& redirect, ::std::ostream* os); |
| 36 void PrintTo(const RedirectData& data, ::std::ostream* os); |
| 25 | 37 |
| 26 bool operator==(const ResourceData& lhs, const ResourceData& rhs); | |
| 27 bool operator==(const ResourcePrefetchPredictorTables::PrefetchData& lhs, | 38 bool operator==(const ResourcePrefetchPredictorTables::PrefetchData& lhs, |
| 28 const ResourcePrefetchPredictorTables::PrefetchData& rhs); | 39 const ResourcePrefetchPredictorTables::PrefetchData& rhs); |
| 40 bool operator==(const ResourceData& lhs, const ResourceData& rhs); |
| 41 bool operator==(const RedirectStat& lhs, const RedirectStat& rhs); |
| 42 bool operator==(const RedirectData& lhs, const RedirectData& rhs); |
| 29 | 43 |
| 30 } // namespace predictors | 44 } // namespace predictors |
| 31 | 45 |
| 32 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ | 46 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ |
| OLD | NEW |