| 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, ORIGIN_LINK_REL_PRERENDER), | 101 url, referrer, ORIGIN_LINK_REL_PRERENDER, |
| 102 PrerenderManager::kNoExperiment), |
| 102 number_of_loads_(0), | 103 number_of_loads_(0), |
| 103 expected_number_of_loads_(number_of_loads), | 104 expected_number_of_loads_(number_of_loads), |
| 104 expected_final_status_(expected_final_status), | 105 expected_final_status_(expected_final_status), |
| 105 new_render_view_host_(NULL), | 106 new_render_view_host_(NULL), |
| 106 was_hidden_(false), | 107 was_hidden_(false), |
| 107 was_shown_(false), | 108 was_shown_(false), |
| 108 should_be_shown_(expected_final_status == FINAL_STATUS_USED), | 109 should_be_shown_(expected_final_status == FINAL_STATUS_USED), |
| 109 quit_message_loop_on_destruction_(true) { | 110 quit_message_loop_on_destruction_(true) { |
| 110 } | 111 } |
| 111 | 112 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 VLOG(1) << "Factory created with queue length " << | 246 VLOG(1) << "Factory created with queue length " << |
| 246 expected_final_status_queue_.size(); | 247 expected_final_status_queue_.size(); |
| 247 } | 248 } |
| 248 | 249 |
| 249 virtual PrerenderContents* CreatePrerenderContents( | 250 virtual PrerenderContents* CreatePrerenderContents( |
| 250 PrerenderManager* prerender_manager, | 251 PrerenderManager* prerender_manager, |
| 251 PrerenderTracker* prerender_tracker, | 252 PrerenderTracker* prerender_tracker, |
| 252 Profile* profile, | 253 Profile* profile, |
| 253 const GURL& url, | 254 const GURL& url, |
| 254 const GURL& referrer, | 255 const GURL& referrer, |
| 255 Origin origin) OVERRIDE { | 256 Origin origin, |
| 257 uint8 experiment_id) OVERRIDE { |
| 256 CHECK(!expected_final_status_queue_.empty()) << | 258 CHECK(!expected_final_status_queue_.empty()) << |
| 257 "Creating prerender contents for " << url.path() << | 259 "Creating prerender contents for " << url.path() << |
| 258 " with no expected final status"; | 260 " with no expected final status"; |
| 259 FinalStatus expected_final_status = expected_final_status_queue_.front(); | 261 FinalStatus expected_final_status = expected_final_status_queue_.front(); |
| 260 expected_final_status_queue_.pop_front(); | 262 expected_final_status_queue_.pop_front(); |
| 261 VLOG(1) << "Creating prerender contents for " << url.path() << | 263 VLOG(1) << "Creating prerender contents for " << url.path() << |
| 262 " with expected final status " << expected_final_status; | 264 " with expected final status " << expected_final_status; |
| 263 VLOG(1) << expected_final_status_queue_.size() << " left in the queue."; | 265 VLOG(1) << expected_final_status_queue_.size() << " left in the queue."; |
| 264 return new TestPrerenderContents(prerender_manager, prerender_tracker, | 266 return new TestPrerenderContents(prerender_manager, prerender_tracker, |
| 265 profile, url, | 267 profile, url, |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 NewRunnableFunction(ClearBrowsingData, browser(), | 1510 NewRunnableFunction(ClearBrowsingData, browser(), |
| 1509 BrowsingDataRemover::REMOVE_CACHE)); | 1511 BrowsingDataRemover::REMOVE_CACHE)); |
| 1510 ui_test_utils::RunMessageLoop(); | 1512 ui_test_utils::RunMessageLoop(); |
| 1511 | 1513 |
| 1512 // Make sure prerender history was not cleared. Not a vital behavior, but | 1514 // Make sure prerender history was not cleared. Not a vital behavior, but |
| 1513 // used to compare with PrerenderClearHistory test. | 1515 // used to compare with PrerenderClearHistory test. |
| 1514 EXPECT_EQ(1, GetHistoryLength()); | 1516 EXPECT_EQ(1, GetHistoryLength()); |
| 1515 } | 1517 } |
| 1516 | 1518 |
| 1517 } // namespace prerender | 1519 } // namespace prerender |
| OLD | NEW |