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

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

Issue 2418413003: predictors: Replace deprecated TestBrowserThread by TestBrowserThreadBundle (Closed)
Patch Set: '\n' -> std::endl 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 4
5 #include "chrome/browser/predictors/resource_prefetch_predictor_test_util.h" 5 #include "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
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 RedirectData CreateRedirectData(const std::string& primary_key, 52 RedirectData CreateRedirectData(const std::string& primary_key,
53 uint64_t last_visit_time) { 53 uint64_t last_visit_time) {
54 RedirectData data; 54 RedirectData data;
55 data.set_primary_key(primary_key); 55 data.set_primary_key(primary_key);
56 data.set_last_visit_time(last_visit_time); 56 data.set_last_visit_time(last_visit_time);
57 return data; 57 return data;
58 } 58 }
59 59
60 void PrintTo(const PrefetchData& data, ::std::ostream* os) { 60 std::ostream& operator<<(std::ostream& os, const PrefetchData& data) {
61 *os << "[" << data.primary_key() << "," << data.last_visit_time() << "]\n"; 61 os << "[" << data.primary_key() << "," << data.last_visit_time() << "]"
62 for (const ResourceData& resource : data.resources()) { 62 << std::endl;
63 *os << "\t\t"; 63 for (const ResourceData& resource : data.resources())
64 PrintTo(resource, os); 64 os << "\t\t" << resource << std::endl;
65 *os << "\n"; 65 return os;
66 }
67 } 66 }
68 67
69 void PrintTo(const ResourceData& resource, ::std::ostream* os) { 68 std::ostream& operator<<(std::ostream& os, const ResourceData& resource) {
70 *os << "[" << resource.resource_url() << "," << resource.resource_type() 69 return os << "[" << resource.resource_url() << "," << resource.resource_type()
71 << "," << resource.number_of_hits() << "," << resource.number_of_misses() 70 << "," << resource.number_of_hits() << ","
72 << "," << resource.consecutive_misses() << "," 71 << resource.number_of_misses() << ","
73 << resource.average_position() << "," << resource.priority() << "," 72 << resource.consecutive_misses() << ","
74 << resource.has_validators() << "," << resource.always_revalidate() 73 << resource.average_position() << "," << resource.priority() << ","
75 << "]"; 74 << resource.has_validators() << "," << resource.always_revalidate()
75 << "]";
76 } 76 }
77 77
78 void PrintTo(const RedirectData& data, ::std::ostream* os) { 78 std::ostream& operator<<(std::ostream& os, const RedirectData& data) {
79 *os << "[" << data.primary_key() << "," << data.last_visit_time() << "]\n"; 79 os << "[" << data.primary_key() << "," << data.last_visit_time() << "]"
80 for (const RedirectStat& redirect : data.redirect_endpoints()) { 80 << std::endl;
81 *os << "\t\t"; 81 for (const RedirectStat& redirect : data.redirect_endpoints())
82 PrintTo(redirect, os); 82 os << "\t\t" << redirect << std::endl;
83 *os << "\n"; 83 return os;
84 }
85 } 84 }
86 85
87 void PrintTo(const RedirectStat& redirect, ::std::ostream* os) { 86 std::ostream& operator<<(std::ostream& os, const RedirectStat& redirect) {
88 *os << "[" << redirect.url() << "," << redirect.number_of_hits() << "," 87 return os << "[" << redirect.url() << "," << redirect.number_of_hits() << ","
89 << redirect.number_of_misses() << "," << redirect.consecutive_misses() 88 << redirect.number_of_misses() << ","
90 << "]"; 89 << redirect.consecutive_misses() << "]";
91 } 90 }
92 91
93 bool operator==(const PrefetchData& lhs, const PrefetchData& rhs) { 92 bool operator==(const PrefetchData& lhs, const PrefetchData& rhs) {
94 bool equal = lhs.primary_key() == rhs.primary_key() && 93 bool equal = lhs.primary_key() == rhs.primary_key() &&
95 lhs.resources_size() == rhs.resources_size(); 94 lhs.resources_size() == rhs.resources_size();
96 95
97 if (!equal) 96 if (!equal)
98 return false; 97 return false;
99 98
100 for (int i = 0; i < lhs.resources_size(); ++i) 99 for (int i = 0; i < lhs.resources_size(); ++i)
(...skipping 28 matching lines...) Expand all
129 } 128 }
130 129
131 bool operator==(const RedirectStat& lhs, const RedirectStat& rhs) { 130 bool operator==(const RedirectStat& lhs, const RedirectStat& rhs) {
132 return lhs.url() == rhs.url() && 131 return lhs.url() == rhs.url() &&
133 lhs.number_of_hits() == rhs.number_of_hits() && 132 lhs.number_of_hits() == rhs.number_of_hits() &&
134 lhs.number_of_misses() == rhs.number_of_misses() && 133 lhs.number_of_misses() == rhs.number_of_misses() &&
135 lhs.consecutive_misses() == rhs.consecutive_misses(); 134 lhs.consecutive_misses() == rhs.consecutive_misses();
136 } 135 }
137 136
138 } // namespace predictors 137 } // namespace predictors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698