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

Side by Side Diff: chrome/browser/task_manager/task_manager_browsertest.cc

Issue 1257603003: Revert of Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
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 "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
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()->ExecuteJavaScriptForTests( 260 tab1->GetMainFrame()->ExecuteJavaScript(base::ASCIIToUTF16("while(1);"));
261 base::ASCIIToUTF16("while(1);"));
262 261
263 // Blocks until a new WebContents appears. 262 // Blocks until a new WebContents appears.
264 WebContents* tab2 = web_contents_added_observer.GetWebContents(); 263 WebContents* tab2 = web_contents_added_observer.GetWebContents();
265 264
266 // Make sure the new WebContents is in tab1's hung renderer process. 265 // Make sure the new WebContents is in tab1's hung renderer process.
267 ASSERT_NE(nullptr, tab2); 266 ASSERT_NE(nullptr, tab2);
268 ASSERT_NE(tab1, tab2); 267 ASSERT_NE(tab1, tab2);
269 ASSERT_EQ(tab1->GetMainFrame()->GetProcess(), 268 ASSERT_EQ(tab1->GetMainFrame()->GetProcess(),
270 tab2->GetMainFrame()->GetProcess()) 269 tab2->GetMainFrame()->GetProcess())
271 << "New WebContents must be in the same process as the old WebContents, " 270 << "New WebContents must be in the same process as the old WebContents, "
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); 1205 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness")));
1207 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 1206 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
1208 1207
1209 HideTaskManager(); 1208 HideTaskManager();
1210 ShowTaskManager(); 1209 ShowTaskManager();
1211 1210
1212 ASSERT_NO_FATAL_FAILURE( 1211 ASSERT_NO_FATAL_FAILURE(
1213 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); 1212 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness")));
1214 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 1213 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
1215 } 1214 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698