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

Side by Side Diff: chrome/browser/prerender/prerender_resource_handler_unittest.cc

Issue 6625066: Add pending preloads indexed by routing id. Start preloading once we navigate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/prerender/prerender_resource_handler.h" 5 #include "chrome/browser/prerender/prerender_resource_handler.h"
6 #include "content/common/resource_response.h" 6 #include "content/common/resource_response.h"
7 #include "net/http/http_response_headers.h" 7 #include "net/http/http_response_headers.h"
8 #include "net/url_request/url_request_test_util.h" 8 #include "net/url_request/url_request_test_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 virtual ~PrerenderResourceHandlerTest() { 103 virtual ~PrerenderResourceHandlerTest() {
104 // When a ResourceHandler's reference count drops to 0, it is not 104 // When a ResourceHandler's reference count drops to 0, it is not
105 // deleted immediately. Instead, a task is posted to the IO thread's 105 // deleted immediately. Instead, a task is posted to the IO thread's
106 // message loop to delete it. 106 // message loop to delete it.
107 // So, drop the reference count to 0 and run the message loop once 107 // So, drop the reference count to 0 and run the message loop once
108 // to ensure that all resources are cleaned up before the test exits. 108 // to ensure that all resources are cleaned up before the test exits.
109 pre_handler_ = NULL; 109 pre_handler_ = NULL;
110 loop_.RunAllPending(); 110 loop_.RunAllPending();
111 } 111 }
112 112
113 void SetLastHandledURL(const GURL& url, const std::vector<GURL>& alias_urls, 113 void SetLastHandledURL(const std::pair<int, int>& child_route_id_pair,
114 const GURL& referrer) { 114 const GURL& url, const std::vector<GURL>& alias_urls,
115 const GURL& referrer, bool make_pending) {
115 last_handled_url_ = url; 116 last_handled_url_ = url;
116 alias_urls_ = alias_urls; 117 alias_urls_ = alias_urls;
117 referrer_ = referrer; 118 referrer_ = referrer;
118 } 119 }
119 120
120 // Common logic shared by many of the tests 121 // Common logic shared by many of the tests
121 void StartPrerendering(const std::string& mime_type, 122 void StartPrerendering(const std::string& mime_type,
122 const char* headers) { 123 const char* headers) {
123 int request_id = 1; 124 int request_id = 1;
124 bool defer = false; 125 bool defer = false;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 EXPECT_FALSE(pre_handler_->OnRequestRedirected(kRequestId, 213 EXPECT_FALSE(pre_handler_->OnRequestRedirected(kRequestId,
213 url_https, 214 url_https,
214 NULL, 215 NULL,
215 &defer)); 216 &defer));
216 EXPECT_FALSE(defer); 217 EXPECT_FALSE(defer);
217 } 218 }
218 219
219 } // namespace 220 } // namespace
220 221
221 } // namespace prerender 222 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_resource_handler.cc ('k') | chrome/test/data/prerender/prerender_infinite_a_multiple.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698