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 8979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8990 // handler and sends the swapout ACK. | 8990 // handler and sends the swapout ACK. |
8991 rfh->OnSwappedOut(); | 8991 rfh->OnSwappedOut(); |
8992 | 8992 |
8993 // Wait for the new a.com navigation to finish. | 8993 // Wait for the new a.com navigation to finish. |
8994 back_observer.Wait(); | 8994 back_observer.Wait(); |
8995 | 8995 |
8996 // The RVH for a.com should've been reused, and it should be active. | 8996 // The RVH for a.com should've been reused, and it should be active. |
8997 EXPECT_TRUE(rvh->is_active()); | 8997 EXPECT_TRUE(rvh->is_active()); |
8998 } | 8998 } |
8999 | 8999 |
| 9000 // Verify that a remote-to-local navigation in a crashed subframe works. See |
| 9001 // https://crbug.com/487872. |
| 9002 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 9003 RemoteToLocalNavigationInCrashedSubframe) { |
| 9004 GURL main_url(embedded_test_server()->GetURL( |
| 9005 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 9006 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 9007 |
| 9008 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 9009 FrameTreeNode* child = root->child_at(0); |
| 9010 |
| 9011 // Crash the subframe process. |
| 9012 RenderProcessHost* child_process = child->current_frame_host()->GetProcess(); |
| 9013 { |
| 9014 RenderProcessHostWatcher crash_observer( |
| 9015 child_process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
| 9016 child_process->Shutdown(0, false); |
| 9017 crash_observer.Wait(); |
| 9018 } |
| 9019 EXPECT_FALSE(child->current_frame_host()->IsRenderFrameLive()); |
| 9020 |
| 9021 // Do a remote-to-local navigation of the child frame from the parent frame. |
| 9022 TestFrameNavigationObserver frame_observer(child); |
| 9023 GURL frame_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 9024 EXPECT_TRUE(ExecuteScript(root, "document.querySelector('iframe').src = '" + |
| 9025 frame_url.spec() + "';\n")); |
| 9026 frame_observer.Wait(); |
| 9027 |
| 9028 EXPECT_TRUE(child->current_frame_host()->IsRenderFrameLive()); |
| 9029 EXPECT_FALSE(child->IsLoading()); |
| 9030 EXPECT_EQ(child->current_frame_host()->GetSiteInstance(), |
| 9031 root->current_frame_host()->GetSiteInstance()); |
| 9032 |
| 9033 // Ensure the subframe is correctly attached in the frame tree, and that it |
| 9034 // has correct content. |
| 9035 int child_count = 0; |
| 9036 EXPECT_TRUE(ExecuteScriptAndExtractInt( |
| 9037 root, "window.domAutomationController.send(frames.length);", |
| 9038 &child_count)); |
| 9039 EXPECT_EQ(1, child_count); |
| 9040 |
| 9041 std::string result; |
| 9042 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 9043 root, |
| 9044 "window.domAutomationController.send(frames[0].document.body.innerText);", |
| 9045 &result)); |
| 9046 EXPECT_EQ("This page has no title.", result); |
| 9047 } |
| 9048 |
9000 } // namespace content | 9049 } // namespace content |
OLD | NEW |