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 "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 4721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4732 | 4732 |
| 4733 // Make sure the a.com renderer does not crash. | 4733 // Make sure the a.com renderer does not crash. |
| 4734 int child_count = 0; | 4734 int child_count = 0; |
| 4735 EXPECT_TRUE(ExecuteScriptAndExtractInt( | 4735 EXPECT_TRUE(ExecuteScriptAndExtractInt( |
| 4736 root->current_frame_host(), | 4736 root->current_frame_host(), |
| 4737 "domAutomationController.send(frames.length)", | 4737 "domAutomationController.send(frames.length)", |
| 4738 &child_count)); | 4738 &child_count)); |
| 4739 EXPECT_EQ(1, child_count); | 4739 EXPECT_EQ(1, child_count); |
| 4740 } | 4740 } |
| 4741 | 4741 |
| 4742 // Similar to NavigateProxyAndDetachBeforeCommit, but uses a synchronous | |
| 4743 // navigation to about:blank and the parent removes the child frame in a load | |
| 4744 // event handler for the subframe. | |
| 4745 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateAboutBlankAndDetach) { | |
| 4746 GURL main_url( | |
| 4747 embedded_test_server()->GetURL("a.com", "/remove_frame_on_load.html")); | |
| 4748 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | |
| 4749 | |
| 4750 WebContents* contents = shell()->web_contents(); | |
| 4751 FrameTreeNode* root = | |
| 4752 static_cast<WebContentsImpl*>(contents)->GetFrameTree()->root(); | |
| 4753 EXPECT_EQ(1U, root->child_count()); | |
| 4754 FrameTreeNode* child = root->child_at(0); | |
| 4755 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | |
| 4756 child->current_frame_host()->GetSiteInstance()); | |
| 4757 | |
| 4758 // Navigate the child frame to "about:blank" from the parent document. | |
| 4759 TestNavigationObserver observer(shell()->web_contents()); | |
| 4760 EXPECT_TRUE( | |
| 4761 ExecuteScript(root->current_frame_host(), | |
|
dcheng
2016/03/03 18:24:16
I was going to suggest that this test could be wri
| |
| 4762 base::StringPrintf("f.src = '%s'", url::kAboutBlankURL))); | |
| 4763 observer.Wait(); | |
| 4764 | |
| 4765 // Make sure the a.com renderer does not crash and the frame is removed. | |
| 4766 int child_count = 0; | |
| 4767 EXPECT_TRUE(ExecuteScriptAndExtractInt( | |
| 4768 root->current_frame_host(), "domAutomationController.send(frames.length)", | |
| 4769 &child_count)); | |
| 4770 EXPECT_EQ(0, child_count); | |
| 4771 } | |
| 4772 | |
| 4742 // Test for https://crbug.com/568670. In A-embed-B, simultaneously have B | 4773 // Test for https://crbug.com/568670. In A-embed-B, simultaneously have B |
| 4743 // create a new (local) child frame, and have A detach B's proxy. The child | 4774 // create a new (local) child frame, and have A detach B's proxy. The child |
| 4744 // frame creation sends an IPC to create a new proxy in A's process, and if | 4775 // frame creation sends an IPC to create a new proxy in A's process, and if |
| 4745 // that IPC arrives after the detach, the new frame's parent (a proxy) won't be | 4776 // that IPC arrives after the detach, the new frame's parent (a proxy) won't be |
| 4746 // available, and this shouldn't cause RenderFrameProxy::CreateFrameProxy to | 4777 // available, and this shouldn't cause RenderFrameProxy::CreateFrameProxy to |
| 4747 // crash. | 4778 // crash. |
| 4748 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4779 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4749 RaceBetweenCreateChildFrameAndDetachParentProxy) { | 4780 RaceBetweenCreateChildFrameAndDetachParentProxy) { |
| 4750 GURL main_url(embedded_test_server()->GetURL( | 4781 GURL main_url(embedded_test_server()->GetURL( |
| 4751 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 4782 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5344 | 5375 |
| 5345 // Force the renderer to generate a new frame. | 5376 // Force the renderer to generate a new frame. |
| 5346 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | 5377 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), |
| 5347 "document.body.style.background = 'black'")); | 5378 "document.body.style.background = 'black'")); |
| 5348 | 5379 |
| 5349 // Waits for the next frame. | 5380 // Waits for the next frame. |
| 5350 observer->Wait(); | 5381 observer->Wait(); |
| 5351 } | 5382 } |
| 5352 | 5383 |
| 5353 } // namespace content | 5384 } // namespace content |
| OLD | NEW |