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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 562 OpenDestURLWithJSImpl("MetaClick()"); | 562 OpenDestURLWithJSImpl("MetaClick()"); |
| 563 #else | 563 #else |
| 564 OpenDestURLWithJSImpl("CtrlClick()"); | 564 OpenDestURLWithJSImpl("CtrlClick()"); |
| 565 #endif | 565 #endif |
| 566 } | 566 } |
| 567 | 567 |
| 568 void OpenDestURLViaWindowOpen() const { | 568 void OpenDestURLViaWindowOpen() const { |
| 569 OpenDestURLWithJSImpl("WindowOpen()"); | 569 OpenDestURLWithJSImpl("WindowOpen()"); |
| 570 } | 570 } |
| 571 | 571 |
| 572 void RemoveLinkElementAndNavigate() const { | |
| 573 OpenDestURLWithJSImpl("RemoveLinkElementAndNavigate()"); | |
| 574 } | |
| 575 | |
| 572 void ClickToNextPageAfterPrerender(Browser* browser) { | 576 void ClickToNextPageAfterPrerender(Browser* browser) { |
| 573 ui_test_utils::WindowedNotificationObserver new_page_observer( | 577 ui_test_utils::WindowedNotificationObserver new_page_observer( |
| 574 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 578 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 575 content::NotificationService::AllSources()); | 579 content::NotificationService::AllSources()); |
| 576 RenderViewHost* render_view_host = | 580 RenderViewHost* render_view_host = |
| 577 browser->GetSelectedWebContents()->GetRenderViewHost(); | 581 browser->GetSelectedWebContents()->GetRenderViewHost(); |
| 578 render_view_host->ExecuteJavascriptInWebFrame( | 582 render_view_host->ExecuteJavascriptInWebFrame( |
| 579 string16(), | 583 string16(), |
| 580 ASCIIToUTF16("ClickOpenLink()")); | 584 ASCIIToUTF16("ClickOpenLink()")); |
| 581 new_page_observer.Wait(); | 585 new_page_observer.Wait(); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 863 }; | 867 }; |
| 864 | 868 |
| 865 // Checks that a page is correctly prerendered in the case of a | 869 // Checks that a page is correctly prerendered in the case of a |
| 866 // <link rel=prerender> tag and then loaded into a tab in response to a | 870 // <link rel=prerender> tag and then loaded into a tab in response to a |
| 867 // navigation. | 871 // navigation. |
| 868 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPage) { | 872 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPage) { |
| 869 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); | 873 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); |
| 870 NavigateToDestURL(); | 874 NavigateToDestURL(); |
| 871 } | 875 } |
| 872 | 876 |
| 877 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageRemovingLink) { | |
|
cbentzel
2012/03/29 00:13:37
Should probably have some tests for multiple link
gavinp
2012/04/20 17:54:14
Done.
| |
| 878 set_loader_path("files/prerender/prerender_loader_removing_link.html"); | |
| 879 PrerenderTestURL("files/prerender/prerender_page.html", | |
| 880 FINAL_STATUS_CANCELLED, 1); | |
| 881 RemoveLinkElementAndNavigate(); | |
| 882 } | |
| 883 | |
| 873 // Checks that the visibility API works. | 884 // Checks that the visibility API works. |
| 874 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderVisibility) { | 885 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderVisibility) { |
| 875 PrerenderTestURL("files/prerender/prerender_visibility.html", | 886 PrerenderTestURL("files/prerender/prerender_visibility.html", |
| 876 FINAL_STATUS_USED, | 887 FINAL_STATUS_USED, |
| 877 1); | 888 1); |
| 878 NavigateToDestURL(); | 889 NavigateToDestURL(); |
| 879 } | 890 } |
| 880 | 891 |
| 881 // Checks that the visibility API works when the prerender is quickly opened | 892 // Checks that the visibility API works when the prerender is quickly opened |
| 882 // in a new tab before it stops loading. | 893 // in a new tab before it stops loading. |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2042 WebContents* web_contents = browser()->GetSelectedWebContents(); | 2053 WebContents* web_contents = browser()->GetSelectedWebContents(); |
| 2043 bool display_test_result = false; | 2054 bool display_test_result = false; |
| 2044 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 2055 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 2045 web_contents->GetRenderViewHost(), L"", | 2056 web_contents->GetRenderViewHost(), L"", |
| 2046 L"DidDisplayReallyPass()", | 2057 L"DidDisplayReallyPass()", |
| 2047 &display_test_result)); | 2058 &display_test_result)); |
| 2048 ASSERT_TRUE(display_test_result); | 2059 ASSERT_TRUE(display_test_result); |
| 2049 } | 2060 } |
| 2050 | 2061 |
| 2051 } // namespace prerender | 2062 } // namespace prerender |
| OLD | NEW |