| Index: content/browser/renderer_host/render_view_host_browsertest.cc
|
| ===================================================================
|
| --- content/browser/renderer_host/render_view_host_browsertest.cc (revision 136082)
|
| +++ content/browser/renderer_host/render_view_host_browsertest.cc (working copy)
|
| @@ -11,7 +11,6 @@
|
| #include "content/browser/renderer_host/render_view_host_impl.h"
|
| #include "content/browser/web_contents/web_contents_impl.h"
|
| #include "content/common/view_messages.h"
|
| -#include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/notification_types.h"
|
| #include "content/public/browser/web_contents_observer.h"
|
| #include "net/base/host_port_pair.h"
|
| @@ -229,143 +228,3 @@
|
| ui_test_utils::NavigateToURL(browser(), test_url);
|
| EXPECT_EQ("http://www.google.com/", observer.base_url().spec());
|
| }
|
| -
|
| -// Test that a hung renderer is killed after navigating away during cross-site
|
| -// navigation.
|
| -IN_PROC_BROWSER_TEST_F(RenderViewHostTest, UnresponsiveCrossSiteNavigation) {
|
| - WebContents* web_contents = NULL;
|
| - WebContents* web_contents_2 = NULL;
|
| - content::RenderProcessHost* rph = NULL;
|
| - base::ProcessHandle process;
|
| - FilePath doc_root;
|
| -
|
| - doc_root = doc_root.Append(FILE_PATH_LITERAL("content"));
|
| - doc_root = doc_root.Append(FILE_PATH_LITERAL("test"));
|
| - doc_root = doc_root.Append(FILE_PATH_LITERAL("data"));
|
| -
|
| - // Start two servers to enable cross-site navigations.
|
| - net::TestServer server(net::TestServer::TYPE_HTTP,
|
| - net::TestServer::kLocalhost, doc_root);
|
| - ASSERT_TRUE(server.Start());
|
| - net::TestServer https_server(net::TestServer::TYPE_HTTPS,
|
| - net::TestServer::kLocalhost, doc_root);
|
| - ASSERT_TRUE(https_server.Start());
|
| -
|
| - GURL infinite_beforeunload_url(
|
| - server.GetURL("files/infinite_beforeunload.html"));
|
| - GURL infinite_unload_url(server.GetURL("files/infinite_unload.html"));
|
| - GURL same_process_url(server.GetURL("files/english_page.html"));
|
| - GURL new_process_url(https_server.GetURL("files/english_page.html"));
|
| -
|
| - // Navigate the tab to the page which will lock up the process when we
|
| - // navigate away from it.
|
| - ui_test_utils::NavigateToURL(browser(), infinite_beforeunload_url);
|
| - web_contents = browser()->GetWebContentsAt(0);
|
| - rph = web_contents->GetRenderProcessHost();
|
| - EXPECT_EQ(web_contents->GetURL(), infinite_beforeunload_url);
|
| -
|
| - // Remember the process prior to navigation, as we expect it to get killed.
|
| - process = rph->GetHandle();
|
| - ASSERT_TRUE(process);
|
| -
|
| - {
|
| - ui_test_utils::WindowedNotificationObserver process_exit_observer(
|
| - content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
|
| - content::NotificationService::AllSources());
|
| - ui_test_utils::WindowedNotificationObserver process_hang_observer(
|
| - content::NOTIFICATION_RENDERER_PROCESS_HANG,
|
| - content::NotificationService::AllSources());
|
| - ui_test_utils::NavigateToURL(browser(), new_process_url);
|
| - process_hang_observer.Wait();
|
| - process_exit_observer.Wait();
|
| -
|
| - // Since the process is killed during the navigation, we don't expect the
|
| - // renderer host to have a connection to it.
|
| - EXPECT_FALSE(rph->HasConnection());
|
| - }
|
| -
|
| - ui_test_utils::NavigateToURL(browser(), same_process_url);
|
| - web_contents = browser()->GetWebContentsAt(0);
|
| - rph = web_contents->GetRenderProcessHost();
|
| - ASSERT_TRUE(web_contents != NULL);
|
| - EXPECT_EQ(web_contents->GetURL(), same_process_url);
|
| -
|
| - // Now, let's open another tab with the unresponsive page, which will cause
|
| - // the previous page and the unresponsive one to use the same process.
|
| - ui_test_utils::NavigateToURLWithDisposition(browser(),
|
| - infinite_unload_url, NEW_FOREGROUND_TAB,
|
| - ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
|
| - EXPECT_EQ(browser()->tab_count(), 2);
|
| - web_contents_2 = browser()->GetWebContentsAt(1);
|
| - ASSERT_TRUE(web_contents_2 != NULL);
|
| - EXPECT_EQ(web_contents_2->GetURL(), infinite_unload_url);
|
| - EXPECT_EQ(rph, web_contents_2->GetRenderProcessHost());
|
| -
|
| - process = rph->GetHandle();
|
| - ASSERT_TRUE(process);
|
| -
|
| - // Navigating to the cross site URL will not kill the process, since it will
|
| - // have more than one tab using it. Kill it to confirm that it is still there,
|
| - // as well as finish the test faster.
|
| - {
|
| - ui_test_utils::WindowedNotificationObserver process_exit_observer(
|
| - content::NOTIFICATION_RENDERER_PROCESS_HANG,
|
| - content::NotificationService::AllSources());
|
| - ui_test_utils::NavigateToURL(browser(), new_process_url);
|
| - process_exit_observer.Wait();
|
| - }
|
| -
|
| - EXPECT_TRUE(base::KillProcess(process, 2, false));
|
| -}
|
| -
|
| -// Test that a hung renderer is killed when we are closing the page.
|
| -IN_PROC_BROWSER_TEST_F(RenderViewHostTest, UnresponsiveClosePage) {
|
| - WebContents* web_contents = NULL;
|
| - FilePath doc_root;
|
| -
|
| - doc_root = doc_root.Append(FILE_PATH_LITERAL("content"));
|
| - doc_root = doc_root.Append(FILE_PATH_LITERAL("test"));
|
| - doc_root = doc_root.Append(FILE_PATH_LITERAL("data"));
|
| -
|
| - net::TestServer server(net::TestServer::TYPE_HTTP,
|
| - net::TestServer::kLocalhost, doc_root);
|
| - ASSERT_TRUE(server.Start());
|
| - net::TestServer https_server(net::TestServer::TYPE_HTTPS,
|
| - net::TestServer::kLocalhost, doc_root);
|
| - ASSERT_TRUE(https_server.Start());
|
| -
|
| - GURL infinite_beforeunload_url(
|
| - server.GetURL("files/infinite_beforeunload.html"));
|
| - GURL infinite_unload_url(server.GetURL("files/infinite_unload.html"));
|
| - GURL new_process_url(https_server.GetURL("files/english_page.html"));
|
| -
|
| - ui_test_utils::NavigateToURL(browser(), new_process_url);
|
| -
|
| - // Navigate a tab to a page which will spin into an infinite loop in the
|
| - // beforeunload handler, tying up the process when we close the tab.
|
| - ui_test_utils::NavigateToURLWithDisposition(browser(),
|
| - infinite_beforeunload_url, NEW_FOREGROUND_TAB,
|
| - ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
|
| - web_contents = browser()->GetWebContentsAt(1);
|
| - {
|
| - ui_test_utils::WindowedNotificationObserver process_exit_observer(
|
| - content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
|
| - content::NotificationService::AllSources());
|
| - browser()->CloseTabContents(web_contents);
|
| - process_exit_observer.Wait();
|
| - }
|
| -
|
| - // Navigate a tab to a page which will spin into an infinite loop in the
|
| - // unload handler, tying up the process when we close the tab.
|
| - ui_test_utils::NavigateToURLWithDisposition(browser(),
|
| - infinite_unload_url, NEW_FOREGROUND_TAB,
|
| - ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
|
| - web_contents = browser()->GetWebContentsAt(1);
|
| - {
|
| - ui_test_utils::WindowedNotificationObserver process_exit_observer(
|
| - content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
|
| - content::NotificationService::AllSources());
|
| - browser()->CloseTabContents(web_contents);
|
| - process_exit_observer.Wait();
|
| - }
|
| -}
|
|
|