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

Side by Side Diff: content/browser/renderer_host/render_view_host_browsertest.cc

Issue 16593002: Fix http://crbug.com/87176, and write a browsertest for it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | 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 (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 "base/path_service.h" 5 #include "base/path_service.h"
6 #include "base/time.h" 6 #include "base/time.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 9 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
11 #include "content/common/child_process_messages.h"
11 #include "content/common/view_messages.h" 12 #include "content/common/view_messages.h"
12 #include "content/public/browser/notification_types.h" 13 #include "content/public/browser/notification_types.h"
13 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/common/content_paths.h" 15 #include "content/public/common/content_paths.h"
15 #include "content/public/test/browser_test_utils.h" 16 #include "content/public/test/browser_test_utils.h"
17 #include "content/public/test/test_notification_tracker.h"
16 #include "content/shell/shell.h" 18 #include "content/shell/shell.h"
17 #include "content/test/content_browser_test.h" 19 #include "content/test/content_browser_test.h"
18 #include "content/test/content_browser_test_utils.h" 20 #include "content/test/content_browser_test_utils.h"
19 #include "net/base/host_port_pair.h" 21 #include "net/base/host_port_pair.h"
20 #include "net/base/net_util.h" 22 #include "net/base/net_util.h"
21 #include "net/test/embedded_test_server/embedded_test_server.h" 23 #include "net/test/embedded_test_server/embedded_test_server.h"
22 24
23 namespace content { 25 namespace content {
24 26
25 class RenderViewHostTest : public ContentBrowserTest { 27 class RenderViewHostTest : public ContentBrowserTest {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), "window.open();")); 110 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), "window.open();"));
109 Shell* new_shell = new_shell_observer.GetShell(); 111 Shell* new_shell = new_shell_observer.GetShell();
110 RenderViewHostImpl* new_rvh = static_cast<RenderViewHostImpl*>( 112 RenderViewHostImpl* new_rvh = static_cast<RenderViewHostImpl*>(
111 new_shell->web_contents()->GetRenderViewHost()); 113 new_shell->web_contents()->GetRenderViewHost());
112 114
113 EXPECT_TRUE(new_rvh->main_render_frame_host_.get()); 115 EXPECT_TRUE(new_rvh->main_render_frame_host_.get());
114 EXPECT_NE(rvh->main_render_frame_host_->routing_id(), 116 EXPECT_NE(rvh->main_render_frame_host_->routing_id(),
115 new_rvh->main_render_frame_host_->routing_id()); 117 new_rvh->main_render_frame_host_->routing_id());
116 } 118 }
117 119
120 IN_PROC_BROWSER_TEST_F(RenderViewHostTest,
121 ShutdownRequestFromActiveTabIgnored) {
122 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
123
124 GURL test_url = embedded_test_server()->GetURL("/simple_page.html");
125 NavigateToURL(shell(), test_url);
126 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
127 shell()->web_contents()->GetRenderViewHost());
128 RenderProcessHost* rph = rvh->GetProcess();
129
130 TestNotificationTracker termination_watcher;
131 termination_watcher.ListenFor(NOTIFICATION_RENDERER_PROCESS_CLOSED,
132 Source<RenderProcessHost>(rph));
133 ChildProcessHostMsg_ShutdownRequest msg;
134 rvh->GetProcess()->OnMessageReceived(msg);
135
136 // If the RPH sends a mistaken ChildProcessMsg_Shutdown, the renderer process
137 // will take some time to die. Wait for a second tab to load in order to give
138 // that time to happen.
139 NavigateToURL(CreateBrowser(), test_url);
140
141 EXPECT_EQ(0U, termination_watcher.size());
142 }
143
118 } // namespace content 144 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698