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

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

Issue 10933065: Separate same domain and cross domain <link rel=...> prerenders for reporting. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: remediate in prep for CQ... Created 8 years, 2 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 // PrerenderContents that stops the UI message loop on DidStopLoading(). 205 // PrerenderContents that stops the UI message loop on DidStopLoading().
206 class TestPrerenderContents : public PrerenderContents { 206 class TestPrerenderContents : public PrerenderContents {
207 public: 207 public:
208 TestPrerenderContents( 208 TestPrerenderContents(
209 PrerenderManager* prerender_manager, 209 PrerenderManager* prerender_manager,
210 PrerenderTracker* prerender_tracker, 210 PrerenderTracker* prerender_tracker,
211 Profile* profile, 211 Profile* profile,
212 const GURL& url, 212 const GURL& url,
213 const content::Referrer& referrer, 213 const content::Referrer& referrer,
214 Origin origin,
214 int expected_number_of_loads, 215 int expected_number_of_loads,
215 FinalStatus expected_final_status, 216 FinalStatus expected_final_status,
216 bool prerender_should_wait_for_ready_title) 217 bool prerender_should_wait_for_ready_title)
217 : PrerenderContents(prerender_manager, prerender_tracker, 218 : PrerenderContents(prerender_manager, prerender_tracker, profile, url,
218 profile, url, referrer, ORIGIN_LINK_REL_PRERENDER, 219 referrer, origin, PrerenderManager::kNoExperiment),
219 PrerenderManager::kNoExperiment),
220 number_of_loads_(0), 220 number_of_loads_(0),
221 expected_number_of_loads_(expected_number_of_loads), 221 expected_number_of_loads_(expected_number_of_loads),
222 expected_final_status_(expected_final_status), 222 expected_final_status_(expected_final_status),
223 new_render_view_host_(NULL), 223 new_render_view_host_(NULL),
224 was_hidden_(false), 224 was_hidden_(false),
225 was_shown_(false), 225 was_shown_(false),
226 should_be_shown_(expected_final_status == FINAL_STATUS_USED), 226 should_be_shown_(expected_final_status == FINAL_STATUS_USED),
227 quit_message_loop_on_destruction_( 227 quit_message_loop_on_destruction_(
228 expected_final_status != FINAL_STATUS_EVICTED && 228 expected_final_status != FINAL_STATUS_EVICTED &&
229 expected_final_status != FINAL_STATUS_APP_TERMINATING && 229 expected_final_status != FINAL_STATUS_APP_TERMINATING &&
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 uint8 experiment_id) OVERRIDE { 467 uint8 experiment_id) OVERRIDE {
468 FinalStatus expected_final_status = FINAL_STATUS_MAX; 468 FinalStatus expected_final_status = FINAL_STATUS_MAX;
469 if (!expected_final_status_queue_.empty()) { 469 if (!expected_final_status_queue_.empty()) {
470 expected_final_status = expected_final_status_queue_.front(); 470 expected_final_status = expected_final_status_queue_.front();
471 expected_final_status_queue_.pop_front(); 471 expected_final_status_queue_.pop_front();
472 } 472 }
473 VLOG(1) << "Creating prerender contents for " << url.path() << 473 VLOG(1) << "Creating prerender contents for " << url.path() <<
474 " with expected final status " << expected_final_status; 474 " with expected final status " << expected_final_status;
475 VLOG(1) << expected_final_status_queue_.size() << " left in the queue."; 475 VLOG(1) << expected_final_status_queue_.size() << " left in the queue.";
476 return new TestPrerenderContents(prerender_manager, prerender_tracker, 476 return new TestPrerenderContents(prerender_manager, prerender_tracker,
477 profile, url, 477 profile, url, referrer, origin,
478 referrer, expected_number_of_loads_, 478 expected_number_of_loads_,
479 expected_final_status, 479 expected_final_status,
480 prerender_should_wait_for_ready_title_); 480 prerender_should_wait_for_ready_title_);
481 } 481 }
482 482
483 private: 483 private:
484 int expected_number_of_loads_; 484 int expected_number_of_loads_;
485 std::deque<FinalStatus> expected_final_status_queue_; 485 std::deque<FinalStatus> expected_final_status_queue_;
486 bool prerender_should_wait_for_ready_title_; 486 bool prerender_should_wait_for_ready_title_;
487 }; 487 };
488 488
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after
2519 channel_close_watcher.WatchChannel( 2519 channel_close_watcher.WatchChannel(
2520 chrome::GetActiveWebContents(browser())->GetRenderProcessHost()); 2520 chrome::GetActiveWebContents(browser())->GetRenderProcessHost());
2521 NavigateToDestURL(); 2521 NavigateToDestURL();
2522 channel_close_watcher.WaitForChannelClose(); 2522 channel_close_watcher.WaitForChannelClose();
2523 2523
2524 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); 2524 ASSERT_TRUE(IsEmptyPrerenderLinkManager());
2525 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 2525 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
2526 } 2526 }
2527 2527
2528 } // namespace prerender 2528 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_histograms.cc » ('j') | chrome/browser/prerender/prerender_histograms.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698