OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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" | |
6 | |
7 #include <stddef.h> | 5 #include <stddef.h> |
8 | 6 |
9 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
10 #include "base/macros.h" | 8 #include "base/macros.h" |
11 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
12 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
13 #include "build/build_config.h" | 11 #include "build/build_config.h" |
14 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/devtools/devtools_window_testing.h" | 14 #include "chrome/browser/devtools/devtools_window_testing.h" |
17 #include "chrome/browser/extensions/extension_browsertest.h" | 15 #include "chrome/browser/extensions/extension_browsertest.h" |
18 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
19 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
20 #include "chrome/browser/notifications/notification.h" | 18 #include "chrome/browser/notifications/notification.h" |
21 #include "chrome/browser/notifications/notification_test_util.h" | 19 #include "chrome/browser/notifications/notification_test_util.h" |
22 #include "chrome/browser/notifications/notification_ui_manager.h" | 20 #include "chrome/browser/notifications/notification_ui_manager.h" |
23 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/task_management/task_manager_browsertest_util.h" | 22 #include "chrome/browser/task_management/task_manager_browsertest_util.h" |
| 23 #include "chrome/browser/task_management/task_manager_interface.h" |
25 #include "chrome/browser/task_management/task_manager_tester.h" | 24 #include "chrome/browser/task_management/task_manager_tester.h" |
26 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
27 #include "chrome/browser/ui/browser_commands.h" | 26 #include "chrome/browser/ui/browser_commands.h" |
28 #include "chrome/browser/ui/browser_dialogs.h" | 27 #include "chrome/browser/ui/browser_dialogs.h" |
29 #include "chrome/browser/ui/browser_window.h" | 28 #include "chrome/browser/ui/browser_window.h" |
30 #include "chrome/browser/ui/panels/panel.h" | 29 #include "chrome/browser/ui/panels/panel.h" |
31 #include "chrome/browser/ui/panels/panel_manager.h" | 30 #include "chrome/browser/ui/panels/panel_manager.h" |
32 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 31 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
33 #include "chrome/browser/web_applications/web_app.h" | 32 #include "chrome/browser/web_applications/web_app.h" |
34 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 88 |
90 void HideTaskManager() { | 89 void HideTaskManager() { |
91 model_.reset(); | 90 model_.reset(); |
92 | 91 |
93 // Hide the task manager, and wait for it to go. | 92 // Hide the task manager, and wait for it to go. |
94 chrome::HideTaskManager(); | 93 chrome::HideTaskManager(); |
95 base::RunLoop().RunUntilIdle(); // OnWindowClosed happens asynchronously. | 94 base::RunLoop().RunUntilIdle(); // OnWindowClosed happens asynchronously. |
96 } | 95 } |
97 | 96 |
98 void Refresh() { | 97 void Refresh() { |
99 // Refresh() isn't ever needed on the new task manager. | 98 task_management::TaskManagerTester::MaybeRefreshLegacyInstance(); |
100 if (switches::NewTaskManagerEnabled()) | |
101 return; | |
102 TaskManager::GetInstance()->model()->Refresh(); | |
103 } | 99 } |
104 | 100 |
105 GURL GetTestURL() { | 101 GURL GetTestURL() { |
106 return ui_test_utils::GetTestUrl( | 102 return ui_test_utils::GetTestUrl( |
107 base::FilePath(base::FilePath::kCurrentDirectory), | 103 base::FilePath(base::FilePath::kCurrentDirectory), |
108 base::FilePath(kTitle1File)); | 104 base::FilePath(kTitle1File)); |
109 } | 105 } |
110 | 106 |
111 int FindResourceIndex(const base::string16& title) { | 107 int FindResourceIndex(const base::string16& title) { |
112 for (int i = 0; i < model_->GetRowCount(); ++i) { | 108 for (int i = 0; i < model_->GetRowCount(); ++i) { |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); | 1181 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); |
1186 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); | 1182 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); |
1187 | 1183 |
1188 HideTaskManager(); | 1184 HideTaskManager(); |
1189 ShowTaskManager(); | 1185 ShowTaskManager(); |
1190 | 1186 |
1191 ASSERT_NO_FATAL_FAILURE( | 1187 ASSERT_NO_FATAL_FAILURE( |
1192 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); | 1188 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); |
1193 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); | 1189 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); |
1194 } | 1190 } |
OLD | NEW |