| OLD | NEW |
| 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/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| 11 #include "chrome/browser/background/background_contents_service.h" | 11 #include "chrome/browser/background/background_contents_service.h" |
| 12 #include "chrome/browser/background/background_contents_service_factory.h" | 12 #include "chrome/browser/background/background_contents_service_factory.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/extensions/extension_browsertest.h" | 14 #include "chrome/browser/extensions/extension_browsertest.h" |
| 15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/extensions/extension_system.h" |
| 16 #include "chrome/browser/infobars/infobar_tab_helper.h" | 17 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 17 #include "chrome/browser/notifications/desktop_notification_service.h" | 18 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 18 #include "chrome/browser/notifications/notification.h" | 19 #include "chrome/browser/notifications/notification.h" |
| 19 #include "chrome/browser/notifications/notification_test_util.h" | 20 #include "chrome/browser/notifications/notification_test_util.h" |
| 20 #include "chrome/browser/notifications/notification_ui_manager.h" | 21 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 23 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
| 23 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_navigator.h" | 25 #include "chrome/browser/ui/browser_navigator.h" |
| 25 #include "chrome/browser/ui/browser_tabstrip.h" | 26 #include "chrome/browser/ui/browser_tabstrip.h" |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTabs) { | 372 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTabs) { |
| 372 // Show the task manager. This populates the model, and helps with debugging | 373 // Show the task manager. This populates the model, and helps with debugging |
| 373 // (you see the task manager). | 374 // (you see the task manager). |
| 374 browser()->window()->ShowTaskManager(); | 375 browser()->window()->ShowTaskManager(); |
| 375 // Wait for loading of task manager. | 376 // Wait for loading of task manager. |
| 376 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); | 377 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); |
| 377 | 378 |
| 378 int resource_count = TaskManager::GetInstance()->model()->ResourceCount(); | 379 int resource_count = TaskManager::GetInstance()->model()->ResourceCount(); |
| 379 ASSERT_TRUE(LoadExtension( | 380 ASSERT_TRUE(LoadExtension( |
| 380 test_data_dir_.AppendASCII("packaged_app"))); | 381 test_data_dir_.AppendASCII("packaged_app"))); |
| 381 ExtensionService* service = browser()->profile()->GetExtensionService(); | 382 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 383 browser()->profile())->extension_service(); |
| 382 const extensions::Extension* extension = | 384 const extensions::Extension* extension = |
| 383 service->GetExtensionById(last_loaded_extension_id_, false); | 385 service->GetExtensionById(last_loaded_extension_id_, false); |
| 384 | 386 |
| 385 // New Tab Page. | 387 // New Tab Page. |
| 386 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); | 388 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); |
| 387 | 389 |
| 388 // Open a new tab to the app's launch URL and make sure we notice that. | 390 // Open a new tab to the app's launch URL and make sure we notice that. |
| 389 GURL url(extension->GetResourceURL("main.html")); | 391 GURL url(extension->GetResourceURL("main.html")); |
| 390 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 392 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); |
| 391 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); | 393 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); | 602 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); |
| 601 | 603 |
| 602 // Check that we get some value for the cache columns. | 604 // Check that we get some value for the cache columns. |
| 603 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(resource_count), | 605 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(resource_count), |
| 604 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 606 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 605 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(resource_count), | 607 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(resource_count), |
| 606 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 608 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 607 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(resource_count), | 609 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(resource_count), |
| 608 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 610 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 609 } | 611 } |
| OLD | NEW |