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

Unified Diff: chrome/browser/task_manager/task_manager_browsertest.cc

Issue 818263004: Add a test that is a repro case for bug 444945. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autofill_crash'
Patch Set: Nasko's fixes Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/public/test/browser_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/task_manager/task_manager_browsertest.cc
diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc
index 25dc0ecd162f93a733268a0e289bb749477ffaeb..90e5bba27d029392aca9820b413008c731337d28 100644
--- a/chrome/browser/task_manager/task_manager_browsertest.cc
+++ b/chrome/browser/task_manager/task_manager_browsertest.cc
@@ -6,6 +6,7 @@
#include "base/files/file_path.h"
#include "base/strings/stringprintf.h"
+#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/devtools/devtools_window_testing.h"
@@ -206,6 +207,59 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, KillTab) {
ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab()));
}
+// Test for http://crbug.com/444722, which is not fixed yet.
+IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest,
+ DISABLED_NavigateAwayFromHungRenderer) {
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+ ShowTaskManager();
+
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
+
+ GURL url1(embedded_test_server()->GetURL("/title2.html"));
+ GURL url3(embedded_test_server()->GetURL("a.com", "/iframe.html"));
+
+ // Open a new tab and make sure the task manager notices it.
+ AddTabAtIndex(0, url1, ui::PAGE_TRANSITION_TYPED);
+ ASSERT_NO_FATAL_FAILURE(
+ WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness")));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab()));
+ WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents();
+
+ // Initiate a navigation that will create a new WebContents in the same
+ // SiteInstace...
+ content::WebContentsAddedObserver web_contents_added_observer;
+ tab1->GetMainFrame()->ExecuteJavaScriptForTests(
+ base::ASCIIToUTF16("window.open('title3.html', '_blank');"));
+ // ... then immediately hang the renderer so that title3.html can't load.
+ tab1->GetMainFrame()->ExecuteJavaScript(base::ASCIIToUTF16("while(1);"));
+
+ // Blocks until a new WebContents appears.
+ WebContents* tab2 = web_contents_added_observer.GetWebContents();
+
+ // Make sure the new WebContents is in tab1's hung renderer process.
+ ASSERT_NE(nullptr, tab2);
+ ASSERT_NE(tab1, tab2);
+ ASSERT_EQ(tab1->GetMainFrame()->GetProcess(),
+ tab2->GetMainFrame()->GetProcess())
+ << "New WebContents must be in the same process as the old WebContents, "
+ << "so that the new tab doesn't finish loading (what this test is all "
+ << "about)";
+ ASSERT_EQ(tab1->GetSiteInstance(), tab2->GetSiteInstance())
+ << "New WebContents must initially be in the same site instance as the "
+ << "old WebContents";
+
+ // Now navigate this tab to a different site. This should wind up in a
+ // different renderer process, so it should complete and show up in the task
+ // manager.
+ tab2->OpenURL(content::OpenURLParams(url3, content::Referrer(), CURRENT_TAB,
+ ui::PAGE_TRANSITION_TYPED, false));
+
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test")));
+}
+
IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticePanel) {
ASSERT_TRUE(LoadExtension(
test_data_dir_.AppendASCII("good").AppendASCII("Extensions")
« no previous file with comments | « no previous file | content/public/test/browser_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698