Index: content/browser/renderer_host/render_view_host_browsertest.cc |
diff --git a/content/browser/renderer_host/render_view_host_browsertest.cc b/content/browser/renderer_host/render_view_host_browsertest.cc |
index 0bd8f1e3b299c568f109671b0eec891102abd9c3..03de840a8f8b8fe22e9ca3a8b5c6ac1a1da4177f 100644 |
--- a/content/browser/renderer_host/render_view_host_browsertest.cc |
+++ b/content/browser/renderer_host/render_view_host_browsertest.cc |
@@ -8,11 +8,13 @@ |
#include "base/values.h" |
#include "content/browser/renderer_host/render_view_host_impl.h" |
#include "content/browser/web_contents/web_contents_impl.h" |
+#include "content/common/child_process_messages.h" |
#include "content/common/view_messages.h" |
#include "content/public/browser/notification_types.h" |
#include "content/public/browser/web_contents_observer.h" |
#include "content/public/common/content_paths.h" |
#include "content/public/test/browser_test_utils.h" |
+#include "content/public/test/test_notification_tracker.h" |
#include "content/shell/shell.h" |
#include "content/test/content_browser_test.h" |
#include "content/test/content_browser_test_utils.h" |
@@ -115,4 +117,28 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, BasicRenderFrameHost) { |
new_rvh->main_render_frame_host_->routing_id()); |
} |
+IN_PROC_BROWSER_TEST_F(RenderViewHostTest, |
+ ShutdownRequestFromActiveTabIgnored) { |
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
+ |
+ GURL test_url = embedded_test_server()->GetURL("/simple_page.html"); |
+ NavigateToURL(shell(), test_url); |
+ RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
+ shell()->web_contents()->GetRenderViewHost()); |
+ RenderProcessHost* rph = rvh->GetProcess(); |
+ |
+ TestNotificationTracker termination_watcher; |
+ termination_watcher.ListenFor(NOTIFICATION_RENDERER_PROCESS_CLOSED, |
+ Source<RenderProcessHost>(rph)); |
+ ChildProcessHostMsg_ShutdownRequest msg; |
+ rvh->GetProcess()->OnMessageReceived(msg); |
+ |
+ // If the RPH sends a mistaken ChildProcessMsg_Shutdown, the renderer process |
+ // will take some time to die. Wait for a second tab to load in order to give |
+ // that time to happen. |
+ NavigateToURL(CreateBrowser(), test_url); |
+ |
+ EXPECT_EQ(0U, termination_watcher.size()); |
+} |
+ |
} // namespace content |