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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) { | 291 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) { |
292 EXPECT_EQ(new_render_view_host_, | 292 EXPECT_EQ(new_render_view_host_, |
293 content::Source<RenderWidgetHost>(source).ptr()); | 293 content::Source<RenderWidgetHost>(source).ptr()); |
294 bool is_visible = *content::Details<bool>(details).ptr(); | 294 bool is_visible = *content::Details<bool>(details).ptr(); |
295 | 295 |
296 if (!is_visible) { | 296 if (!is_visible) { |
297 was_hidden_ = true; | 297 was_hidden_ = true; |
298 } else if (is_visible && was_hidden_) { | 298 } else if (is_visible && was_hidden_) { |
299 // Once hidden, a prerendered RenderViewHost should only be shown after | 299 // Once hidden, a prerendered RenderViewHost should only be shown after |
300 // being removed from the PrerenderContents for display. | 300 // being removed from the PrerenderContents for display. |
301 EXPECT_FALSE(render_view_host()); | 301 EXPECT_FALSE(GetRenderViewHost()); |
302 was_shown_ = true; | 302 was_shown_ = true; |
303 } | 303 } |
304 return; | 304 return; |
305 } | 305 } |
306 PrerenderContents::Observe(type, source, details); | 306 PrerenderContents::Observe(type, source, details); |
307 } | 307 } |
308 | 308 |
309 int number_of_loads_; | 309 int number_of_loads_; |
310 int expected_number_of_loads_; | 310 int expected_number_of_loads_; |
311 FinalStatus expected_final_status_; | 311 FinalStatus expected_final_status_; |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 EXPECT_EQ(FINAL_STATUS_MAX, prerender_contents->final_status()); | 846 EXPECT_EQ(FINAL_STATUS_MAX, prerender_contents->final_status()); |
847 | 847 |
848 if (call_javascript_ && expected_number_of_loads > 0) { | 848 if (call_javascript_ && expected_number_of_loads > 0) { |
849 // Wait for the prerendered page to change title to signal it is ready | 849 // Wait for the prerendered page to change title to signal it is ready |
850 // if required. | 850 // if required. |
851 prerender_contents->WaitForPrerenderToHaveReadyTitleIfRequired(); | 851 prerender_contents->WaitForPrerenderToHaveReadyTitleIfRequired(); |
852 | 852 |
853 // Check if page behaves as expected while in prerendered state. | 853 // Check if page behaves as expected while in prerendered state. |
854 bool prerender_test_result = false; | 854 bool prerender_test_result = false; |
855 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 855 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
856 prerender_contents->render_view_host_mutable(), L"", | 856 prerender_contents->GetRenderViewHostMutable(), L"", |
857 L"window.domAutomationController.send(DidPrerenderPass())", | 857 L"window.domAutomationController.send(DidPrerenderPass())", |
858 &prerender_test_result)); | 858 &prerender_test_result)); |
859 EXPECT_TRUE(prerender_test_result); | 859 EXPECT_TRUE(prerender_test_result); |
860 } | 860 } |
861 } else { | 861 } else { |
862 // In the failure case, we should have removed |dest_url_| from the | 862 // In the failure case, we should have removed |dest_url_| from the |
863 // prerender_manager. We ignore dummy PrerenderContents (as indicated | 863 // prerender_manager. We ignore dummy PrerenderContents (as indicated |
864 // by not having started). | 864 // by not having started). |
865 EXPECT_TRUE(prerender_contents == NULL || | 865 EXPECT_TRUE(prerender_contents == NULL || |
866 !prerender_contents->prerendering_has_started()); | 866 !prerender_contents->prerendering_has_started()); |
(...skipping 1280 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 |