| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 5 |
| 6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 bool URLRequestSummaryAreEqual(const URLRequestSummary& lhs, | 93 bool URLRequestSummaryAreEqual(const URLRequestSummary& lhs, |
| 94 const URLRequestSummary& rhs) { | 94 const URLRequestSummary& rhs) { |
| 95 return lhs.navigation_id == rhs.navigation_id && | 95 return lhs.navigation_id == rhs.navigation_id && |
| 96 lhs.resource_url == rhs.resource_url && | 96 lhs.resource_url == rhs.resource_url && |
| 97 lhs.resource_type == rhs.resource_type && | 97 lhs.resource_type == rhs.resource_type && |
| 98 lhs.mime_type == rhs.mime_type && | 98 lhs.mime_type == rhs.mime_type && |
| 99 lhs.was_cached == rhs.was_cached; | 99 lhs.was_cached == rhs.was_cached; |
| 100 } | 100 } |
| 101 | 101 |
| 102 void ResetPredictor() { | 102 void ResetPredictor() { |
| 103 ResourcePrefetchPredictor::Config config; | 103 ResourcePrefetchPredictorConfig config; |
| 104 config.max_urls_to_track = 3; | 104 config.max_urls_to_track = 3; |
| 105 config.min_url_visit_count = 2; | 105 config.min_url_visit_count = 2; |
| 106 config.max_resources_per_entry = 4; | 106 config.max_resources_per_entry = 4; |
| 107 config.max_consecutive_misses = 2; | 107 config.max_consecutive_misses = 2; |
| 108 predictor_.reset(new ResourcePrefetchPredictor(config, &profile_)); | 108 predictor_.reset(new ResourcePrefetchPredictor(config, &profile_)); |
| 109 predictor_->SetTablesForTesting(mock_tables_); | 109 predictor_->SetTablesForTesting(mock_tables_); |
| 110 } | 110 } |
| 111 | 111 |
| 112 MessageLoop loop_; | 112 MessageLoop loop_; |
| 113 content::TestBrowserThread ui_thread_; | 113 content::TestBrowserThread ui_thread_; |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 predictor_->inflight_navigations_[main_frame1.navigation_id][0])); | 593 predictor_->inflight_navigations_[main_frame1.navigation_id][0])); |
| 594 EXPECT_TRUE(URLRequestSummaryAreEqual( | 594 EXPECT_TRUE(URLRequestSummaryAreEqual( |
| 595 resource2, | 595 resource2, |
| 596 predictor_->inflight_navigations_[main_frame1.navigation_id][1])); | 596 predictor_->inflight_navigations_[main_frame1.navigation_id][1])); |
| 597 EXPECT_TRUE(URLRequestSummaryAreEqual( | 597 EXPECT_TRUE(URLRequestSummaryAreEqual( |
| 598 resource3, | 598 resource3, |
| 599 predictor_->inflight_navigations_[main_frame1.navigation_id][2])); | 599 predictor_->inflight_navigations_[main_frame1.navigation_id][2])); |
| 600 } | 600 } |
| 601 | 601 |
| 602 } // namespace predictors | 602 } // namespace predictors |
| OLD | NEW |