| OLD | NEW |
| 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/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 public: | 91 public: |
| 92 TestPrerenderContents( | 92 TestPrerenderContents( |
| 93 PrerenderManager* prerender_manager, | 93 PrerenderManager* prerender_manager, |
| 94 PrerenderTracker* prerender_tracker, | 94 PrerenderTracker* prerender_tracker, |
| 95 Profile* profile, | 95 Profile* profile, |
| 96 const GURL& url, | 96 const GURL& url, |
| 97 const GURL& referrer, | 97 const GURL& referrer, |
| 98 int number_of_loads, | 98 int number_of_loads, |
| 99 FinalStatus expected_final_status) | 99 FinalStatus expected_final_status) |
| 100 : PrerenderContents(prerender_manager, prerender_tracker, profile, | 100 : PrerenderContents(prerender_manager, prerender_tracker, profile, |
| 101 url, referrer), | 101 url, referrer, ORIGIN_LINK_REL_PRERENDER), |
| 102 number_of_loads_(0), | 102 number_of_loads_(0), |
| 103 expected_number_of_loads_(number_of_loads), | 103 expected_number_of_loads_(number_of_loads), |
| 104 expected_final_status_(expected_final_status), | 104 expected_final_status_(expected_final_status), |
| 105 new_render_view_host_(NULL), | 105 new_render_view_host_(NULL), |
| 106 was_hidden_(false), | 106 was_hidden_(false), |
| 107 was_shown_(false), | 107 was_shown_(false), |
| 108 quit_message_loop_on_destruction_(true) { | 108 quit_message_loop_on_destruction_(true) { |
| 109 } | 109 } |
| 110 | 110 |
| 111 virtual ~TestPrerenderContents() { | 111 virtual ~TestPrerenderContents() { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 expected_final_status_queue_.begin()); | 236 expected_final_status_queue_.begin()); |
| 237 VLOG(1) << "Factory created with queue length " << | 237 VLOG(1) << "Factory created with queue length " << |
| 238 expected_final_status_queue_.size(); | 238 expected_final_status_queue_.size(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 virtual PrerenderContents* CreatePrerenderContents( | 241 virtual PrerenderContents* CreatePrerenderContents( |
| 242 PrerenderManager* prerender_manager, | 242 PrerenderManager* prerender_manager, |
| 243 PrerenderTracker* prerender_tracker, | 243 PrerenderTracker* prerender_tracker, |
| 244 Profile* profile, | 244 Profile* profile, |
| 245 const GURL& url, | 245 const GURL& url, |
| 246 const GURL& referrer) OVERRIDE { | 246 const GURL& referrer, |
| 247 Origin origin) OVERRIDE { |
| 247 CHECK(!expected_final_status_queue_.empty()) << | 248 CHECK(!expected_final_status_queue_.empty()) << |
| 248 "Creating prerender contents for " << url.path() << | 249 "Creating prerender contents for " << url.path() << |
| 249 " with no expected final status"; | 250 " with no expected final status"; |
| 250 FinalStatus expected_final_status = expected_final_status_queue_.front(); | 251 FinalStatus expected_final_status = expected_final_status_queue_.front(); |
| 251 expected_final_status_queue_.pop_front(); | 252 expected_final_status_queue_.pop_front(); |
| 252 VLOG(1) << "Creating prerender contents for " << url.path() << | 253 VLOG(1) << "Creating prerender contents for " << url.path() << |
| 253 " with expected final status " << expected_final_status; | 254 " with expected final status " << expected_final_status; |
| 254 VLOG(1) << expected_final_status_queue_.size() << " left in the queue."; | 255 VLOG(1) << expected_final_status_queue_.size() << " left in the queue."; |
| 255 return new TestPrerenderContents(prerender_manager, prerender_tracker, | 256 return new TestPrerenderContents(prerender_manager, prerender_tracker, |
| 256 profile, url, | 257 profile, url, |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 NewRunnableFunction(ClearBrowsingData, browser(), | 1443 NewRunnableFunction(ClearBrowsingData, browser(), |
| 1443 BrowsingDataRemover::REMOVE_CACHE)); | 1444 BrowsingDataRemover::REMOVE_CACHE)); |
| 1444 ui_test_utils::RunMessageLoop(); | 1445 ui_test_utils::RunMessageLoop(); |
| 1445 | 1446 |
| 1446 // Make sure prerender history was not cleared. Not a vital behavior, but | 1447 // Make sure prerender history was not cleared. Not a vital behavior, but |
| 1447 // used to compare with PrerenderClearHistory test. | 1448 // used to compare with PrerenderClearHistory test. |
| 1448 EXPECT_EQ(1, GetHistoryLength()); | 1449 EXPECT_EQ(1, GetHistoryLength()); |
| 1449 } | 1450 } |
| 1450 | 1451 |
| 1451 } // namespace prerender | 1452 } // namespace prerender |
| OLD | NEW |