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

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

Issue 2355273002: Redirect handling in the resource_prefetch_predictor. (Closed)
Patch Set: Minor changes 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 "chrome/browser/predictors/resource_prefetch_predictor_tables.h" 7 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h"
8 8
9 namespace predictors { 9 namespace predictors {
10 10
11 ResourceData CreateResourceData(const std::string& resource_url, 11 ResourceData CreateResourceData(const std::string& resource_url,
12 content::ResourceType resource_type, 12 content::ResourceType resource_type,
13 int number_of_hits, 13 int number_of_hits,
14 int number_of_misses, 14 int number_of_misses,
15 int consecutive_misses, 15 int consecutive_misses,
16 double average_position, 16 double average_position,
17 net::RequestPriority priority, 17 net::RequestPriority priority,
18 bool has_validators, 18 bool has_validators,
19 bool always_revalidate); 19 bool always_revalidate);
20 20
21 void InitializeRedirectStat(RedirectStat* redirect,
22 const std::string& url,
23 int number_of_hits,
24 int number_of_misses,
25 int consecutive_misses);
26
21 // For printing failures nicely. 27 // For printing failures nicely.
22 void PrintTo(const ResourceData& resource, ::std::ostream* os);
23 void PrintTo(const ResourcePrefetchPredictorTables::PrefetchData& data, 28 void PrintTo(const ResourcePrefetchPredictorTables::PrefetchData& data,
24 ::std::ostream* os); 29 ::std::ostream* os);
25 30
26 bool operator==(const ResourceData& lhs, const ResourceData& rhs);
27 bool operator==(const ResourcePrefetchPredictorTables::PrefetchData& lhs, 31 bool operator==(const ResourcePrefetchPredictorTables::PrefetchData& lhs,
28 const ResourcePrefetchPredictorTables::PrefetchData& rhs); 32 const ResourcePrefetchPredictorTables::PrefetchData& rhs);
29 33
30 } // namespace predictors 34 } // namespace predictors
31 35
36 // These functions should be declared in the same namespace as the classes
37 // ResourceData, ResourceData_RedirectStat, RedirectData. Otherwise,
38 // Google Mock can't find these declarations and unit tests are not compiled.
pasko 2016/09/22 14:27:09 the last part of the sentence is not necessary (st
pasko 2016/09/26 12:28:15 plz do not forget to respond with 'Done' in cases
alexilin 2016/09/26 15:38:28 Done.
39 namespace chrome_browser_predictors {
40
41 void PrintTo(const ResourceData& resource, ::std::ostream* os);
42 void PrintTo(const RedirectData_RedirectStat& redirect, ::std::ostream* os);
43 void PrintTo(const RedirectData& data, ::std::ostream* os);
44
45 bool operator==(const ResourceData& lhs, const ResourceData& rhs);
46 bool operator==(const RedirectData_RedirectStat& lhs,
47 const RedirectData_RedirectStat& rhs);
48 bool operator==(const RedirectData& lhs, const RedirectData& rhs);
49
50 } // namespace chrome_browser_predictors
51
32 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_ 52 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698