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

Side by Side Diff: chrome/browser/predictors/resource_prefetch_predictor_test_util.h

Issue 2388783002: predictors: Refactor resource_prefetch_predictor_tables. (Closed)
Patch Set: Rebase. Created 4 years, 2 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 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 8
9 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" 9 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h"
10 10
11 namespace predictors { 11 namespace predictors {
12 12
13 ResourceData CreateResourceData(const std::string& resource_url, 13 void InitializeResourceData(ResourceData* resource,
14 content::ResourceType resource_type, 14 const std::string& resource_url,
15 int number_of_hits, 15 content::ResourceType resource_type,
16 int number_of_misses, 16 int number_of_hits,
17 int consecutive_misses, 17 int number_of_misses,
18 double average_position, 18 int consecutive_misses,
19 net::RequestPriority priority, 19 double average_position,
20 bool has_validators, 20 net::RequestPriority priority,
21 bool always_revalidate); 21 bool has_validators,
22 bool always_revalidate);
22 23
23 void InitializeRedirectStat(RedirectStat* redirect, 24 void InitializeRedirectStat(RedirectStat* redirect,
24 const std::string& url, 25 const std::string& url,
25 int number_of_hits, 26 int number_of_hits,
26 int number_of_misses, 27 int number_of_misses,
27 int consecutive_misses); 28 int consecutive_misses);
28 29
29 RedirectData CreateRedirectData(const std::string& primary_key); 30 PrefetchData CreatePrefetchData(const std::string& primary_key,
31 uint64_t last_visit_time = 0);
32 RedirectData CreateRedirectData(const std::string& primary_key,
33 uint64_t last_visit_time = 0);
30 34
31 // For printing failures nicely. 35 // For printing failures nicely.
32 void PrintTo(const ResourcePrefetchPredictorTables::PrefetchData& data, 36 void PrintTo(const PrefetchData& data, ::std::ostream* os);
33 ::std::ostream* os);
34 void PrintTo(const ResourceData& resource, ::std::ostream* os); 37 void PrintTo(const ResourceData& resource, ::std::ostream* os);
38 void PrintTo(const RedirectData& data, ::std::ostream* os);
35 void PrintTo(const RedirectStat& redirect, ::std::ostream* os); 39 void PrintTo(const RedirectStat& redirect, ::std::ostream* os);
36 void PrintTo(const RedirectData& data, ::std::ostream* os);
37 40
38 bool operator==(const ResourcePrefetchPredictorTables::PrefetchData& lhs, 41 bool operator==(const PrefetchData& lhs, const PrefetchData& rhs);
39 const ResourcePrefetchPredictorTables::PrefetchData& rhs);
40 bool operator==(const ResourceData& lhs, const ResourceData& rhs); 42 bool operator==(const ResourceData& lhs, const ResourceData& rhs);
43 bool operator==(const RedirectData& lhs, const RedirectData& rhs);
41 bool operator==(const RedirectStat& lhs, const RedirectStat& rhs); 44 bool operator==(const RedirectStat& lhs, const RedirectStat& rhs);
42 bool operator==(const RedirectData& lhs, const RedirectData& rhs);
43 45
44 } // namespace predictors 46 } // namespace predictors
45 47
46 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ 48 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698