OLD | NEW |
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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #include <stddef.h> | 6 #include <stddef.h> |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/pattern.h" | 9 #include "base/strings/pattern.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 IN_PROC_BROWSER_TEST_F(TaskManagerMacTest, SelectionConsistency) { | 203 IN_PROC_BROWSER_TEST_F(TaskManagerMacTest, SelectionConsistency) { |
204 ASSERT_NO_FATAL_FAILURE(ClearStoredColumnSettings()); | 204 ASSERT_NO_FATAL_FAILURE(ClearStoredColumnSettings()); |
205 | 205 |
206 chrome::ShowTaskManager(browser()); | 206 chrome::ShowTaskManager(browser()); |
207 | 207 |
208 // Set up a total of three tabs in different processes. | 208 // Set up a total of three tabs in different processes. |
209 ui_test_utils::NavigateToURL( | 209 ui_test_utils::NavigateToURL( |
210 browser(), embedded_test_server()->GetURL("a.com", "/title2.html")); | 210 browser(), embedded_test_server()->GetURL("a.com", "/title2.html")); |
211 ui_test_utils::NavigateToURLWithDisposition( | 211 ui_test_utils::NavigateToURLWithDisposition( |
212 browser(), embedded_test_server()->GetURL("b.com", "/title2.html"), | 212 browser(), embedded_test_server()->GetURL("b.com", "/title2.html"), |
213 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 213 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 214 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
214 ui_test_utils::NavigateToURLWithDisposition( | 215 ui_test_utils::NavigateToURLWithDisposition( |
215 browser(), embedded_test_server()->GetURL("c.com", "/title2.html"), | 216 browser(), embedded_test_server()->GetURL("c.com", "/title2.html"), |
216 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 217 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 218 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
217 | 219 |
218 // Wait for their titles to appear in the TaskManager. There should be three | 220 // Wait for their titles to appear in the TaskManager. There should be three |
219 // rows. | 221 // rows. |
220 auto pattern = browsertest_util::MatchTab("Title *"); | 222 auto pattern = browsertest_util::MatchTab("Title *"); |
221 int rows = 3; | 223 int rows = 3; |
222 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(rows, pattern)); | 224 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(rows, pattern)); |
223 | 225 |
224 // Find the three tabs we set up, in TaskManager model order. Because we have | 226 // Find the three tabs we set up, in TaskManager model order. Because we have |
225 // not sorted the table yet, this should also be their UI display order. | 227 // not sorted the table yet, this should also be their UI display order. |
226 std::unique_ptr<TaskManagerTester> tester = | 228 std::unique_ptr<TaskManagerTester> tester = |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 ASSERT_EQ(-1, TableFirstSelectedRow()); | 281 ASSERT_EQ(-1, TableFirstSelectedRow()); |
280 | 282 |
281 // Now select tabs[2]. | 283 // Now select tabs[2]. |
282 [GetTable() | 284 [GetTable() |
283 selectRowIndexes:[NSIndexSet indexSetWithIndex:FindRowForTab(tabs[2])] | 285 selectRowIndexes:[NSIndexSet indexSetWithIndex:FindRowForTab(tabs[2])] |
284 byExtendingSelection:NO]; | 286 byExtendingSelection:NO]; |
285 | 287 |
286 // Focus and reload one of the sad tabs. It should reappear in the TM. The | 288 // Focus and reload one of the sad tabs. It should reappear in the TM. The |
287 // other sad tab should not reappear. | 289 // other sad tab should not reappear. |
288 tabs[1]->GetDelegate()->ActivateContents(tabs[1]); | 290 tabs[1]->GetDelegate()->ActivateContents(tabs[1]); |
289 chrome::Reload(browser(), CURRENT_TAB); | 291 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
290 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows += 1), pattern)); | 292 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows += 1), pattern)); |
291 | 293 |
292 // tabs[2] should still be selected. | 294 // tabs[2] should still be selected. |
293 EXPECT_EQ(TableFirstSelectedRow(), FindRowForTab(tabs[2])); | 295 EXPECT_EQ(TableFirstSelectedRow(), FindRowForTab(tabs[2])); |
294 | 296 |
295 // Close tabs[0]. The selection should not change. | 297 // Close tabs[0]. The selection should not change. |
296 chrome::CloseWebContents(browser(), tabs[0], false); | 298 chrome::CloseWebContents(browser(), tabs[0], false); |
297 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows -= 1), pattern)); | 299 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows((rows -= 1), pattern)); |
298 EXPECT_EQ(TableFirstSelectedRow(), FindRowForTab(tabs[2])); | 300 EXPECT_EQ(TableFirstSelectedRow(), FindRowForTab(tabs[2])); |
299 } | 301 } |
300 | 302 |
301 } // namespace task_manager | 303 } // namespace task_manager |
OLD | NEW |