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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 ", Actual: " << NameFromFinalStatus(final_status()) << ")"; | 162 ", Actual: " << NameFromFinalStatus(final_status()) << ")"; |
163 } | 163 } |
164 // Prerendering RenderViewHosts should be hidden before the first | 164 // Prerendering RenderViewHosts should be hidden before the first |
165 // navigation, so this should be happen for every PrerenderContents for | 165 // navigation, so this should be happen for every PrerenderContents for |
166 // which a RenderViewHost is created, regardless of whether or not it's | 166 // which a RenderViewHost is created, regardless of whether or not it's |
167 // used. | 167 // used. |
168 if (new_render_view_host_) | 168 if (new_render_view_host_) |
169 EXPECT_TRUE(was_hidden_); | 169 EXPECT_TRUE(was_hidden_); |
170 | 170 |
171 // A used PrerenderContents will only be destroyed when we swap out | 171 // A used PrerenderContents will only be destroyed when we swap out |
172 // TabContents, at the end of a navigation caused by a call to | 172 // WebContents, at the end of a navigation caused by a call to |
173 // NavigateToURLImpl(). | 173 // NavigateToURLImpl(). |
174 if (final_status() == FINAL_STATUS_USED) | 174 if (final_status() == FINAL_STATUS_USED) |
175 EXPECT_TRUE(new_render_view_host_); | 175 EXPECT_TRUE(new_render_view_host_); |
176 | 176 |
177 EXPECT_EQ(should_be_shown_, was_shown_); | 177 EXPECT_EQ(should_be_shown_, was_shown_); |
178 | 178 |
179 // When the PrerenderContents is destroyed, quit the UI message loop. | 179 // When the PrerenderContents is destroyed, quit the UI message loop. |
180 // This happens on navigation to used prerendered pages, and soon | 180 // This happens on navigation to used prerendered pages, and soon |
181 // after cancellation of unused prerendered pages. | 181 // after cancellation of unused prerendered pages. |
182 if (quit_message_loop_on_destruction_) { | 182 if (quit_message_loop_on_destruction_) { |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 | 1414 |
1415 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderTaskManager) { | 1415 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderTaskManager) { |
1416 // Show the task manager. This populates the model. | 1416 // Show the task manager. This populates the model. |
1417 current_browser()->window()->ShowTaskManager(); | 1417 current_browser()->window()->ShowTaskManager(); |
1418 // Wait for the model of task manager to start. | 1418 // Wait for the model of task manager to start. |
1419 TaskManagerBrowserTestUtil::WaitForResourceChange(2); | 1419 TaskManagerBrowserTestUtil::WaitForResourceChange(2); |
1420 | 1420 |
1421 // Start with two resources. | 1421 // Start with two resources. |
1422 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); | 1422 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); |
1423 | 1423 |
1424 // One of the resources that has a TabContents associated with it should have | 1424 // One of the resources that has a WebContents associated with it should have |
1425 // the Prerender prefix. | 1425 // the Prerender prefix. |
1426 const string16 prefix = | 1426 const string16 prefix = |
1427 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PRERENDER_PREFIX, string16()); | 1427 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PRERENDER_PREFIX, string16()); |
1428 string16 prerender_title; | 1428 string16 prerender_title; |
1429 int num_prerender_tabs = 0; | 1429 int num_prerender_tabs = 0; |
1430 | 1430 |
1431 for (int i = 0; i < model()->ResourceCount(); ++i) { | 1431 for (int i = 0; i < model()->ResourceCount(); ++i) { |
1432 if (model()->GetResourceTabContents(i)) { | 1432 if (model()->GetResourceTabContents(i)) { |
1433 prerender_title = model()->GetResourceTitle(i); | 1433 prerender_title = model()->GetResourceTitle(i); |
1434 if (StartsWith(prerender_title, prefix, true)) | 1434 if (StartsWith(prerender_title, prefix, true)) |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 WebContents* web_contents = browser()->GetSelectedWebContents(); | 2147 WebContents* web_contents = browser()->GetSelectedWebContents(); |
2148 bool display_test_result = false; | 2148 bool display_test_result = false; |
2149 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 2149 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
2150 web_contents->GetRenderViewHost(), L"", | 2150 web_contents->GetRenderViewHost(), L"", |
2151 L"DidDisplayReallyPass()", | 2151 L"DidDisplayReallyPass()", |
2152 &display_test_result)); | 2152 &display_test_result)); |
2153 ASSERT_TRUE(display_test_result); | 2153 ASSERT_TRUE(display_test_result); |
2154 } | 2154 } |
2155 | 2155 |
2156 } // namespace prerender | 2156 } // namespace prerender |
OLD | NEW |