| 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> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | 10 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 void InitializeRedirectStat(RedirectStat* redirect, | 27 void InitializeRedirectStat(RedirectStat* redirect, |
| 28 const std::string& url, | 28 const std::string& url, |
| 29 int number_of_hits, | 29 int number_of_hits, |
| 30 int number_of_misses, | 30 int number_of_misses, |
| 31 int consecutive_misses); | 31 int consecutive_misses); |
| 32 | 32 |
| 33 void InitializePrecacheResource(precache::PrecacheResource* resource, | 33 void InitializePrecacheResource(precache::PrecacheResource* resource, |
| 34 const std::string& url, | 34 const std::string& url, |
| 35 double weight_ratio); | 35 double weight_ratio); |
| 36 | 36 |
| 37 void InitializeOriginStat(OriginStat* origin_stat, |
| 38 const std::string& origin, |
| 39 int number_of_hits, |
| 40 int number_of_misses, |
| 41 int consecutive_misses, |
| 42 double average_position, |
| 43 bool always_access_network, |
| 44 bool accessed_network); |
| 45 |
| 37 PrefetchData CreatePrefetchData(const std::string& primary_key, | 46 PrefetchData CreatePrefetchData(const std::string& primary_key, |
| 38 uint64_t last_visit_time = 0); | 47 uint64_t last_visit_time = 0); |
| 39 RedirectData CreateRedirectData(const std::string& primary_key, | 48 RedirectData CreateRedirectData(const std::string& primary_key, |
| 40 uint64_t last_visit_time = 0); | 49 uint64_t last_visit_time = 0); |
| 41 precache::PrecacheManifest CreateManifestData(uint64_t id = 0); | 50 precache::PrecacheManifest CreateManifestData(uint64_t id = 0); |
| 51 OriginData CreateOriginData(const std::string& host, |
| 52 uint64_t last_visit_time = 0); |
| 42 | 53 |
| 43 NavigationID CreateNavigationID(SessionID::id_type tab_id, | 54 NavigationID CreateNavigationID(SessionID::id_type tab_id, |
| 44 const std::string& main_frame_url); | 55 const std::string& main_frame_url); |
| 45 | 56 |
| 46 ResourcePrefetchPredictor::PageRequestSummary CreatePageRequestSummary( | 57 ResourcePrefetchPredictor::PageRequestSummary CreatePageRequestSummary( |
| 47 const std::string& main_frame_url, | 58 const std::string& main_frame_url, |
| 48 const std::string& initial_url, | 59 const std::string& initial_url, |
| 49 const std::vector<ResourcePrefetchPredictor::URLRequestSummary>& | 60 const std::vector<ResourcePrefetchPredictor::URLRequestSummary>& |
| 50 subresource_requests); | 61 subresource_requests); |
| 51 | 62 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 67 std::ostream& operator<<(std::ostream& stream, const RedirectData& data); | 78 std::ostream& operator<<(std::ostream& stream, const RedirectData& data); |
| 68 std::ostream& operator<<(std::ostream& stream, const RedirectStat& redirect); | 79 std::ostream& operator<<(std::ostream& stream, const RedirectStat& redirect); |
| 69 std::ostream& operator<<( | 80 std::ostream& operator<<( |
| 70 std::ostream& stream, | 81 std::ostream& stream, |
| 71 const ResourcePrefetchPredictor::PageRequestSummary& summary); | 82 const ResourcePrefetchPredictor::PageRequestSummary& summary); |
| 72 std::ostream& operator<<( | 83 std::ostream& operator<<( |
| 73 std::ostream& stream, | 84 std::ostream& stream, |
| 74 const ResourcePrefetchPredictor::URLRequestSummary& summary); | 85 const ResourcePrefetchPredictor::URLRequestSummary& summary); |
| 75 std::ostream& operator<<(std::ostream& stream, const NavigationID& id); | 86 std::ostream& operator<<(std::ostream& stream, const NavigationID& id); |
| 76 | 87 |
| 88 std::ostream& operator<<(std::ostream& os, const OriginData& data); |
| 89 std::ostream& operator<<(std::ostream& os, const OriginStat& redirect); |
| 90 |
| 77 bool operator==(const PrefetchData& lhs, const PrefetchData& rhs); | 91 bool operator==(const PrefetchData& lhs, const PrefetchData& rhs); |
| 78 bool operator==(const ResourceData& lhs, const ResourceData& rhs); | 92 bool operator==(const ResourceData& lhs, const ResourceData& rhs); |
| 79 bool operator==(const RedirectData& lhs, const RedirectData& rhs); | 93 bool operator==(const RedirectData& lhs, const RedirectData& rhs); |
| 80 bool operator==(const RedirectStat& lhs, const RedirectStat& rhs); | 94 bool operator==(const RedirectStat& lhs, const RedirectStat& rhs); |
| 81 bool operator==(const ResourcePrefetchPredictor::PageRequestSummary& lhs, | 95 bool operator==(const ResourcePrefetchPredictor::PageRequestSummary& lhs, |
| 82 const ResourcePrefetchPredictor::PageRequestSummary& rhs); | 96 const ResourcePrefetchPredictor::PageRequestSummary& rhs); |
| 83 bool operator==(const ResourcePrefetchPredictor::URLRequestSummary& lhs, | 97 bool operator==(const ResourcePrefetchPredictor::URLRequestSummary& lhs, |
| 84 const ResourcePrefetchPredictor::URLRequestSummary& rhs); | 98 const ResourcePrefetchPredictor::URLRequestSummary& rhs); |
| 99 bool operator==(const OriginData& lhs, const OriginData& rhs); |
| 100 bool operator==(const OriginStat& lhs, const OriginStat& rhs); |
| 85 | 101 |
| 86 } // namespace predictors | 102 } // namespace predictors |
| 87 | 103 |
| 88 namespace precache { | 104 namespace precache { |
| 89 | 105 |
| 90 std::ostream& operator<<(std::ostream& stream, | 106 std::ostream& operator<<(std::ostream& stream, |
| 91 const PrecacheManifest& manifest); | 107 const PrecacheManifest& manifest); |
| 92 std::ostream& operator<<(std::ostream& stream, | 108 std::ostream& operator<<(std::ostream& stream, |
| 93 const PrecacheResource& resource); | 109 const PrecacheResource& resource); |
| 94 | 110 |
| 95 bool operator==(const PrecacheManifest& lhs, const PrecacheManifest& rhs); | 111 bool operator==(const PrecacheManifest& lhs, const PrecacheManifest& rhs); |
| 96 bool operator==(const PrecacheResource& lhs, const PrecacheResource& rhs); | 112 bool operator==(const PrecacheResource& lhs, const PrecacheResource& rhs); |
| 97 | 113 |
| 98 } // namespace precache | 114 } // namespace precache |
| 99 | 115 |
| 100 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ | 116 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ |
| OLD | NEW |