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 #include <iostream> | 5 #include <iostream> |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 empty_host_data_(PREFETCH_KEY_TYPE_HOST, std::string()) {} | 179 empty_host_data_(PREFETCH_KEY_TYPE_HOST, std::string()) {} |
180 | 180 |
181 ResourcePrefetchPredictorTest::~ResourcePrefetchPredictorTest() { | 181 ResourcePrefetchPredictorTest::~ResourcePrefetchPredictorTest() { |
182 profile_.reset(NULL); | 182 profile_.reset(NULL); |
183 loop_.RunUntilIdle(); | 183 loop_.RunUntilIdle(); |
184 } | 184 } |
185 | 185 |
186 void ResourcePrefetchPredictorTest::SetUp() { | 186 void ResourcePrefetchPredictorTest::SetUp() { |
187 InitializeSampleData(); | 187 InitializeSampleData(); |
188 | 188 |
189 ASSERT_TRUE(profile_->CreateHistoryService(true, false)); | 189 profile_->CreateHistoryService(true, false); |
190 profile_->BlockUntilHistoryProcessesPendingRequests(); | 190 profile_->BlockUntilHistoryProcessesPendingRequests(); |
191 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile_.get(), | 191 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile_.get(), |
192 Profile::EXPLICIT_ACCESS)); | 192 Profile::EXPLICIT_ACCESS)); |
193 // Initialize the predictor with empty data. | 193 // Initialize the predictor with empty data. |
194 ResetPredictor(); | 194 ResetPredictor(); |
195 EXPECT_EQ(predictor_->initialization_state_, | 195 EXPECT_EQ(predictor_->initialization_state_, |
196 ResourcePrefetchPredictor::NOT_INITIALIZED); | 196 ResourcePrefetchPredictor::NOT_INITIALIZED); |
197 EXPECT_CALL(*mock_tables_.get(), | 197 EXPECT_CALL(*mock_tables_.get(), |
198 GetAllData(Pointee(ContainerEq(PrefetchDataMap())), | 198 GetAllData(Pointee(ContainerEq(PrefetchDataMap())), |
199 Pointee(ContainerEq(PrefetchDataMap())))); | 199 Pointee(ContainerEq(PrefetchDataMap())))); |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(0))); | 917 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(0))); |
918 EXPECT_TRUE(URLRequestSummaryAreEqual( | 918 EXPECT_TRUE(URLRequestSummaryAreEqual( |
919 resource2, | 919 resource2, |
920 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(1))); | 920 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(1))); |
921 EXPECT_TRUE(URLRequestSummaryAreEqual( | 921 EXPECT_TRUE(URLRequestSummaryAreEqual( |
922 resource3, | 922 resource3, |
923 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(2))); | 923 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(2))); |
924 } | 924 } |
925 | 925 |
926 } // namespace predictors | 926 } // namespace predictors |
OLD | NEW |