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

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

Issue 10817004: Adds speculative prefetching of resources. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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 (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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 bool URLRequestSummaryAreEqual(const URLRequestSummary& lhs, 92 bool URLRequestSummaryAreEqual(const URLRequestSummary& lhs,
93 const URLRequestSummary& rhs) { 93 const URLRequestSummary& rhs) {
94 return lhs.navigation_id == rhs.navigation_id && 94 return lhs.navigation_id == rhs.navigation_id &&
95 lhs.resource_url == rhs.resource_url && 95 lhs.resource_url == rhs.resource_url &&
96 lhs.resource_type == rhs.resource_type && 96 lhs.resource_type == rhs.resource_type &&
97 lhs.mime_type == rhs.mime_type && 97 lhs.mime_type == rhs.mime_type &&
98 lhs.was_cached == rhs.was_cached; 98 lhs.was_cached == rhs.was_cached;
99 } 99 }
100 100
101 void ResetPredictor() { 101 void ResetPredictor() {
102 ResourcePrefetchPredictor::Config config; 102 ResourcePrefetchPredictorConfig config;
103 config.max_urls_to_track = 3; 103 config.max_urls_to_track = 3;
104 config.min_url_visit_count = 2; 104 config.min_url_visit_count = 2;
105 config.max_resources_per_entry = 4; 105 config.max_resources_per_entry = 4;
106 config.max_consecutive_misses = 2; 106 config.max_consecutive_misses = 2;
107 predictor_.reset(new ResourcePrefetchPredictor(config, &profile_)); 107 predictor_.reset(new ResourcePrefetchPredictor(config, &profile_));
108 predictor_->SetTablesForTesting(mock_tables_); 108 predictor_->SetTablesForTesting(mock_tables_);
109 } 109 }
110 110
111 MessageLoop loop_; 111 MessageLoop loop_;
112 content::TestBrowserThread ui_thread_; 112 content::TestBrowserThread ui_thread_;
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 predictor_->inflight_navigations_[main_frame1.navigation_id][0])); 591 predictor_->inflight_navigations_[main_frame1.navigation_id][0]));
592 EXPECT_TRUE(URLRequestSummaryAreEqual( 592 EXPECT_TRUE(URLRequestSummaryAreEqual(
593 resource2, 593 resource2,
594 predictor_->inflight_navigations_[main_frame1.navigation_id][1])); 594 predictor_->inflight_navigations_[main_frame1.navigation_id][1]));
595 EXPECT_TRUE(URLRequestSummaryAreEqual( 595 EXPECT_TRUE(URLRequestSummaryAreEqual(
596 resource3, 596 resource3,
597 predictor_->inflight_navigations_[main_frame1.navigation_id][2])); 597 predictor_->inflight_navigations_[main_frame1.navigation_id][2]));
598 } 598 }
599 599
600 } // namespace predictors 600 } // namespace predictors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698