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

Side by Side Diff: content/browser/frame_host/frame_tree_browsertest.cc

Issue 2919483003: Use RenderProcessHost::Shutdown in test to avoid flakiness. (Closed)
Patch Set: More effective Created 3 years, 6 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "content/browser/frame_host/frame_tree.h" 8 #include "content/browser/frame_host/frame_tree.h"
9 #include "content/browser/frame_host/frame_tree_node.h" 9 #include "content/browser/frame_host/frame_tree_node.h"
10 #include "content/browser/renderer_host/render_view_host_impl.h" 10 #include "content/browser/renderer_host/render_view_host_impl.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 RenderViewHost* rvh = shell()->web_contents()->GetRenderViewHost(); 128 RenderViewHost* rvh = shell()->web_contents()->GetRenderViewHost();
129 RenderFrameHostImpl* rfh = 129 RenderFrameHostImpl* rfh =
130 static_cast<RenderFrameHostImpl*>(rvh->GetMainFrame()); 130 static_cast<RenderFrameHostImpl*>(rvh->GetMainFrame());
131 EXPECT_TRUE(rvh->IsRenderViewLive()); 131 EXPECT_TRUE(rvh->IsRenderViewLive());
132 EXPECT_TRUE(rfh->IsRenderFrameLive()); 132 EXPECT_TRUE(rfh->IsRenderFrameLive());
133 133
134 // Crash the renderer so that it doesn't send any FrameDetached messages. 134 // Crash the renderer so that it doesn't send any FrameDetached messages.
135 RenderProcessHostWatcher crash_observer( 135 RenderProcessHostWatcher crash_observer(
136 shell()->web_contents(), 136 shell()->web_contents(),
137 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 137 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
138 NavigateToURL(shell(), GURL(kChromeUICrashURL)); 138 ASSERT_TRUE(
139 shell()->web_contents()->GetMainFrame()->GetProcess()->Shutdown(0, true));
139 crash_observer.Wait(); 140 crash_observer.Wait();
140 141
141 // The frame tree should be cleared. 142 // The frame tree should be cleared.
142 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents()); 143 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents());
143 FrameTreeNode* root = wc->GetFrameTree()->root(); 144 FrameTreeNode* root = wc->GetFrameTree()->root();
144 EXPECT_EQ(0UL, root->child_count()); 145 EXPECT_EQ(0UL, root->child_count());
145 146
146 // Ensure the view and frame aren't live anymore. 147 // Ensure the view and frame aren't live anymore.
147 EXPECT_FALSE(rvh->IsRenderViewLive()); 148 EXPECT_FALSE(rvh->IsRenderViewLive());
148 EXPECT_FALSE(rfh->IsRenderFrameLive()); 149 EXPECT_FALSE(rfh->IsRenderFrameLive());
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 // Make sure we did a process transfer back to "b.is". 755 // Make sure we did a process transfer back to "b.is".
755 EXPECT_EQ( 756 EXPECT_EQ(
756 " Site A ------------ proxies for B\n" 757 " Site A ------------ proxies for B\n"
757 " +--Site B ------- proxies for A\n" 758 " +--Site B ------- proxies for A\n"
758 "Where A = http://a.com/\n" 759 "Where A = http://a.com/\n"
759 " B = http://b.is/", 760 " B = http://b.is/",
760 FrameTreeVisualizer().DepictFrameTree(root)); 761 FrameTreeVisualizer().DepictFrameTree(root));
761 } 762 }
762 763
763 } // namespace content 764 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698