| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/notifications/desktop_notification_service.h" | 15 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 15 #include "chrome/browser/notifications/notification.h" | 16 #include "chrome/browser/notifications/notification.h" |
| 16 #include "chrome/browser/notifications/notification_test_util.h" | 17 #include "chrome/browser/notifications/notification_test_util.h" |
| 17 #include "chrome/browser/notifications/notification_ui_manager.h" | 18 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 20 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
| 20 #include "chrome/browser/tabs/tab_strip_model.h" | 21 #include "chrome/browser/tabs/tab_strip_model.h" |
| 21 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 22 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
| 22 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/browser/ui/browser_navigator.h" | 24 #include "chrome/browser/ui/browser_navigator.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 EXPECT_TRUE(model()->GetResourceExtension(1) == NULL); | 367 EXPECT_TRUE(model()->GetResourceExtension(1) == NULL); |
| 367 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); | 368 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); |
| 368 | 369 |
| 369 // Kill the extension process and make sure we notice it. | 370 // Kill the extension process and make sure we notice it. |
| 370 TaskManager::GetInstance()->KillProcess(2); | 371 TaskManager::GetInstance()->KillProcess(2); |
| 371 TaskManagerBrowserTestUtil::WaitForResourceChange(2); | 372 TaskManagerBrowserTestUtil::WaitForResourceChange(2); |
| 372 | 373 |
| 373 // Reload the extension using the "crashed extension" infobar while the task | 374 // Reload the extension using the "crashed extension" infobar while the task |
| 374 // manager is still visible. Make sure we don't crash and the extension | 375 // manager is still visible. Make sure we don't crash and the extension |
| 375 // gets reloaded and noticed in the task manager. | 376 // gets reloaded and noticed in the task manager. |
| 376 TabContentsWrapper* current_tab = browser()->GetSelectedTabContentsWrapper(); | 377 InfoBarTabHelper* infobar_helper = |
| 377 ASSERT_EQ(1U, current_tab->infobar_count()); | 378 browser()->GetSelectedTabContentsWrapper()->infobar_tab_helper(); |
| 378 ConfirmInfoBarDelegate* delegate = | 379 ASSERT_EQ(1U, infobar_helper->infobar_count()); |
| 379 current_tab->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); | 380 ConfirmInfoBarDelegate* delegate = infobar_helper-> |
| 381 GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); |
| 380 ASSERT_TRUE(delegate); | 382 ASSERT_TRUE(delegate); |
| 381 delegate->Accept(); | 383 delegate->Accept(); |
| 382 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 384 TaskManagerBrowserTestUtil::WaitForResourceChange(3); |
| 383 } | 385 } |
| 384 | 386 |
| 385 #if defined(OS_WIN) | 387 #if defined(OS_WIN) |
| 386 // Bug 93158. | 388 // Bug 93158. |
| 387 #define MAYBE_ReloadExtension FLAKY_ReloadExtension | 389 #define MAYBE_ReloadExtension FLAKY_ReloadExtension |
| 388 #else | 390 #else |
| 389 #define MAYBE_ReloadExtension ReloadExtension | 391 #define MAYBE_ReloadExtension ReloadExtension |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 451 TaskManagerBrowserTestUtil::WaitForResourceChange(3); |
| 450 | 452 |
| 451 // Check that we get some value for the cache columns. | 453 // Check that we get some value for the cache columns. |
| 452 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), | 454 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), |
| 453 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 455 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 454 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), | 456 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), |
| 455 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 457 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 456 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), | 458 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), |
| 457 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 459 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 458 } | 460 } |
| OLD | NEW |