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

Side by Side Diff: chrome/browser/task_management/task_manager_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
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 92
93 void HideTaskManager() { 93 void HideTaskManager() {
94 model_.reset(); 94 model_.reset();
95 95
96 // Hide the task manager, and wait for it to go. 96 // Hide the task manager, and wait for it to go.
97 chrome::HideTaskManager(); 97 chrome::HideTaskManager();
98 base::RunLoop().RunUntilIdle(); // OnWindowClosed happens asynchronously. 98 base::RunLoop().RunUntilIdle(); // OnWindowClosed happens asynchronously.
99 } 99 }
100 100
101 void Refresh() {
102 task_management::TaskManagerTester::MaybeRefreshLegacyInstance();
103 }
104
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) {
113 if (title == model_->GetRowTitle(i)) 109 if (title == model_->GetRowTitle(i))
114 return i; 110 return i;
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 observer.Wait(); 681 observer.Wait();
686 682
687 // Check that the new entry's title starts with "Tab:". 683 // Check that the new entry's title starts with "Tab:".
688 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); 684 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab()));
689 685
690 // Load the hosted app and make sure it still starts with "Tab:", 686 // Load the hosted app and make sure it still starts with "Tab:",
691 // since it hasn't changed to an app process yet. 687 // since it hasn't changed to an app process yet.
692 ASSERT_TRUE(LoadExtension( 688 ASSERT_TRUE(LoadExtension(
693 test_data_dir_.AppendASCII("api_test").AppendASCII("app_process"))); 689 test_data_dir_.AppendASCII("api_test").AppendASCII("app_process")));
694 // Force the TaskManager to query the title. 690 // Force the TaskManager to query the title.
695 Refresh();
696 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); 691 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab()));
697 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); 692 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
698 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("Unmodified"))); 693 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("Unmodified")));
699 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension())); 694 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension()));
700 695
701 // Now reload and check that the last entry's title now starts with "App:". 696 // Now reload and check that the last entry's title now starts with "App:".
702 ui_test_utils::NavigateToURL(browser(), url); 697 ui_test_utils::NavigateToURL(browser(), url);
703 698
704 // Force the TaskManager to query the title. 699 // Force the TaskManager to query the title.
705 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 700 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 1174
1180 HideTaskManager(); 1175 HideTaskManager();
1181 ShowTaskManager(); 1176 ShowTaskManager();
1182 1177
1183 ASSERT_NO_FATAL_FAILURE( 1178 ASSERT_NO_FATAL_FAILURE(
1184 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); 1179 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness")));
1185 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 1180 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
1186 } 1181 }
1187 1182
1188 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, OrderingOfDependentRows) { 1183 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, OrderingOfDependentRows) {
1189 #if defined(OS_MACOSX)
1190 // The ordering under test here is not implemented in the legacy task manager.
1191 if (!task_management::TaskManagerInterface::IsNewTaskManagerEnabled())
1192 return;
1193 #endif
1194
1195 ShowTaskManager(); 1184 ShowTaskManager();
1196 1185
1197 GURL a_with_frames(embedded_test_server()->GetURL( 1186 GURL a_with_frames(embedded_test_server()->GetURL(
1198 "a.com", "/cross_site_iframe_factory.html?a(b,b,c(d,a,b,c))")); 1187 "a.com", "/cross_site_iframe_factory.html?a(b,b,c(d,a,b,c))"));
1199 browser()->OpenURL(content::OpenURLParams(a_with_frames, content::Referrer(), 1188 browser()->OpenURL(content::OpenURLParams(a_with_frames, content::Referrer(),
1200 CURRENT_TAB, 1189 CURRENT_TAB,
1201 ui::PAGE_TRANSITION_TYPED, false)); 1190 ui::PAGE_TRANSITION_TYPED, false));
1202 1191
1203 if (ShouldExpectSubframes()) { 1192 if (ShouldExpectSubframes()) {
1204 ASSERT_NO_FATAL_FAILURE( 1193 ASSERT_NO_FATAL_FAILURE(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 1258
1270 // Because the subframes for tab 2 are nested, their order is deterministic. 1259 // Because the subframes for tab 2 are nested, their order is deterministic.
1271 EXPECT_EQ("Subframe: http://a.com/", 1260 EXPECT_EQ("Subframe: http://a.com/",
1272 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); 1261 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1)));
1273 EXPECT_EQ("Subframe: http://c.com/", 1262 EXPECT_EQ("Subframe: http://c.com/",
1274 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); 1263 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2)));
1275 EXPECT_EQ("Subframe: http://b.com/", 1264 EXPECT_EQ("Subframe: http://b.com/",
1276 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); 1265 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3)));
1277 } 1266 }
1278 } 1267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698