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

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

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 class ResourcePrefetchPredictorTest : public testing::Test { 72 class ResourcePrefetchPredictorTest : public testing::Test {
73 public: 73 public:
74 ResourcePrefetchPredictorTest(); 74 ResourcePrefetchPredictorTest();
75 ~ResourcePrefetchPredictorTest() override; 75 ~ResourcePrefetchPredictorTest() override;
76 void SetUp() override; 76 void SetUp() override;
77 void TearDown() override; 77 void TearDown() override;
78 78
79 protected: 79 protected:
80 void AddUrlToHistory(const std::string& url, int visit_count) { 80 void AddUrlToHistory(const std::string& url, int visit_count) {
81 HistoryServiceFactory::GetForProfile(profile_.get(), 81 HistoryServiceFactory::GetForProfile(profile_.get(),
82 Profile::EXPLICIT_ACCESS)-> 82 ServiceAccessType::EXPLICIT_ACCESS)->
83 AddPageWithDetails( 83 AddPageWithDetails(
84 GURL(url), 84 GURL(url),
85 base::string16(), 85 base::string16(),
86 visit_count, 86 visit_count,
87 0, 87 0,
88 base::Time::Now(), 88 base::Time::Now(),
89 false, 89 false,
90 history::SOURCE_BROWSED); 90 history::SOURCE_BROWSED);
91 profile_->BlockUntilHistoryProcessesPendingRequests(); 91 profile_->BlockUntilHistoryProcessesPendingRequests();
92 } 92 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 ResourcePrefetchPredictorTest::~ResourcePrefetchPredictorTest() { 179 ResourcePrefetchPredictorTest::~ResourcePrefetchPredictorTest() {
180 profile_.reset(NULL); 180 profile_.reset(NULL);
181 loop_.RunUntilIdle(); 181 loop_.RunUntilIdle();
182 } 182 }
183 183
184 void ResourcePrefetchPredictorTest::SetUp() { 184 void ResourcePrefetchPredictorTest::SetUp() {
185 InitializeSampleData(); 185 InitializeSampleData();
186 186
187 ASSERT_TRUE(profile_->CreateHistoryService(true, false)); 187 ASSERT_TRUE(profile_->CreateHistoryService(true, false));
188 profile_->BlockUntilHistoryProcessesPendingRequests(); 188 profile_->BlockUntilHistoryProcessesPendingRequests();
189 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile_.get(), 189 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(
190 Profile::EXPLICIT_ACCESS)); 190 profile_.get(), ServiceAccessType::EXPLICIT_ACCESS));
191 // Initialize the predictor with empty data. 191 // Initialize the predictor with empty data.
192 ResetPredictor(); 192 ResetPredictor();
193 EXPECT_EQ(predictor_->initialization_state_, 193 EXPECT_EQ(predictor_->initialization_state_,
194 ResourcePrefetchPredictor::NOT_INITIALIZED); 194 ResourcePrefetchPredictor::NOT_INITIALIZED);
195 EXPECT_CALL(*mock_tables_.get(), 195 EXPECT_CALL(*mock_tables_.get(),
196 GetAllData(Pointee(ContainerEq(PrefetchDataMap())), 196 GetAllData(Pointee(ContainerEq(PrefetchDataMap())),
197 Pointee(ContainerEq(PrefetchDataMap())))); 197 Pointee(ContainerEq(PrefetchDataMap()))));
198 InitializePredictor(); 198 InitializePredictor();
199 EXPECT_TRUE(predictor_->inflight_navigations_.empty()); 199 EXPECT_TRUE(predictor_->inflight_navigations_.empty());
200 EXPECT_EQ(predictor_->initialization_state_, 200 EXPECT_EQ(predictor_->initialization_state_,
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(0))); 916 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(0)));
917 EXPECT_TRUE(URLRequestSummaryAreEqual( 917 EXPECT_TRUE(URLRequestSummaryAreEqual(
918 resource2, 918 resource2,
919 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(1))); 919 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(1)));
920 EXPECT_TRUE(URLRequestSummaryAreEqual( 920 EXPECT_TRUE(URLRequestSummaryAreEqual(
921 resource3, 921 resource3,
922 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(2))); 922 predictor_->inflight_navigations_[main_frame1.navigation_id]->at(2)));
923 } 923 }
924 924
925 } // namespace predictors 925 } // namespace predictors
OLDNEW
« no previous file with comments | « chrome/browser/predictors/resource_prefetch_predictor.cc ('k') | chrome/browser/prerender/prerender_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698