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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
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 "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/background/background_contents_service.h" 9 #include "chrome/browser/background/background_contents_service.h"
10 #include "chrome/browser/background/background_contents_service_factory.h" 10 #include "chrome/browser/background/background_contents_service_factory.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/extensions/extension_browsertest.h" 12 #include "chrome/browser/extensions/extension_browsertest.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/infobars/infobar_tab_helper.h" 14 #include "chrome/browser/infobars/infobar_tab_helper.h"
15 #include "chrome/browser/notifications/desktop_notification_service.h" 15 #include "chrome/browser/notifications/desktop_notification_service.h"
16 #include "chrome/browser/notifications/notification.h" 16 #include "chrome/browser/notifications/notification.h"
17 #include "chrome/browser/notifications/notification_test_util.h" 17 #include "chrome/browser/notifications/notification_test_util.h"
18 #include "chrome/browser/notifications/notification_ui_manager.h" 18 #include "chrome/browser/notifications/notification_ui_manager.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 20 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
21 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" 21 #include "chrome/browser/task_manager/task_manager_browsertest_util.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_navigator.h" 23 #include "chrome/browser/ui/browser_navigator.h"
24 #include "chrome/browser/ui/browser_tabstrip.h"
24 #include "chrome/browser/ui/browser_window.h" 25 #include "chrome/browser/ui/browser_window.h"
25 #include "chrome/browser/ui/tab_contents/tab_contents.h" 26 #include "chrome/browser/ui/tab_contents/tab_contents.h"
26 #include "chrome/browser/ui/tabs/tab_strip_model.h" 27 #include "chrome/browser/ui/tabs/tab_strip_model.h"
27 #include "chrome/common/chrome_notification_types.h" 28 #include "chrome/common/chrome_notification_types.h"
28 #include "chrome/common/extensions/extension.h" 29 #include "chrome/common/extensions/extension.h"
29 #include "chrome/test/base/in_process_browser_test.h" 30 #include "chrome/test/base/in_process_browser_test.h"
30 #include "chrome/test/base/ui_test_utils.h" 31 #include "chrome/test/base/ui_test_utils.h"
31 #include "content/public/browser/notification_service.h" 32 #include "content/public/browser/notification_service.h"
32 #include "content/public/common/content_switches.h" 33 #include "content/public/common/content_switches.h"
33 #include "content/public/common/page_transition_types.h" 34 #include "content/public/common/page_transition_types.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 TaskManagerBrowserTestUtil::WaitForResourceChange(3); 97 TaskManagerBrowserTestUtil::WaitForResourceChange(3);
97 98
98 // Check that the third entry is a tab contents resource whose title starts 99 // Check that the third entry is a tab contents resource whose title starts
99 // starts with "Tab:". 100 // starts with "Tab:".
100 ASSERT_TRUE(model()->GetResourceTabContents(2) != NULL); 101 ASSERT_TRUE(model()->GetResourceTabContents(2) != NULL);
101 string16 prefix = l10n_util::GetStringFUTF16( 102 string16 prefix = l10n_util::GetStringFUTF16(
102 IDS_TASK_MANAGER_TAB_PREFIX, string16()); 103 IDS_TASK_MANAGER_TAB_PREFIX, string16());
103 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true)); 104 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true));
104 105
105 // Close the tab and verify that we notice. 106 // Close the tab and verify that we notice.
106 WebContents* first_tab = browser()->GetTabContentsAt(0)->web_contents(); 107 WebContents* first_tab =
108 chrome::GetTabContentsAt(browser(), 0)->web_contents();
107 ASSERT_TRUE(first_tab); 109 ASSERT_TRUE(first_tab);
108 browser()->CloseTabContents(first_tab); 110 chrome::CloseWebContents(browser(), first_tab);
109 TaskManagerBrowserTestUtil::WaitForResourceChange(2); 111 TaskManagerBrowserTestUtil::WaitForResourceChange(2);
110 } 112 }
111 113
112 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeBGContentsChanges) { 114 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeBGContentsChanges) {
113 EXPECT_EQ(0, model()->ResourceCount()); 115 EXPECT_EQ(0, model()->ResourceCount());
114 EXPECT_EQ(0, TaskManager::GetBackgroundPageCount()); 116 EXPECT_EQ(0, TaskManager::GetBackgroundPageCount());
115 117
116 // Show the task manager. This populates the model, and helps with debugging 118 // Show the task manager. This populates the model, and helps with debugging
117 // (you see the task manager). 119 // (you see the task manager).
118 browser()->window()->ShowTaskManager(); 120 browser()->window()->ShowTaskManager();
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); 389 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL);
388 390
389 // Kill the extension process and make sure we notice it. 391 // Kill the extension process and make sure we notice it.
390 TaskManager::GetInstance()->KillProcess(2); 392 TaskManager::GetInstance()->KillProcess(2);
391 TaskManagerBrowserTestUtil::WaitForResourceChange(2); 393 TaskManagerBrowserTestUtil::WaitForResourceChange(2);
392 394
393 // Reload the extension using the "crashed extension" infobar while the task 395 // Reload the extension using the "crashed extension" infobar while the task
394 // manager is still visible. Make sure we don't crash and the extension 396 // manager is still visible. Make sure we don't crash and the extension
395 // gets reloaded and noticed in the task manager. 397 // gets reloaded and noticed in the task manager.
396 InfoBarTabHelper* infobar_helper = 398 InfoBarTabHelper* infobar_helper =
397 browser()->GetActiveTabContents()->infobar_tab_helper(); 399 chrome::GetActiveTabContents(browser())->infobar_tab_helper();
398 ASSERT_EQ(1U, infobar_helper->infobar_count()); 400 ASSERT_EQ(1U, infobar_helper->infobar_count());
399 ConfirmInfoBarDelegate* delegate = infobar_helper-> 401 ConfirmInfoBarDelegate* delegate = infobar_helper->
400 GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); 402 GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate();
401 ASSERT_TRUE(delegate); 403 ASSERT_TRUE(delegate);
402 delegate->Accept(); 404 delegate->Accept();
403 TaskManagerBrowserTestUtil::WaitForResourceChange(3); 405 TaskManagerBrowserTestUtil::WaitForResourceChange(3);
404 } 406 }
405 407
406 #if defined(OS_WIN) 408 #if defined(OS_WIN)
407 // http://crbug.com/93158. 409 // http://crbug.com/93158.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 TaskManagerBrowserTestUtil::WaitForResourceChange(3); 474 TaskManagerBrowserTestUtil::WaitForResourceChange(3);
473 475
474 // Check that we get some value for the cache columns. 476 // Check that we get some value for the cache columns.
475 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), 477 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2),
476 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); 478 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
477 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), 479 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2),
478 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); 480 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
479 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), 481 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2),
480 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); 482 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
481 } 483 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_restore_browsertest.cc ('k') | chrome/browser/translate/translate_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698