| 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 | 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 <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 os << "[" << summary.main_frame_url << "," << summary.initial_url << "]" | 223 os << "[" << summary.main_frame_url << "," << summary.initial_url << "]" |
| 224 << std::endl; | 224 << std::endl; |
| 225 for (const auto& request : summary.subresource_requests) | 225 for (const auto& request : summary.subresource_requests) |
| 226 os << "\t\t" << request << std::endl; | 226 os << "\t\t" << request << std::endl; |
| 227 return os; | 227 return os; |
| 228 } | 228 } |
| 229 | 229 |
| 230 std::ostream& operator<<(std::ostream& os, const URLRequestSummary& summary) { | 230 std::ostream& operator<<(std::ostream& os, const URLRequestSummary& summary) { |
| 231 return os << "[" << summary.navigation_id << "," << summary.resource_url | 231 return os << "[" << summary.navigation_id << "," << summary.resource_url |
| 232 << "," << summary.resource_type << "," << summary.priority << "," | 232 << "," << summary.resource_type << "," << summary.priority << "," |
| 233 << summary.mime_type << "," << summary.was_cached << "," | 233 << summary.before_first_contentful_paint << "," << summary.mime_type |
| 234 << summary.redirect_url << "," << summary.has_validators << "," | 234 << "," << summary.was_cached << "," << summary.redirect_url << "," |
| 235 << summary.always_revalidate << "]"; | 235 << summary.has_validators << "," << summary.always_revalidate |
| 236 << "]"; |
| 236 } | 237 } |
| 237 | 238 |
| 238 std::ostream& operator<<(std::ostream& os, const NavigationID& navigation_id) { | 239 std::ostream& operator<<(std::ostream& os, const NavigationID& navigation_id) { |
| 239 return os << navigation_id.tab_id << "," << navigation_id.main_frame_url; | 240 return os << navigation_id.tab_id << "," << navigation_id.main_frame_url; |
| 240 } | 241 } |
| 241 | 242 |
| 242 bool operator==(const PrefetchData& lhs, const PrefetchData& rhs) { | 243 bool operator==(const PrefetchData& lhs, const PrefetchData& rhs) { |
| 243 bool equal = lhs.primary_key() == rhs.primary_key() && | 244 bool equal = lhs.primary_key() == rhs.primary_key() && |
| 244 lhs.resources_size() == rhs.resources_size(); | 245 lhs.resources_size() == rhs.resources_size(); |
| 245 | 246 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return lhs.main_frame_url == rhs.main_frame_url && | 289 return lhs.main_frame_url == rhs.main_frame_url && |
| 289 lhs.initial_url == rhs.initial_url && | 290 lhs.initial_url == rhs.initial_url && |
| 290 lhs.subresource_requests == rhs.subresource_requests; | 291 lhs.subresource_requests == rhs.subresource_requests; |
| 291 } | 292 } |
| 292 | 293 |
| 293 bool operator==(const URLRequestSummary& lhs, const URLRequestSummary& rhs) { | 294 bool operator==(const URLRequestSummary& lhs, const URLRequestSummary& rhs) { |
| 294 return lhs.navigation_id == rhs.navigation_id && | 295 return lhs.navigation_id == rhs.navigation_id && |
| 295 lhs.resource_url == rhs.resource_url && | 296 lhs.resource_url == rhs.resource_url && |
| 296 lhs.resource_type == rhs.resource_type && | 297 lhs.resource_type == rhs.resource_type && |
| 297 lhs.priority == rhs.priority && lhs.mime_type == rhs.mime_type && | 298 lhs.priority == rhs.priority && lhs.mime_type == rhs.mime_type && |
| 299 lhs.before_first_contentful_paint == |
| 300 rhs.before_first_contentful_paint && |
| 298 lhs.was_cached == rhs.was_cached && | 301 lhs.was_cached == rhs.was_cached && |
| 299 lhs.redirect_url == rhs.redirect_url && | 302 lhs.redirect_url == rhs.redirect_url && |
| 300 lhs.has_validators == rhs.has_validators && | 303 lhs.has_validators == rhs.has_validators && |
| 301 lhs.always_revalidate == rhs.always_revalidate; | 304 lhs.always_revalidate == rhs.always_revalidate; |
| 302 } | 305 } |
| 303 | 306 |
| 304 bool operator==(const OriginData& lhs, const OriginData& rhs) { | 307 bool operator==(const OriginData& lhs, const OriginData& rhs) { |
| 305 bool equal = | 308 bool equal = |
| 306 lhs.host() == rhs.host() && lhs.origins_size() == rhs.origins_size(); | 309 lhs.host() == rhs.host() && lhs.origins_size() == rhs.origins_size(); |
| 307 if (!equal) | 310 if (!equal) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 354 |
| 352 return equal; | 355 return equal; |
| 353 } | 356 } |
| 354 | 357 |
| 355 bool operator==(const PrecacheResource& lhs, const PrecacheResource& rhs) { | 358 bool operator==(const PrecacheResource& lhs, const PrecacheResource& rhs) { |
| 356 return lhs.url() == rhs.url() && | 359 return lhs.url() == rhs.url() && |
| 357 AlmostEqual(lhs.weight_ratio(), rhs.weight_ratio()); | 360 AlmostEqual(lhs.weight_ratio(), rhs.weight_ratio()); |
| 358 } | 361 } |
| 359 | 362 |
| 360 } // namespace precache | 363 } // namespace precache |
| OLD | NEW |