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

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

Issue 10386223: Renaming poorly named classes and adding missing unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo rename of Dispatcher Created 8 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 | Annotate | Revision Log
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 #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/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 default: 119 default:
120 return false; 120 return false;
121 } 121 }
122 } 122 }
123 123
124 // PrerenderContents that stops the UI message loop on DidStopLoading(). 124 // PrerenderContents that stops the UI message loop on DidStopLoading().
125 class TestPrerenderContents : public PrerenderContents { 125 class TestPrerenderContents : public PrerenderContents {
126 public: 126 public:
127 TestPrerenderContents( 127 TestPrerenderContents(
128 PrerenderManager* prerender_manager, 128 PrerenderManager* prerender_manager,
129 PrerenderTracker* prerender_tracker, 129 PrerenderRenderViewTracker* prerender_render_view_tracker,
130 Profile* profile, 130 Profile* profile,
131 const GURL& url, 131 const GURL& url,
132 const content::Referrer& referrer, 132 const content::Referrer& referrer,
133 int expected_number_of_loads, 133 int expected_number_of_loads,
134 FinalStatus expected_final_status, 134 FinalStatus expected_final_status,
135 bool prerender_should_wait_for_ready_title) 135 bool prerender_should_wait_for_ready_title)
136 : PrerenderContents(prerender_manager, prerender_tracker, 136 : PrerenderContents(prerender_manager, prerender_render_view_tracker,
137 profile, url, referrer, ORIGIN_LINK_REL_PRERENDER, 137 profile, url, referrer, ORIGIN_LINK_REL_PRERENDER,
138 PrerenderManager::kNoExperiment), 138 PrerenderManager::kNoExperiment),
139 number_of_loads_(0), 139 number_of_loads_(0),
140 expected_number_of_loads_(expected_number_of_loads), 140 expected_number_of_loads_(expected_number_of_loads),
141 expected_final_status_(expected_final_status), 141 expected_final_status_(expected_final_status),
142 new_render_view_host_(NULL), 142 new_render_view_host_(NULL),
143 was_hidden_(false), 143 was_hidden_(false),
144 was_shown_(false), 144 was_shown_(false),
145 should_be_shown_(expected_final_status == FINAL_STATUS_USED), 145 should_be_shown_(expected_final_status == FINAL_STATUS_USED),
146 quit_message_loop_on_destruction_( 146 quit_message_loop_on_destruction_(
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 : expected_number_of_loads_(expected_number_of_loads), 350 : expected_number_of_loads_(expected_number_of_loads),
351 expected_final_status_queue_(expected_final_status_queue), 351 expected_final_status_queue_(expected_final_status_queue),
352 prerender_should_wait_for_ready_title_( 352 prerender_should_wait_for_ready_title_(
353 prerender_should_wait_for_ready_title) { 353 prerender_should_wait_for_ready_title) {
354 VLOG(1) << "Factory created with queue length " << 354 VLOG(1) << "Factory created with queue length " <<
355 expected_final_status_queue_.size(); 355 expected_final_status_queue_.size();
356 } 356 }
357 357
358 virtual PrerenderContents* CreatePrerenderContents( 358 virtual PrerenderContents* CreatePrerenderContents(
359 PrerenderManager* prerender_manager, 359 PrerenderManager* prerender_manager,
360 PrerenderTracker* prerender_tracker, 360 PrerenderRenderViewTracker* prerender_render_view_tracker,
361 Profile* profile, 361 Profile* profile,
362 const GURL& url, 362 const GURL& url,
363 const content::Referrer& referrer, 363 const content::Referrer& referrer,
364 Origin origin, 364 Origin origin,
365 uint8 experiment_id) OVERRIDE { 365 uint8 experiment_id) OVERRIDE {
366 FinalStatus expected_final_status = FINAL_STATUS_MAX; 366 FinalStatus expected_final_status = FINAL_STATUS_MAX;
367 if (!expected_final_status_queue_.empty()) { 367 if (!expected_final_status_queue_.empty()) {
368 expected_final_status = expected_final_status_queue_.front(); 368 expected_final_status = expected_final_status_queue_.front();
369 expected_final_status_queue_.pop_front(); 369 expected_final_status_queue_.pop_front();
370 } 370 }
371 VLOG(1) << "Creating prerender contents for " << url.path() << 371 VLOG(1) << "Creating prerender contents for " << url.path() <<
372 " with expected final status " << expected_final_status; 372 " with expected final status " << expected_final_status;
373 VLOG(1) << expected_final_status_queue_.size() << " left in the queue."; 373 VLOG(1) << expected_final_status_queue_.size() << " left in the queue.";
374 return new TestPrerenderContents(prerender_manager, prerender_tracker, 374 return new TestPrerenderContents(prerender_manager,
375 prerender_render_view_tracker,
375 profile, url, 376 profile, url,
376 referrer, expected_number_of_loads_, 377 referrer, expected_number_of_loads_,
377 expected_final_status, 378 expected_final_status,
378 prerender_should_wait_for_ready_title_); 379 prerender_should_wait_for_ready_title_);
379 } 380 }
380 381
381 private: 382 private:
382 int expected_number_of_loads_; 383 int expected_number_of_loads_;
383 std::deque<FinalStatus> expected_final_status_queue_; 384 std::deque<FinalStatus> expected_final_status_queue_;
384 bool prerender_should_wait_for_ready_title_; 385 bool prerender_should_wait_for_ready_title_;
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLReferrerPolicy) { 2234 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLReferrerPolicy) {
2234 set_use_https_src(true); 2235 set_use_https_src(true);
2235 set_loader_path("files/prerender/prerender_loader_with_referrer_policy.html"); 2236 set_loader_path("files/prerender/prerender_loader_with_referrer_policy.html");
2236 PrerenderTestURL("files/prerender/prerender_referrer_policy.html", 2237 PrerenderTestURL("files/prerender/prerender_referrer_policy.html",
2237 FINAL_STATUS_USED, 2238 FINAL_STATUS_USED,
2238 1); 2239 1);
2239 NavigateToDestURL(); 2240 NavigateToDestURL();
2240 } 2241 }
2241 2242
2242 } // namespace prerender 2243 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/prerender/prerender_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698