Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 TestPrerenderContents( | 207 TestPrerenderContents( |
| 208 PrerenderManager* prerender_manager, | 208 PrerenderManager* prerender_manager, |
| 209 PrerenderTracker* prerender_tracker, | 209 PrerenderTracker* prerender_tracker, |
| 210 Profile* profile, | 210 Profile* profile, |
| 211 const GURL& url, | 211 const GURL& url, |
| 212 const content::Referrer& referrer, | 212 const content::Referrer& referrer, |
| 213 int expected_number_of_loads, | 213 int expected_number_of_loads, |
| 214 FinalStatus expected_final_status, | 214 FinalStatus expected_final_status, |
| 215 bool prerender_should_wait_for_ready_title) | 215 bool prerender_should_wait_for_ready_title) |
| 216 : PrerenderContents(prerender_manager, prerender_tracker, | 216 : PrerenderContents(prerender_manager, prerender_tracker, |
| 217 profile, url, referrer, ORIGIN_LINK_REL_PRERENDER, | 217 profile, url, referrer, |
| 218 ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN, | |
| 218 PrerenderManager::kNoExperiment), | 219 PrerenderManager::kNoExperiment), |
| 219 number_of_loads_(0), | 220 number_of_loads_(0), |
| 220 expected_number_of_loads_(expected_number_of_loads), | 221 expected_number_of_loads_(expected_number_of_loads), |
| 221 expected_final_status_(expected_final_status), | 222 expected_final_status_(expected_final_status), |
| 222 new_render_view_host_(NULL), | 223 new_render_view_host_(NULL), |
| 223 was_hidden_(false), | 224 was_hidden_(false), |
| 224 was_shown_(false), | 225 was_shown_(false), |
| 225 should_be_shown_(expected_final_status == FINAL_STATUS_USED), | 226 should_be_shown_(expected_final_status == FINAL_STATUS_USED), |
| 226 quit_message_loop_on_destruction_( | 227 quit_message_loop_on_destruction_( |
| 227 expected_final_status != FINAL_STATUS_EVICTED && | 228 expected_final_status != FINAL_STATUS_EVICTED && |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 PrerenderContents::DidStopLoading(render_view_host); | 300 PrerenderContents::DidStopLoading(render_view_host); |
| 300 ++number_of_loads_; | 301 ++number_of_loads_; |
| 301 if (ShouldRenderPrerenderedPageCorrectly(expected_final_status_) && | 302 if (ShouldRenderPrerenderedPageCorrectly(expected_final_status_) && |
| 302 number_of_loads_ == expected_number_of_loads_) { | 303 number_of_loads_ == expected_number_of_loads_) { |
| 303 MessageLoopForUI::current()->Quit(); | 304 MessageLoopForUI::current()->Quit(); |
| 304 } | 305 } |
| 305 } | 306 } |
| 306 | 307 |
| 307 virtual void AddPendingPrerender( | 308 virtual void AddPendingPrerender( |
| 308 base::WeakPtr<PrerenderHandle> weak_prerender_handle, | 309 base::WeakPtr<PrerenderHandle> weak_prerender_handle, |
| 310 const Origin origin, | |
|
dominich
2012/09/14 14:40:45
nit: no need for const here.
gavinp
2012/09/14 21:10:47
It's not needed. But, http://google-styleguide.goo
dominich
2012/09/14 21:13:44
If it was up to me, I'd const ALL the things. Howe
mmenke
2012/09/17 20:39:27
I actually think the style guide is ambiguous. It
| |
| 309 const GURL& url, | 311 const GURL& url, |
| 310 const content::Referrer& referrer, | 312 const content::Referrer& referrer, |
| 311 const gfx::Size& size) OVERRIDE { | 313 const gfx::Size& size) OVERRIDE { |
| 312 PrerenderContents::AddPendingPrerender( | 314 PrerenderContents::AddPendingPrerender( |
| 313 weak_prerender_handle, url, referrer, size); | 315 weak_prerender_handle, origin, url, referrer, size); |
| 314 if (expected_pending_prerenders_ > 0 && | 316 if (expected_pending_prerenders_ > 0 && |
| 315 pending_prerenders().size() == expected_pending_prerenders_) { | 317 pending_prerenders().size() == expected_pending_prerenders_) { |
| 316 MessageLoop::current()->Quit(); | 318 MessageLoop::current()->Quit(); |
| 317 } | 319 } |
| 318 } | 320 } |
| 319 | 321 |
| 320 virtual WebContents* CreateWebContents( | 322 virtual WebContents* CreateWebContents( |
| 321 content::SessionStorageNamespace* session_storage_namespace) OVERRIDE { | 323 content::SessionStorageNamespace* session_storage_namespace) OVERRIDE { |
| 322 WebContents* web_contents = PrerenderContents::CreateWebContents( | 324 WebContents* web_contents = PrerenderContents::CreateWebContents( |
| 323 session_storage_namespace); | 325 session_storage_namespace); |
| (...skipping 2195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2519 channel_close_watcher.WatchChannel( | 2521 channel_close_watcher.WatchChannel( |
| 2520 chrome::GetActiveWebContents(browser())->GetRenderProcessHost()); | 2522 chrome::GetActiveWebContents(browser())->GetRenderProcessHost()); |
| 2521 NavigateToDestURL(); | 2523 NavigateToDestURL(); |
| 2522 channel_close_watcher.WaitForChannelClose(); | 2524 channel_close_watcher.WaitForChannelClose(); |
| 2523 | 2525 |
| 2524 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); | 2526 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); |
| 2525 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 2527 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 2526 } | 2528 } |
| 2527 | 2529 |
| 2528 } // namespace prerender | 2530 } // namespace prerender |
| OLD | NEW |