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

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

Issue 2847183002: predictors: Introduce GlowplugPredictor. (Closed)
Patch Set: . Created 3 years, 7 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 "chrome/browser/predictors/resource_prefetch_predictor.h" 5 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
6 6
7 #include <iostream> 7 #include <iostream>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 223 }
224 224
225 void InitializePredictor() { 225 void InitializePredictor() {
226 predictor_->StartInitialization(); 226 predictor_->StartInitialization();
227 base::RunLoop loop; 227 base::RunLoop loop;
228 loop.RunUntilIdle(); // Runs the DB lookup. 228 loop.RunUntilIdle(); // Runs the DB lookup.
229 profile_->BlockUntilHistoryProcessesPendingRequests(); 229 profile_->BlockUntilHistoryProcessesPendingRequests();
230 } 230 }
231 231
232 void ResetPredictor() { 232 void ResetPredictor() {
233 ResourcePrefetchPredictorConfig config; 233 GlowplugPredictorConfig config;
234 config.max_urls_to_track = 3; 234 config.max_urls_to_track = 3;
235 config.max_hosts_to_track = 2; 235 config.max_hosts_to_track = 2;
236 config.min_url_visit_count = 2; 236 config.min_url_visit_count = 2;
237 config.max_resources_per_entry = 4; 237 config.max_resources_per_entry = 4;
238 config.max_consecutive_misses = 2; 238 config.max_consecutive_misses = 2;
239 config.max_redirect_consecutive_misses = 2; 239 config.max_redirect_consecutive_misses = 2;
240 config.min_resource_confidence_to_trigger_prefetch = 0.5; 240 config.min_resource_confidence_to_trigger_prefetch = 0.5;
241 config.is_url_learning_enabled = true; 241 config.is_url_learning_enabled = true;
242 config.is_manifests_enabled = true; 242 config.is_manifests_enabled = true;
243 config.is_origin_learning_enabled = true; 243 config.is_origin_learning_enabled = true;
244 244
245 config.mode |= ResourcePrefetchPredictorConfig::LEARNING; 245 config.mode |= GlowplugPredictorConfig::LEARNING;
246 predictor_.reset(new ResourcePrefetchPredictor(config, profile_.get())); 246 predictor_.reset(new ResourcePrefetchPredictor(config, profile_.get()));
247 predictor_->set_mock_tables(mock_tables_); 247 predictor_->set_mock_tables(mock_tables_);
248 } 248 }
249 249
250 void InitializeSampleData(); 250 void InitializeSampleData();
251 void TestRedirectStatusHistogram( 251 void TestRedirectStatusHistogram(
252 const std::string& predictor_initial_key, 252 const std::string& predictor_initial_key,
253 const std::string& predictor_key, 253 const std::string& predictor_key,
254 const std::string& navigation_initial_url, 254 const std::string& navigation_initial_url,
255 const std::string& navigation_url, 255 const std::string& navigation_url,
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 net::MEDIUM, false, false); 2164 net::MEDIUM, false, false);
2165 resource3_rd->set_before_first_contentful_paint(false); 2165 resource3_rd->set_before_first_contentful_paint(false);
2166 EXPECT_CALL(*mock_tables_.get(), 2166 EXPECT_CALL(*mock_tables_.get(),
2167 UpdateResourceData(host_data, PREFETCH_KEY_TYPE_HOST)); 2167 UpdateResourceData(host_data, PREFETCH_KEY_TYPE_HOST));
2168 2168
2169 predictor_->RecordMainFrameLoadComplete(main_frame.navigation_id); 2169 predictor_->RecordMainFrameLoadComplete(main_frame.navigation_id);
2170 profile_->BlockUntilHistoryProcessesPendingRequests(); 2170 profile_->BlockUntilHistoryProcessesPendingRequests();
2171 } 2171 }
2172 2172
2173 } // namespace predictors 2173 } // namespace predictors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698