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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 main_frame_url); | 91 main_frame_url); |
92 summary.resource_url = GURL(resource_url); | 92 summary.resource_url = GURL(resource_url); |
93 summary.resource_type = resource_type; | 93 summary.resource_type = resource_type; |
94 summary.mime_type = mime_type; | 94 summary.mime_type = mime_type; |
95 summary.was_cached = was_cached; | 95 summary.was_cached = was_cached; |
96 return summary; | 96 return summary; |
97 } | 97 } |
98 | 98 |
99 void InitializePredictor() { | 99 void InitializePredictor() { |
100 predictor_->LazilyInitialize(); | 100 predictor_->LazilyInitialize(); |
101 loop_.RunAllPending(); // Runs the DB lookup. | 101 loop_.RunUntilIdle(); // Runs the DB lookup. |
102 profile_.BlockUntilHistoryProcessesPendingRequests(); | 102 profile_.BlockUntilHistoryProcessesPendingRequests(); |
103 } | 103 } |
104 | 104 |
105 bool URLRequestSummaryAreEqual(const URLRequestSummary& lhs, | 105 bool URLRequestSummaryAreEqual(const URLRequestSummary& lhs, |
106 const URLRequestSummary& rhs) { | 106 const URLRequestSummary& rhs) { |
107 return lhs.navigation_id == rhs.navigation_id && | 107 return lhs.navigation_id == rhs.navigation_id && |
108 lhs.resource_url == rhs.resource_url && | 108 lhs.resource_url == rhs.resource_url && |
109 lhs.resource_type == rhs.resource_type && | 109 lhs.resource_type == rhs.resource_type && |
110 lhs.mime_type == rhs.mime_type && | 110 lhs.mime_type == rhs.mime_type && |
111 lhs.was_cached == rhs.was_cached; | 111 lhs.was_cached == rhs.was_cached; |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(0))); | 606 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(0))); |
607 EXPECT_TRUE(URLRequestSummaryAreEqual( | 607 EXPECT_TRUE(URLRequestSummaryAreEqual( |
608 resource2, | 608 resource2, |
609 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(1))); | 609 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(1))); |
610 EXPECT_TRUE(URLRequestSummaryAreEqual( | 610 EXPECT_TRUE(URLRequestSummaryAreEqual( |
611 resource3, | 611 resource3, |
612 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(2))); | 612 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(2))); |
613 } | 613 } |
614 | 614 |
615 } // namespace predictors | 615 } // namespace predictors |
OLD | NEW |