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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #include "content/public/browser/navigation_handle.h" | 58 #include "content/public/browser/navigation_handle.h" |
59 #include "content/public/browser/notification_observer.h" | 59 #include "content/public/browser/notification_observer.h" |
60 #include "content/public/browser/notification_service.h" | 60 #include "content/public/browser/notification_service.h" |
61 #include "content/public/browser/notification_types.h" | 61 #include "content/public/browser/notification_types.h" |
62 #include "content/public/browser/resource_dispatcher_host.h" | 62 #include "content/public/browser/resource_dispatcher_host.h" |
63 #include "content/public/common/browser_side_navigation_policy.h" | 63 #include "content/public/common/browser_side_navigation_policy.h" |
64 #include "content/public/common/content_switches.h" | 64 #include "content/public/common/content_switches.h" |
65 #include "content/public/common/url_constants.h" | 65 #include "content/public/common/url_constants.h" |
66 #include "content/public/test/browser_test_utils.h" | 66 #include "content/public/test/browser_test_utils.h" |
67 #include "content/public/test/content_browser_test_utils.h" | 67 #include "content/public/test/content_browser_test_utils.h" |
| 68 #include "content/public/test/navigation_handle_observer.h" |
68 #include "content/public/test/test_frame_navigation_observer.h" | 69 #include "content/public/test/test_frame_navigation_observer.h" |
69 #include "content/public/test/test_navigation_observer.h" | 70 #include "content/public/test/test_navigation_observer.h" |
70 #include "content/public/test/test_utils.h" | 71 #include "content/public/test/test_utils.h" |
71 #include "content/shell/browser/shell.h" | 72 #include "content/shell/browser/shell.h" |
72 #include "content/test/content_browser_test_utils_internal.h" | 73 #include "content/test/content_browser_test_utils_internal.h" |
73 #include "ipc/ipc.mojom.h" | 74 #include "ipc/ipc.mojom.h" |
74 #include "ipc/ipc_security_test_util.h" | 75 #include "ipc/ipc_security_test_util.h" |
75 #include "mojo/public/cpp/bindings/strong_binding.h" | 76 #include "mojo/public/cpp/bindings/strong_binding.h" |
76 #include "net/dns/mock_host_resolver.h" | 77 #include "net/dns/mock_host_resolver.h" |
77 #include "net/test/embedded_test_server/embedded_test_server.h" | 78 #include "net/test/embedded_test_server/embedded_test_server.h" |
(...skipping 8612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8690 EXPECT_TRUE(popup_shell); | 8691 EXPECT_TRUE(popup_shell); |
8691 | 8692 |
8692 // The RenderViewHost for b.com in the main tab should not be active. | 8693 // The RenderViewHost for b.com in the main tab should not be active. |
8693 SiteInstance* b_instance = popup_shell->web_contents()->GetSiteInstance(); | 8694 SiteInstance* b_instance = popup_shell->web_contents()->GetSiteInstance(); |
8694 RenderViewHostImpl* rvh = | 8695 RenderViewHostImpl* rvh = |
8695 web_contents()->GetFrameTree()->GetRenderViewHost(b_instance); | 8696 web_contents()->GetFrameTree()->GetRenderViewHost(b_instance); |
8696 EXPECT_FALSE(rvh->is_active()); | 8697 EXPECT_FALSE(rvh->is_active()); |
8697 | 8698 |
8698 // Navigate main tab to a b.com URL that will not commit. | 8699 // Navigate main tab to a b.com URL that will not commit. |
8699 GURL stall_url(embedded_test_server()->GetURL("b.com", "/title2.html")); | 8700 GURL stall_url(embedded_test_server()->GetURL("b.com", "/title2.html")); |
| 8701 NavigationHandleObserver handle_observer(shell()->web_contents(), stall_url); |
8700 TestNavigationManager delayer(shell()->web_contents(), stall_url); | 8702 TestNavigationManager delayer(shell()->web_contents(), stall_url); |
8701 shell()->LoadURL(stall_url); | 8703 shell()->LoadURL(stall_url); |
8702 EXPECT_TRUE(delayer.WaitForRequestStart()); | 8704 EXPECT_TRUE(delayer.WaitForRequestStart()); |
8703 | 8705 |
8704 // Kill the b.com process, currently in use by the pending RenderFrameHost | 8706 // Kill the b.com process, currently in use by the pending RenderFrameHost |
8705 // and the popup. | 8707 // and the popup. |
8706 RenderProcessHost* pending_process = | 8708 RenderProcessHost* pending_process = |
8707 popup_shell->web_contents()->GetMainFrame()->GetProcess(); | 8709 popup_shell->web_contents()->GetMainFrame()->GetProcess(); |
8708 RenderProcessHostWatcher crash_observer( | 8710 RenderProcessHostWatcher crash_observer( |
8709 pending_process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 8711 pending_process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
8710 EXPECT_TRUE(pending_process->Shutdown(0, false)); | 8712 EXPECT_TRUE(pending_process->Shutdown(0, false)); |
8711 crash_observer.Wait(); | 8713 crash_observer.Wait(); |
8712 | 8714 |
8713 // Since the navigation above didn't commit, the b.com RenderViewHost in the | 8715 // Since the navigation above didn't commit, the b.com RenderViewHost in the |
8714 // main tab should still not be active. | 8716 // main tab should still not be active. |
8715 EXPECT_FALSE(rvh->is_active()); | 8717 EXPECT_FALSE(rvh->is_active()); |
| 8718 EXPECT_EQ(net::ERR_ABORTED, handle_observer.net_error_code()); |
8716 | 8719 |
8717 // Navigate popup to b.com to recreate the b.com process. When creating | 8720 // Navigate popup to b.com to recreate the b.com process. When creating |
8718 // opener proxies, |rvh| should be reused as a swapped out RVH. In | 8721 // opener proxies, |rvh| should be reused as a swapped out RVH. In |
8719 // https://crbug.com/627893, recreating the opener RenderView was hitting a | 8722 // https://crbug.com/627893, recreating the opener RenderView was hitting a |
8720 // CHECK(params.swapped_out) in the renderer process, since its | 8723 // CHECK(params.swapped_out) in the renderer process, since its |
8721 // RenderViewHost was brought into an active state by the navigation to | 8724 // RenderViewHost was brought into an active state by the navigation to |
8722 // |stall_url| above, even though it never committed. | 8725 // |stall_url| above, even though it never committed. |
8723 GURL b_url(embedded_test_server()->GetURL("b.com", "/title3.html")); | 8726 GURL b_url(embedded_test_server()->GetURL("b.com", "/title3.html")); |
8724 EXPECT_TRUE(NavigateToURL(popup_shell, b_url)); | 8727 EXPECT_TRUE(NavigateToURL(popup_shell, b_url)); |
8725 EXPECT_FALSE(rvh->is_active()); | 8728 EXPECT_FALSE(rvh->is_active()); |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10078 names.insert(root->children[0]->frame_entry->frame_unique_name()); | 10081 names.insert(root->children[0]->frame_entry->frame_unique_name()); |
10079 } | 10082 } |
10080 | 10083 |
10081 // More than one entry in the set means that the subframe frame navigation | 10084 // More than one entry in the set means that the subframe frame navigation |
10082 // entries didn't have a consistent unique name. This will break history | 10085 // entries didn't have a consistent unique name. This will break history |
10083 // navigations =( | 10086 // navigations =( |
10084 EXPECT_THAT(names, SizeIs(1)) << "Mismatched names for subframe!"; | 10087 EXPECT_THAT(names, SizeIs(1)) << "Mismatched names for subframe!"; |
10085 } | 10088 } |
10086 | 10089 |
10087 } // namespace content | 10090 } // namespace content |
OLD | NEW |