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

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

Issue 8503040: Prerendering: Add MatchComplete PPLT (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 <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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 PrerenderManager::kNoExperiment), 120 PrerenderManager::kNoExperiment),
121 number_of_loads_(0), 121 number_of_loads_(0),
122 expected_number_of_loads_(expected_number_of_loads), 122 expected_number_of_loads_(expected_number_of_loads),
123 expected_final_status_(expected_final_status), 123 expected_final_status_(expected_final_status),
124 new_render_view_host_(NULL), 124 new_render_view_host_(NULL),
125 was_hidden_(false), 125 was_hidden_(false),
126 was_shown_(false), 126 was_shown_(false),
127 should_be_shown_(expected_final_status == FINAL_STATUS_USED), 127 should_be_shown_(expected_final_status == FINAL_STATUS_USED),
128 quit_message_loop_on_destruction_( 128 quit_message_loop_on_destruction_(
129 expected_final_status != FINAL_STATUS_EVICTED && 129 expected_final_status != FINAL_STATUS_EVICTED &&
130 expected_final_status != FINAL_STATUS_APP_TERMINATING), 130 expected_final_status != FINAL_STATUS_APP_TERMINATING &&
131 expected_final_status != FINAL_STATUS_MATCH_COMPLETE_DUMMY),
131 expected_pending_prerenders_(0) { 132 expected_pending_prerenders_(0) {
132 if (expected_number_of_loads == 0) 133 if (expected_number_of_loads == 0)
133 MessageLoopForUI::current()->Quit(); 134 MessageLoopForUI::current()->Quit();
134 } 135 }
135 136
136 virtual ~TestPrerenderContents() { 137 virtual ~TestPrerenderContents() {
137 EXPECT_EQ(expected_final_status_, final_status()) << 138 EXPECT_EQ(expected_final_status_, final_status()) <<
138 " when testing URL " << prerender_url().path() << 139 " when testing URL " << prerender_url().path() <<
139 " (Expected: " << NameFromFinalStatus(expected_final_status_) << 140 " (Expected: " << NameFromFinalStatus(expected_final_status_) <<
140 ", Actual: " << NameFromFinalStatus(final_status()) << ")"; 141 ", Actual: " << NameFromFinalStatus(final_status()) << ")";
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 297 }
297 298
298 virtual PrerenderContents* CreatePrerenderContents( 299 virtual PrerenderContents* CreatePrerenderContents(
299 PrerenderManager* prerender_manager, 300 PrerenderManager* prerender_manager,
300 PrerenderTracker* prerender_tracker, 301 PrerenderTracker* prerender_tracker,
301 Profile* profile, 302 Profile* profile,
302 const GURL& url, 303 const GURL& url,
303 const GURL& referrer, 304 const GURL& referrer,
304 Origin origin, 305 Origin origin,
305 uint8 experiment_id) OVERRIDE { 306 uint8 experiment_id) OVERRIDE {
306 CHECK(!expected_final_status_queue_.empty()) << 307 FinalStatus expected_final_status = FINAL_STATUS_MATCH_COMPLETE_DUMMY;
307 "Creating prerender contents for " << url.path() << 308 if (!expected_final_status_queue_.empty()) {
308 " with no expected final status"; 309 expected_final_status = expected_final_status_queue_.front();
309 FinalStatus expected_final_status = expected_final_status_queue_.front(); 310 expected_final_status_queue_.pop_front();
310 expected_final_status_queue_.pop_front(); 311 }
311 VLOG(1) << "Creating prerender contents for " << url.path() << 312 VLOG(1) << "Creating prerender contents for " << url.path() <<
312 " with expected final status " << expected_final_status; 313 " with expected final status " << expected_final_status;
313 VLOG(1) << expected_final_status_queue_.size() << " left in the queue."; 314 VLOG(1) << expected_final_status_queue_.size() << " left in the queue.";
314 return new TestPrerenderContents(prerender_manager, prerender_tracker, 315 return new TestPrerenderContents(prerender_manager, prerender_tracker,
315 profile, url, 316 profile, url,
316 referrer, expected_number_of_loads_, 317 referrer, expected_number_of_loads_,
317 expected_final_status); 318 expected_final_status);
318 } 319 }
319 320
320 private: 321 private:
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSessionStorage) { 1842 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSessionStorage) {
1842 set_loader_path("files/prerender/prerender_loader_with_session_storage.html"); 1843 set_loader_path("files/prerender/prerender_loader_with_session_storage.html");
1843 PrerenderTestURL(GetCrossDomainTestUrl("files/prerender/prerender_page.html"), 1844 PrerenderTestURL(GetCrossDomainTestUrl("files/prerender/prerender_page.html"),
1844 FINAL_STATUS_USED, 1845 FINAL_STATUS_USED,
1845 1); 1846 1);
1846 NavigateToDestURL(); 1847 NavigateToDestURL();
1847 GoBackToPageBeforePrerender(browser()); 1848 GoBackToPageBeforePrerender(browser());
1848 } 1849 }
1849 1850
1850 } // namespace prerender 1851 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_contents.h » ('j') | chrome/browser/prerender/prerender_contents.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698