| OLD | NEW |
| 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 "chrome/browser/task_manager/task_manager.h" | 5 #include "chrome/browser/task_manager/task_manager.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); | 250 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); |
| 251 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); | 251 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); |
| 252 WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents(); | 252 WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents(); |
| 253 | 253 |
| 254 // Initiate a navigation that will create a new WebContents in the same | 254 // Initiate a navigation that will create a new WebContents in the same |
| 255 // SiteInstace... | 255 // SiteInstace... |
| 256 content::WebContentsAddedObserver web_contents_added_observer; | 256 content::WebContentsAddedObserver web_contents_added_observer; |
| 257 tab1->GetMainFrame()->ExecuteJavaScriptWithUserGestureForTests( | 257 tab1->GetMainFrame()->ExecuteJavaScriptWithUserGestureForTests( |
| 258 base::ASCIIToUTF16("window.open('title3.html', '_blank');")); | 258 base::ASCIIToUTF16("window.open('title3.html', '_blank');")); |
| 259 // ... then immediately hang the renderer so that title3.html can't load. | 259 // ... then immediately hang the renderer so that title3.html can't load. |
| 260 tab1->GetMainFrame()->ExecuteJavaScript(base::ASCIIToUTF16("while(1);")); | 260 tab1->GetMainFrame()->ExecuteJavaScriptForTests( |
| 261 base::ASCIIToUTF16("while(1);")); |
| 261 | 262 |
| 262 // Blocks until a new WebContents appears. | 263 // Blocks until a new WebContents appears. |
| 263 WebContents* tab2 = web_contents_added_observer.GetWebContents(); | 264 WebContents* tab2 = web_contents_added_observer.GetWebContents(); |
| 264 | 265 |
| 265 // Make sure the new WebContents is in tab1's hung renderer process. | 266 // Make sure the new WebContents is in tab1's hung renderer process. |
| 266 ASSERT_NE(nullptr, tab2); | 267 ASSERT_NE(nullptr, tab2); |
| 267 ASSERT_NE(tab1, tab2); | 268 ASSERT_NE(tab1, tab2); |
| 268 ASSERT_EQ(tab1->GetMainFrame()->GetProcess(), | 269 ASSERT_EQ(tab1->GetMainFrame()->GetProcess(), |
| 269 tab2->GetMainFrame()->GetProcess()) | 270 tab2->GetMainFrame()->GetProcess()) |
| 270 << "New WebContents must be in the same process as the old WebContents, " | 271 << "New WebContents must be in the same process as the old WebContents, " |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); | 1206 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); |
| 1206 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); | 1207 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); |
| 1207 | 1208 |
| 1208 HideTaskManager(); | 1209 HideTaskManager(); |
| 1209 ShowTaskManager(); | 1210 ShowTaskManager(); |
| 1210 | 1211 |
| 1211 ASSERT_NO_FATAL_FAILURE( | 1212 ASSERT_NO_FATAL_FAILURE( |
| 1212 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); | 1213 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); |
| 1213 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); | 1214 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); |
| 1214 } | 1215 } |
| OLD | NEW |