| 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" |
| 11 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" | 11 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" |
| 12 #include "components/sessions/core/session_id.h" |
| 12 | 13 |
| 13 namespace predictors { | 14 namespace predictors { |
| 14 | 15 |
| 15 void InitializeResourceData(ResourceData* resource, | 16 void InitializeResourceData(ResourceData* resource, |
| 16 const std::string& resource_url, | 17 const std::string& resource_url, |
| 17 content::ResourceType resource_type, | 18 content::ResourceType resource_type, |
| 18 int number_of_hits, | 19 int number_of_hits, |
| 19 int number_of_misses, | 20 int number_of_misses, |
| 20 int consecutive_misses, | 21 int consecutive_misses, |
| 21 double average_position, | 22 double average_position, |
| 22 net::RequestPriority priority, | 23 net::RequestPriority priority, |
| 23 bool has_validators, | 24 bool has_validators, |
| 24 bool always_revalidate); | 25 bool always_revalidate); |
| 25 | 26 |
| 26 void InitializeRedirectStat(RedirectStat* redirect, | 27 void InitializeRedirectStat(RedirectStat* redirect, |
| 27 const std::string& url, | 28 const std::string& url, |
| 28 int number_of_hits, | 29 int number_of_hits, |
| 29 int number_of_misses, | 30 int number_of_misses, |
| 30 int consecutive_misses); | 31 int consecutive_misses); |
| 31 | 32 |
| 32 PrefetchData CreatePrefetchData(const std::string& primary_key, | 33 PrefetchData CreatePrefetchData(const std::string& primary_key, |
| 33 uint64_t last_visit_time = 0); | 34 uint64_t last_visit_time = 0); |
| 34 RedirectData CreateRedirectData(const std::string& primary_key, | 35 RedirectData CreateRedirectData(const std::string& primary_key, |
| 35 uint64_t last_visit_time = 0); | 36 uint64_t last_visit_time = 0); |
| 36 | 37 |
| 37 NavigationID CreateNavigationID(int process_id, | 38 NavigationID CreateNavigationID(SessionID::id_type tab_id, |
| 38 int render_frame_id, | |
| 39 const std::string& main_frame_url); | 39 const std::string& main_frame_url); |
| 40 | 40 |
| 41 ResourcePrefetchPredictor::PageRequestSummary CreatePageRequestSummary( | 41 ResourcePrefetchPredictor::PageRequestSummary CreatePageRequestSummary( |
| 42 const std::string& main_frame_url, | 42 const std::string& main_frame_url, |
| 43 const std::string& initial_url, | 43 const std::string& initial_url, |
| 44 const std::vector<ResourcePrefetchPredictor::URLRequestSummary>& | 44 const std::vector<ResourcePrefetchPredictor::URLRequestSummary>& |
| 45 subresource_requests); | 45 subresource_requests); |
| 46 | 46 |
| 47 ResourcePrefetchPredictor::URLRequestSummary CreateURLRequestSummary( | 47 ResourcePrefetchPredictor::URLRequestSummary CreateURLRequestSummary( |
| 48 int process_id, | 48 SessionID::id_type tab_id, |
| 49 int render_frame_id, | |
| 50 const std::string& main_frame_url, | 49 const std::string& main_frame_url, |
| 51 const std::string& resource_url = std::string(), | 50 const std::string& resource_url = std::string(), |
| 52 content::ResourceType resource_type = content::RESOURCE_TYPE_MAIN_FRAME, | 51 content::ResourceType resource_type = content::RESOURCE_TYPE_MAIN_FRAME, |
| 53 net::RequestPriority priority = net::MEDIUM, | 52 net::RequestPriority priority = net::MEDIUM, |
| 54 const std::string& mime_type = std::string(), | 53 const std::string& mime_type = std::string(), |
| 55 bool was_cached = false, | 54 bool was_cached = false, |
| 56 const std::string& redirect_url = std::string(), | 55 const std::string& redirect_url = std::string(), |
| 57 bool has_validators = false, | 56 bool has_validators = false, |
| 58 bool always_revalidate = false); | 57 bool always_revalidate = false); |
| 59 | 58 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 75 bool operator==(const RedirectData& lhs, const RedirectData& rhs); | 74 bool operator==(const RedirectData& lhs, const RedirectData& rhs); |
| 76 bool operator==(const RedirectStat& lhs, const RedirectStat& rhs); | 75 bool operator==(const RedirectStat& lhs, const RedirectStat& rhs); |
| 77 bool operator==(const ResourcePrefetchPredictor::PageRequestSummary& lhs, | 76 bool operator==(const ResourcePrefetchPredictor::PageRequestSummary& lhs, |
| 78 const ResourcePrefetchPredictor::PageRequestSummary& rhs); | 77 const ResourcePrefetchPredictor::PageRequestSummary& rhs); |
| 79 bool operator==(const ResourcePrefetchPredictor::URLRequestSummary& lhs, | 78 bool operator==(const ResourcePrefetchPredictor::URLRequestSummary& lhs, |
| 80 const ResourcePrefetchPredictor::URLRequestSummary& rhs); | 79 const ResourcePrefetchPredictor::URLRequestSummary& rhs); |
| 81 | 80 |
| 82 } // namespace predictors | 81 } // namespace predictors |
| 83 | 82 |
| 84 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ | 83 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ |
| OLD | NEW |