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

Side by Side Diff: chrome/browser/ui/views/new_task_manager_view_browsertest.cc

Issue 2197483003: Move the Mac Task Manager to the new backend code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark Created 4 years, 4 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
« no previous file with comments | « chrome/browser/ui/views/new_task_manager_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/pattern.h" 8 #include "base/strings/pattern.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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // If the user re-triggers chrome::ShowTaskManager (e.g. via shift-esc), this 219 // If the user re-triggers chrome::ShowTaskManager (e.g. via shift-esc), this
220 // should set the TaskManager selection to the active tab. 220 // should set the TaskManager selection to the active tab.
221 chrome::ShowTaskManager(browser()); 221 chrome::ShowTaskManager(browser());
222 222
223 EXPECT_EQ(1, GetTable()->SelectedRowCount()); 223 EXPECT_EQ(1, GetTable()->SelectedRowCount());
224 EXPECT_EQ(GetTable()->FirstSelectedRow(), 224 EXPECT_EQ(GetTable()->FirstSelectedRow(),
225 FindRowForTab(browser()->tab_strip_model()->GetWebContentsAt(0))); 225 FindRowForTab(browser()->tab_strip_model()->GetWebContentsAt(0)));
226 } 226 }
227 227
228 IN_PROC_BROWSER_TEST_F(NewTaskManagerViewTest, SelectionConsistency) { 228 IN_PROC_BROWSER_TEST_F(NewTaskManagerViewTest, SelectionConsistency) {
229 ASSERT_NO_FATAL_FAILURE(ClearStoredColumnSettings());
230
229 chrome::ShowTaskManager(browser()); 231 chrome::ShowTaskManager(browser());
230 232
231 // Set up a total of three tabs in different processes. 233 // Set up a total of three tabs in different processes.
232 ui_test_utils::NavigateToURL( 234 ui_test_utils::NavigateToURL(
233 browser(), embedded_test_server()->GetURL("a.com", "/title2.html")); 235 browser(), embedded_test_server()->GetURL("a.com", "/title2.html"));
234 ui_test_utils::NavigateToURLWithDisposition( 236 ui_test_utils::NavigateToURLWithDisposition(
235 browser(), embedded_test_server()->GetURL("b.com", "/title2.html"), 237 browser(), embedded_test_server()->GetURL("b.com", "/title2.html"),
236 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 238 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
237 ui_test_utils::NavigateToURLWithDisposition( 239 ui_test_utils::NavigateToURLWithDisposition(
238 browser(), embedded_test_server()->GetURL("c.com", "/title2.html"), 240 browser(), embedded_test_server()->GetURL("c.com", "/title2.html"),
(...skipping 16 matching lines...) Expand all
255 continue; 257 continue;
256 content::WebContents* tab = FindWebContentsByTabId(tester->GetTabId(i)); 258 content::WebContents* tab = FindWebContentsByTabId(tester->GetTabId(i));
257 EXPECT_NE(nullptr, tab); 259 EXPECT_NE(nullptr, tab);
258 tabs.push_back(tab); 260 tabs.push_back(tab);
259 } 261 }
260 EXPECT_EQ(3U, tabs.size()); 262 EXPECT_EQ(3U, tabs.size());
261 263
262 // Select the middle row, and store its tab id. 264 // Select the middle row, and store its tab id.
263 GetTable()->Select(FindRowForTab(tabs[1])); 265 GetTable()->Select(FindRowForTab(tabs[1]));
264 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1])); 266 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1]));
267 EXPECT_EQ(1, GetTable()->SelectedRowCount());
265 268
266 // Add 3 rows above the selection. The selected tab should not change. 269 // Add 3 rows above the selection. The selected tab should not change.
267 for (int i = 0; i < 3; ++i) { 270 for (int i = 0; i < 3; ++i) {
268 ASSERT_TRUE(content::ExecuteScript(tabs[0], "window.open('title3.html');")); 271 ASSERT_TRUE(content::ExecuteScript(tabs[0], "window.open('title3.html');"));
269 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1])); 272 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1]));
270 } 273 }
271 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows += 3), pattern)); 274 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows += 3), pattern));
272 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1])); 275 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1]));
276 EXPECT_EQ(1, GetTable()->SelectedRowCount());
273 277
274 // Add 2 rows below the selection. The selected tab should not change. 278 // Add 2 rows below the selection. The selected tab should not change.
275 for (int i = 0; i < 2; ++i) { 279 for (int i = 0; i < 2; ++i) {
276 ASSERT_TRUE(content::ExecuteScript(tabs[2], "window.open('title3.html');")); 280 ASSERT_TRUE(content::ExecuteScript(tabs[2], "window.open('title3.html');"));
277 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1])); 281 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1]));
278 } 282 }
279 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows += 2), pattern)); 283 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows += 2), pattern));
280 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1])); 284 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1]));
285 EXPECT_EQ(1, GetTable()->SelectedRowCount());
281 286
282 // Add a new row in the same process as the selection. The selected tab should 287 // Add a new row in the same process as the selection. The selected tab should
283 // not change. 288 // not change.
284 ASSERT_TRUE(content::ExecuteScript(tabs[1], "window.open('title3.html');")); 289 ASSERT_TRUE(content::ExecuteScript(tabs[1], "window.open('title3.html');"));
285 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1])); 290 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1]));
286 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows += 1), pattern)); 291 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows += 1), pattern));
287 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1])); 292 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[1]));
288 EXPECT_EQ(1, GetTable()->SelectedRowCount()); 293 EXPECT_EQ(1, GetTable()->SelectedRowCount());
289 294
290 // Press the button, which kills the process of the selected row. 295 // Press the button, which kills the process of the selected row.
(...skipping 21 matching lines...) Expand all
312 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[2])); 317 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[2]));
313 318
314 // Close tabs[0]. The selection should not change. 319 // Close tabs[0]. The selection should not change.
315 chrome::CloseWebContents(browser(), tabs[0], false); 320 chrome::CloseWebContents(browser(), tabs[0], false);
316 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows -= 1), pattern)); 321 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows -= 1), pattern));
317 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[2])); 322 EXPECT_EQ(GetTable()->FirstSelectedRow(), FindRowForTab(tabs[2]));
318 } 323 }
319 324
320 } // namespace task_management 325 } // namespace task_management
321 326
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/new_task_manager_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698