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

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

Issue 2815103002: predictors: Enable origin learning with a flag. (Closed)
Patch Set: . Created 3 years, 8 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
« no previous file with comments | « chrome/browser/predictors/resource_prefetch_predictor.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 void ResetPredictor() { 234 void ResetPredictor() {
235 ResourcePrefetchPredictorConfig config; 235 ResourcePrefetchPredictorConfig config;
236 config.max_urls_to_track = 3; 236 config.max_urls_to_track = 3;
237 config.max_hosts_to_track = 2; 237 config.max_hosts_to_track = 2;
238 config.min_url_visit_count = 2; 238 config.min_url_visit_count = 2;
239 config.max_resources_per_entry = 4; 239 config.max_resources_per_entry = 4;
240 config.max_consecutive_misses = 2; 240 config.max_consecutive_misses = 2;
241 config.min_resource_confidence_to_trigger_prefetch = 0.5; 241 config.min_resource_confidence_to_trigger_prefetch = 0.5;
242 config.is_url_learning_enabled = true; 242 config.is_url_learning_enabled = true;
243 config.is_manifests_enabled = true; 243 config.is_manifests_enabled = true;
244 config.is_origin_prediction_enabled = true; 244 config.is_origin_learning_enabled = true;
245 245
246 config.mode |= ResourcePrefetchPredictorConfig::LEARNING; 246 config.mode |= ResourcePrefetchPredictorConfig::LEARNING;
247 predictor_.reset(new ResourcePrefetchPredictor(config, profile_.get())); 247 predictor_.reset(new ResourcePrefetchPredictor(config, profile_.get()));
248 predictor_->set_mock_tables(mock_tables_); 248 predictor_->set_mock_tables(mock_tables_);
249 } 249 }
250 250
251 void InitializeSampleData(); 251 void InitializeSampleData();
252 void TestRedirectStatusHistogram( 252 void TestRedirectStatusHistogram(
253 const std::string& predictor_initial_key, 253 const std::string& predictor_initial_key,
254 const std::string& predictor_key, 254 const std::string& predictor_key,
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 predictor_->host_table_cache_->insert( 1949 predictor_->host_table_cache_->insert(
1950 std::make_pair(google.primary_key(), google)); 1950 std::make_pair(google.primary_key(), google));
1951 1951
1952 predictor_->StartPrefetching(GURL(main_frame_url), PrefetchOrigin::EXTERNAL); 1952 predictor_->StartPrefetching(GURL(main_frame_url), PrefetchOrigin::EXTERNAL);
1953 predictor_->StopPrefetching(GURL(main_frame_url)); 1953 predictor_->StopPrefetching(GURL(main_frame_url));
1954 histogram_tester_->ExpectTotalCount( 1954 histogram_tester_->ExpectTotalCount(
1955 internal::kResourcePrefetchPredictorPrefetchingDurationHistogram, 1); 1955 internal::kResourcePrefetchPredictorPrefetchingDurationHistogram, 1);
1956 } 1956 }
1957 1957
1958 } // namespace predictors 1958 } // namespace predictors
OLDNEW
« no previous file with comments | « chrome/browser/predictors/resource_prefetch_predictor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698