Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2628133002: When a proxy is detached, immediately delete its associated provisional frame. (Closed)
Patch Set: Charlie's nit Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6223 matching lines...) Expand 10 before | Expand all | Expand 10 after
6234 observer.Wait(); 6234 observer.Wait();
6235 EXPECT_EQ(1U, root->child_count()); 6235 EXPECT_EQ(1U, root->child_count());
6236 6236
6237 // Make sure the a.com renderer does not crash. 6237 // Make sure the a.com renderer does not crash.
6238 int child_count = 0; 6238 int child_count = 0;
6239 EXPECT_TRUE(ExecuteScriptAndExtractInt( 6239 EXPECT_TRUE(ExecuteScriptAndExtractInt(
6240 root, "domAutomationController.send(frames.length)", &child_count)); 6240 root, "domAutomationController.send(frames.length)", &child_count));
6241 EXPECT_EQ(1, child_count); 6241 EXPECT_EQ(1, child_count);
6242 } 6242 }
6243 6243
6244 #if defined(OS_LINUX)
6245 #define MAYBE_NavigateAboutBlankAndDetach DISABLED_NavigateAboutBlankAndDetach
6246 #else
6247 #define MAYBE_NavigateAboutBlankAndDetach NavigateAboutBlankAndDetach
6248 #endif
6249 // Similar to NavigateProxyAndDetachBeforeCommit, but uses a synchronous 6244 // Similar to NavigateProxyAndDetachBeforeCommit, but uses a synchronous
6250 // navigation to about:blank and the parent removes the child frame in a load 6245 // navigation to about:blank and the parent removes the child frame in a load
6251 // event handler for the subframe. 6246 // event handler for the subframe.
6252 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, 6247 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateAboutBlankAndDetach) {
6253 MAYBE_NavigateAboutBlankAndDetach) {
6254 GURL main_url( 6248 GURL main_url(
6255 embedded_test_server()->GetURL("a.com", "/remove_frame_on_load.html")); 6249 embedded_test_server()->GetURL("a.com", "/remove_frame_on_load.html"));
6256 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 6250 EXPECT_TRUE(NavigateToURL(shell(), main_url));
6257 6251
6258 WebContents* contents = shell()->web_contents(); 6252 WebContents* contents = shell()->web_contents();
6259 FrameTreeNode* root = 6253 FrameTreeNode* root =
6260 static_cast<WebContentsImpl*>(contents)->GetFrameTree()->root(); 6254 static_cast<WebContentsImpl*>(contents)->GetFrameTree()->root();
6261 EXPECT_EQ(1U, root->child_count()); 6255 EXPECT_EQ(1U, root->child_count());
6262 FrameTreeNode* child = root->child_at(0); 6256 FrameTreeNode* child = root->child_at(0);
6263 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), 6257 EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
6264 child->current_frame_host()->GetSiteInstance()); 6258 child->current_frame_host()->GetSiteInstance());
6265 6259
6266 // Navigate the child frame to "about:blank" from the parent document. 6260 // Navigate the child frame to "about:blank" from the parent document and
6267 TestNavigationObserver observer(shell()->web_contents()); 6261 // wait for it to be removed.
6262 FrameDeletedObserver observer(child);
6268 EXPECT_TRUE(ExecuteScript( 6263 EXPECT_TRUE(ExecuteScript(
6269 root, base::StringPrintf("f.src = '%s'", url::kAboutBlankURL))); 6264 root, base::StringPrintf("f.src = '%s'", url::kAboutBlankURL)));
6270 observer.Wait(); 6265 observer.Wait();
6271 6266
6272 // Make sure the a.com renderer does not crash and the frame is removed. 6267 // Make sure the a.com renderer does not crash and the frame is removed.
6273 int child_count = 0; 6268 int child_count = 0;
6274 EXPECT_TRUE(ExecuteScriptAndExtractInt( 6269 EXPECT_TRUE(ExecuteScriptAndExtractInt(
6275 root, "domAutomationController.send(frames.length)", &child_count)); 6270 root, "domAutomationController.send(frames.length)", &child_count));
6276 EXPECT_EQ(0, child_count); 6271 EXPECT_EQ(0, child_count);
6277 } 6272 }
(...skipping 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after
9092 shell(), embedded_test_server()->GetURL("b.com", "/title3.html"))); 9087 shell(), embedded_test_server()->GetURL("b.com", "/title3.html")));
9093 9088
9094 // Pretend that a.com just requested a context menu. This used to cause a 9089 // Pretend that a.com just requested a context menu. This used to cause a
9095 // because the RenderWidgetHostView is destroyed when the frame is swapped and 9090 // because the RenderWidgetHostView is destroyed when the frame is swapped and
9096 // added to pending delete list. 9091 // added to pending delete list.
9097 rfh->OnMessageReceived( 9092 rfh->OnMessageReceived(
9098 FrameHostMsg_ContextMenu(rfh->GetRoutingID(), ContextMenuParams())); 9093 FrameHostMsg_ContextMenu(rfh->GetRoutingID(), ContextMenuParams()));
9099 } 9094 }
9100 9095
9101 } // namespace content 9096 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698