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

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

Issue 8801012: Add support for content::Referrer to prerender (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years 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
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_contents.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <deque> 5 #include <deque>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 // PrerenderContents that stops the UI message loop on DidStopLoading(). 112 // PrerenderContents that stops the UI message loop on DidStopLoading().
113 class TestPrerenderContents : public PrerenderContents { 113 class TestPrerenderContents : public PrerenderContents {
114 public: 114 public:
115 TestPrerenderContents( 115 TestPrerenderContents(
116 PrerenderManager* prerender_manager, 116 PrerenderManager* prerender_manager,
117 PrerenderTracker* prerender_tracker, 117 PrerenderTracker* prerender_tracker,
118 Profile* profile, 118 Profile* profile,
119 const GURL& url, 119 const GURL& url,
120 const GURL& referrer, 120 const content::Referrer& referrer,
121 int expected_number_of_loads, 121 int expected_number_of_loads,
122 FinalStatus expected_final_status) 122 FinalStatus expected_final_status)
123 : PrerenderContents(prerender_manager, prerender_tracker, 123 : PrerenderContents(prerender_manager, prerender_tracker,
124 profile, url, referrer, ORIGIN_LINK_REL_PRERENDER, 124 profile, url, referrer, ORIGIN_LINK_REL_PRERENDER,
125 PrerenderManager::kNoExperiment), 125 PrerenderManager::kNoExperiment),
126 number_of_loads_(0), 126 number_of_loads_(0),
127 expected_number_of_loads_(expected_number_of_loads), 127 expected_number_of_loads_(expected_number_of_loads),
128 expected_final_status_(expected_final_status), 128 expected_final_status_(expected_final_status),
129 new_render_view_host_(NULL), 129 new_render_view_host_(NULL),
130 was_hidden_(false), 130 was_hidden_(false),
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 PrerenderContents::DidStopLoading(); 195 PrerenderContents::DidStopLoading();
196 ++number_of_loads_; 196 ++number_of_loads_;
197 if (ShouldRenderPrerenderedPageCorrectly(expected_final_status_) && 197 if (ShouldRenderPrerenderedPageCorrectly(expected_final_status_) &&
198 number_of_loads_ == expected_number_of_loads_) { 198 number_of_loads_ == expected_number_of_loads_) {
199 MessageLoopForUI::current()->Quit(); 199 MessageLoopForUI::current()->Quit();
200 } 200 }
201 } 201 }
202 202
203 virtual void AddPendingPrerender(Origin origin, 203 virtual void AddPendingPrerender(Origin origin,
204 const GURL& url, 204 const GURL& url,
205 const GURL& referrer) { 205 const content::Referrer& referrer) OVERRIDE {
206 PrerenderContents::AddPendingPrerender(origin, url, referrer); 206 PrerenderContents::AddPendingPrerender(origin, url, referrer);
207 if (expected_pending_prerenders_ > 0 && 207 if (expected_pending_prerenders_ > 0 &&
208 pending_prerender_list()->size() == expected_pending_prerenders_) { 208 pending_prerender_list()->size() == expected_pending_prerenders_) {
209 MessageLoop::current()->Quit(); 209 MessageLoop::current()->Quit();
210 } 210 }
211 } 211 }
212 212
213 // Waits until the prerender has |expected_pending_prerenders| pending 213 // Waits until the prerender has |expected_pending_prerenders| pending
214 // prerenders. 214 // prerenders.
215 void WaitForPendingPrerenders(size_t expected_pending_prerenders) { 215 void WaitForPendingPrerenders(size_t expected_pending_prerenders) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 expected_final_status_queue_(expected_final_status_queue) { 299 expected_final_status_queue_(expected_final_status_queue) {
300 VLOG(1) << "Factory created with queue length " << 300 VLOG(1) << "Factory created with queue length " <<
301 expected_final_status_queue_.size(); 301 expected_final_status_queue_.size();
302 } 302 }
303 303
304 virtual PrerenderContents* CreatePrerenderContents( 304 virtual PrerenderContents* CreatePrerenderContents(
305 PrerenderManager* prerender_manager, 305 PrerenderManager* prerender_manager,
306 PrerenderTracker* prerender_tracker, 306 PrerenderTracker* prerender_tracker,
307 Profile* profile, 307 Profile* profile,
308 const GURL& url, 308 const GURL& url,
309 const GURL& referrer, 309 const content::Referrer& referrer,
310 Origin origin, 310 Origin origin,
311 uint8 experiment_id) OVERRIDE { 311 uint8 experiment_id) OVERRIDE {
312 FinalStatus expected_final_status = FINAL_STATUS_MATCH_COMPLETE_DUMMY; 312 FinalStatus expected_final_status = FINAL_STATUS_MATCH_COMPLETE_DUMMY;
313 if (!expected_final_status_queue_.empty()) { 313 if (!expected_final_status_queue_.empty()) {
314 expected_final_status = expected_final_status_queue_.front(); 314 expected_final_status = expected_final_status_queue_.front();
315 expected_final_status_queue_.pop_front(); 315 expected_final_status_queue_.pop_front();
316 } 316 }
317 VLOG(1) << "Creating prerender contents for " << url.path() << 317 VLOG(1) << "Creating prerender contents for " << url.path() <<
318 " with expected final status " << expected_final_status; 318 " with expected final status " << expected_final_status;
319 VLOG(1) << expected_final_status_queue_.size() << " left in the queue."; 319 VLOG(1) << expected_final_status_queue_.size() << " left in the queue.";
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderSessionStorage) { 1856 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderSessionStorage) {
1857 set_loader_path("files/prerender/prerender_loader_with_session_storage.html"); 1857 set_loader_path("files/prerender/prerender_loader_with_session_storage.html");
1858 PrerenderTestURL(GetCrossDomainTestUrl("files/prerender/prerender_page.html"), 1858 PrerenderTestURL(GetCrossDomainTestUrl("files/prerender/prerender_page.html"),
1859 FINAL_STATUS_USED, 1859 FINAL_STATUS_USED,
1860 1); 1860 1);
1861 NavigateToDestURL(); 1861 NavigateToDestURL();
1862 GoBackToPageBeforePrerender(browser()); 1862 GoBackToPageBeforePrerender(browser());
1863 } 1863 }
1864 1864
1865 } // namespace prerender 1865 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698