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

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

Issue 1956813002: [Part 1 of 6] Move MockWebContentsTaskManager into its own file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Extend coverage of TaskManagerBrowserTest.NoticePanel to replace the coverage that had been in pane… Created 4 years, 7 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticePanel) { 296 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticePanel) {
297 ASSERT_TRUE(LoadExtension( 297 ASSERT_TRUE(LoadExtension(
298 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") 298 test_data_dir_.AppendASCII("good").AppendASCII("Extensions")
299 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") 299 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
300 .AppendASCII("1.0.0.0"))); 300 .AppendASCII("1.0.0.0")));
301 301
302 // Open a new panel to an extension url. 302 // Open a new panel to an extension url.
303 GURL url( 303 GURL url(
304 "chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/french_sentence.html"); 304 "chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/french_sentence.html");
305 Panel* panel = PanelManager::GetInstance()->CreatePanel( 305 Panel* docked_panel = PanelManager::GetInstance()->CreatePanel(
306 web_app::GenerateApplicationNameFromExtensionId( 306 web_app::GenerateApplicationNameFromExtensionId(
307 last_loaded_extension_id()), 307 last_loaded_extension_id()),
308 browser()->profile(), 308 browser()->profile(), url, nullptr, gfx::Rect(300, 400),
309 url,
310 nullptr,
311 gfx::Rect(300, 400),
312 PanelManager::CREATE_AS_DOCKED); 309 PanelManager::CREATE_AS_DOCKED);
313 310
314 // Make sure that a task manager model created after the panel shows the 311 // Make sure that a task manager model created after the panel shows the
315 // existence of the panel and the extension. 312 // existence of the panel and the extension.
316 ShowTaskManager(); 313 ShowTaskManager();
317 ASSERT_NO_FATAL_FAILURE( 314 ASSERT_NO_FATAL_FAILURE(
318 WaitForTaskManagerRows(1, MatchExtension("My extension 1"))); 315 WaitForTaskManagerRows(1, MatchExtension("My extension 1")));
319 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows( 316 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(
320 1, 317 1,
321 MatchExtension( 318 MatchExtension(
322 "chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/" 319 "chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/"
323 "french_sentence.html"))); 320 "french_sentence.html")));
324 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyExtension())); 321 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyExtension()));
325 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); 322 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
326 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 323 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
327 324
328 // Close the panel and verify that we notice. 325 // Create a second, detached panel.
329 panel->Close(); 326 Panel* detached_panel = PanelManager::GetInstance()->CreatePanel(
327 web_app::GenerateApplicationNameFromExtensionId(
328 last_loaded_extension_id()),
329 browser()->profile(), url, nullptr, gfx::Rect(150, 150),
330 PanelManager::CREATE_AS_DETACHED);
afakhry 2016/05/06 23:52:02 Can you also create a panel with SHOW_AS_INACTIVE?
ncarter (slow) 2016/05/09 16:43:03 Done. I've added calls to panel->Show() / panel->S
afakhry 2016/05/09 17:35:36 Thanks!
331
332 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(
333 2, MatchExtension("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/"
334 "french_sentence.html")));
335 ASSERT_NO_FATAL_FAILURE(
336 WaitForTaskManagerRows(1, MatchExtension("My extension 1")));
337 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnyExtension()));
338
339 // Close the panels and verify that we notice.
340 docked_panel->Close();
341 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyExtension()));
342 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(
343 1, MatchExtension("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/"
344 "french_sentence.html")));
345 ASSERT_NO_FATAL_FAILURE(
346 WaitForTaskManagerRows(1, MatchExtension("My extension 1")));
347
348 detached_panel->Close();
330 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyExtension())); 349 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyExtension()));
331 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows( 350 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(
332 0, 351 0,
333 MatchExtension( 352 MatchExtension(
334 "chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/" 353 "chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/"
335 "french_sentence.html"))); 354 "french_sentence.html")));
336 ASSERT_NO_FATAL_FAILURE( 355 ASSERT_NO_FATAL_FAILURE(
337 WaitForTaskManagerRows(1, MatchExtension("My extension 1"))); 356 WaitForTaskManagerRows(1, MatchExtension("My extension 1")));
338 } 357 }
339 358
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); 1228 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness")));
1210 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 1229 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
1211 1230
1212 HideTaskManager(); 1231 HideTaskManager();
1213 ShowTaskManager(); 1232 ShowTaskManager();
1214 1233
1215 ASSERT_NO_FATAL_FAILURE( 1234 ASSERT_NO_FATAL_FAILURE(
1216 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); 1235 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness")));
1217 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 1236 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
1218 } 1237 }
OLDNEW
« no previous file with comments | « chrome/browser/task_management/task_management_browsertest_util.cc ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698