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 <stddef.h> | 5 #include <stddef.h> |
6 #include <deque> | 6 #include <deque> |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 #include "content/public/browser/devtools_agent_host.h" | 84 #include "content/public/browser/devtools_agent_host.h" |
85 #include "content/public/browser/navigation_controller.h" | 85 #include "content/public/browser/navigation_controller.h" |
86 #include "content/public/browser/navigation_entry.h" | 86 #include "content/public/browser/navigation_entry.h" |
87 #include "content/public/browser/notification_service.h" | 87 #include "content/public/browser/notification_service.h" |
88 #include "content/public/browser/render_frame_host.h" | 88 #include "content/public/browser/render_frame_host.h" |
89 #include "content/public/browser/render_process_host.h" | 89 #include "content/public/browser/render_process_host.h" |
90 #include "content/public/browser/render_view_host.h" | 90 #include "content/public/browser/render_view_host.h" |
91 #include "content/public/browser/site_instance.h" | 91 #include "content/public/browser/site_instance.h" |
92 #include "content/public/browser/web_contents.h" | 92 #include "content/public/browser/web_contents.h" |
93 #include "content/public/browser/web_contents_observer.h" | 93 #include "content/public/browser/web_contents_observer.h" |
| 94 #include "content/public/common/browser_side_navigation_policy.h" |
94 #include "content/public/common/content_switches.h" | 95 #include "content/public/common/content_switches.h" |
95 #include "content/public/common/resource_request_body.h" | 96 #include "content/public/common/resource_request_body.h" |
96 #include "content/public/common/url_constants.h" | 97 #include "content/public/common/url_constants.h" |
97 #include "content/public/test/browser_test_utils.h" | 98 #include "content/public/test/browser_test_utils.h" |
98 #include "content/public/test/ppapi_test_utils.h" | 99 #include "content/public/test/ppapi_test_utils.h" |
99 #include "content/public/test/test_navigation_observer.h" | 100 #include "content/public/test/test_navigation_observer.h" |
100 #include "content/public/test/test_utils.h" | 101 #include "content/public/test/test_utils.h" |
101 #include "extensions/common/constants.h" | 102 #include "extensions/common/constants.h" |
102 #include "extensions/common/extension_urls.h" | 103 #include "extensions/common/extension_urls.h" |
103 #include "extensions/common/manifest_handlers/mime_types_handler.h" | 104 #include "extensions/common/manifest_handlers/mime_types_handler.h" |
(...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2827 WebContents* web_contents = GetActiveWebContents(); | 2828 WebContents* web_contents = GetActiveWebContents(); |
2828 web_contents->IncrementCapturerCount(gfx::Size()); | 2829 web_contents->IncrementCapturerCount(gfx::Size()); |
2829 NavigateToDestURLWithDisposition(WindowOpenDisposition::CURRENT_TAB, false); | 2830 NavigateToDestURLWithDisposition(WindowOpenDisposition::CURRENT_TAB, false); |
2830 web_contents->DecrementCapturerCount(); | 2831 web_contents->DecrementCapturerCount(); |
2831 } | 2832 } |
2832 | 2833 |
2833 // Checks that prerenders are aborted on cross-process navigation from | 2834 // Checks that prerenders are aborted on cross-process navigation from |
2834 // a server redirect. | 2835 // a server redirect. |
2835 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2836 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2836 PrerenderCrossProcessServerRedirect) { | 2837 PrerenderCrossProcessServerRedirect) { |
| 2838 // Cross-process navigations don't happen for prerendering with PlzNavigate, |
| 2839 // since we decide on a process after redirects are followed. |
| 2840 if (content::IsBrowserSideNavigationEnabled()) |
| 2841 return; |
| 2842 |
2837 // Force everything to be a process swap. | 2843 // Force everything to be a process swap. |
2838 SwapProcessesContentBrowserClient test_browser_client; | 2844 SwapProcessesContentBrowserClient test_browser_client; |
2839 content::ContentBrowserClient* original_browser_client = | 2845 content::ContentBrowserClient* original_browser_client = |
2840 content::SetBrowserClientForTesting(&test_browser_client); | 2846 content::SetBrowserClientForTesting(&test_browser_client); |
2841 | 2847 |
2842 PrerenderTestURL(CreateServerRedirect("/prerender/prerender_page.html"), | 2848 PrerenderTestURL(CreateServerRedirect("/prerender/prerender_page.html"), |
2843 FINAL_STATUS_OPEN_URL, 0); | 2849 FINAL_STATUS_OPEN_URL, 0); |
2844 | 2850 |
2845 content::SetBrowserClientForTesting(original_browser_client); | 2851 content::SetBrowserClientForTesting(original_browser_client); |
2846 } | 2852 } |
2847 | 2853 |
2848 // Checks that URLRequests for prerenders being aborted on cross-process | 2854 // Checks that URLRequests for prerenders being aborted on cross-process |
2849 // navigation from a server redirect are cleaned up, so they don't keep cache | 2855 // navigation from a server redirect are cleaned up, so they don't keep cache |
2850 // entries locked. | 2856 // entries locked. |
2851 // See http://crbug.com/341134 | 2857 // See http://crbug.com/341134 |
2852 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2858 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2853 PrerenderCrossProcessServerRedirectNoHang) { | 2859 PrerenderCrossProcessServerRedirectNoHang) { |
| 2860 // Cross-process navigations don't happen for prerendering with PlzNavigate, |
| 2861 // since we decide on a process after redirects are followed. |
| 2862 if (content::IsBrowserSideNavigationEnabled()) |
| 2863 return; |
| 2864 |
2854 const char kDestPath[] = "/prerender/prerender_page.html"; | 2865 const char kDestPath[] = "/prerender/prerender_page.html"; |
2855 // Force everything to be a process swap. | 2866 // Force everything to be a process swap. |
2856 SwapProcessesContentBrowserClient test_browser_client; | 2867 SwapProcessesContentBrowserClient test_browser_client; |
2857 content::ContentBrowserClient* original_browser_client = | 2868 content::ContentBrowserClient* original_browser_client = |
2858 content::SetBrowserClientForTesting(&test_browser_client); | 2869 content::SetBrowserClientForTesting(&test_browser_client); |
2859 | 2870 |
2860 PrerenderTestURL(CreateServerRedirect(kDestPath), FINAL_STATUS_OPEN_URL, 0); | 2871 PrerenderTestURL(CreateServerRedirect(kDestPath), FINAL_STATUS_OPEN_URL, 0); |
2861 | 2872 |
2862 ui_test_utils::NavigateToURL(browser(), | 2873 ui_test_utils::NavigateToURL(browser(), |
2863 embedded_test_server()->GetURL(kDestPath)); | 2874 embedded_test_server()->GetURL(kDestPath)); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 browser()->tab_strip_model()->GetActiveWebContents(); | 3331 browser()->tab_strip_model()->GetActiveWebContents(); |
3321 bool display_test_result = false; | 3332 bool display_test_result = false; |
3322 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, | 3333 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, |
3323 "DidDisplayReallyPass()", | 3334 "DidDisplayReallyPass()", |
3324 &display_test_result)); | 3335 &display_test_result)); |
3325 ASSERT_TRUE(display_test_result); | 3336 ASSERT_TRUE(display_test_result); |
3326 } | 3337 } |
3327 #endif // !defined(DISABLE_NACL) | 3338 #endif // !defined(DISABLE_NACL) |
3328 | 3339 |
3329 } // namespace prerender | 3340 } // namespace prerender |
OLD | NEW |