| 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/notifications/desktop_notification_service.h" | 14 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 15 #include "chrome/browser/notifications/notification.h" | 15 #include "chrome/browser/notifications/notification.h" |
| 16 #include "chrome/browser/notifications/notification_test_util.h" | 16 #include "chrome/browser/notifications/notification_test_util.h" |
| 17 #include "chrome/browser/notifications/notification_ui_manager.h" | 17 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 19 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
| 20 #include "chrome/browser/tabs/tab_strip_model.h" | 20 #include "chrome/browser/tabs/tab_strip_model.h" |
| 21 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_navigator.h" | 22 #include "chrome/browser/ui/browser_navigator.h" |
| 23 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 25 #include "chrome/common/chrome_notification_types.h" |
| 25 #include "chrome/common/extensions/extension.h" | 26 #include "chrome/common/extensions/extension.h" |
| 26 #include "chrome/test/in_process_browser_test.h" | 27 #include "chrome/test/in_process_browser_test.h" |
| 27 #include "chrome/test/ui_test_utils.h" | 28 #include "chrome/test/ui_test_utils.h" |
| 28 #include "content/common/page_transition_types.h" | 29 #include "content/common/page_transition_types.h" |
| 29 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
| 30 #include "net/base/mock_host_resolver.h" | 31 #include "net/base/mock_host_resolver.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 32 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
| 33 | 34 |
| 34 // On Linux this is crashing intermittently http://crbug/84719 | 35 // On Linux this is crashing intermittently http://crbug/84719 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 77 } |
| 77 | 78 |
| 78 const TaskManagerModel* model_; | 79 const TaskManagerModel* model_; |
| 79 const int target_resource_count_; | 80 const int target_resource_count_; |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 // Helper class used to wait for a BackgroundContents to finish loading. | 83 // Helper class used to wait for a BackgroundContents to finish loading. |
| 83 class BackgroundContentsListener : public NotificationObserver { | 84 class BackgroundContentsListener : public NotificationObserver { |
| 84 public: | 85 public: |
| 85 explicit BackgroundContentsListener(Profile* profile) { | 86 explicit BackgroundContentsListener(Profile* profile) { |
| 86 registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_NAVIGATED, | 87 registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, |
| 87 Source<Profile>(profile)); | 88 Source<Profile>(profile)); |
| 88 } | 89 } |
| 89 virtual void Observe(NotificationType type, | 90 virtual void Observe(int type, |
| 90 const NotificationSource& source, | 91 const NotificationSource& source, |
| 91 const NotificationDetails& details) { | 92 const NotificationDetails& details) { |
| 92 // Quit once the BackgroundContents has been loaded. | 93 // Quit once the BackgroundContents has been loaded. |
| 93 if (type.value == NotificationType::BACKGROUND_CONTENTS_NAVIGATED) | 94 if (type == chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED) |
| 94 MessageLoopForUI::current()->Quit(); | 95 MessageLoopForUI::current()->Quit(); |
| 95 } | 96 } |
| 96 private: | 97 private: |
| 97 NotificationRegistrar registrar_; | 98 NotificationRegistrar registrar_; |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 } // namespace | 101 } // namespace |
| 101 | 102 |
| 102 class TaskManagerBrowserTest : public ExtensionBrowserTest { | 103 class TaskManagerBrowserTest : public ExtensionBrowserTest { |
| 103 public: | 104 public: |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 WaitForResourceChange(3); | 496 WaitForResourceChange(3); |
| 496 | 497 |
| 497 // Check that we get some value for the cache columns. | 498 // Check that we get some value for the cache columns. |
| 498 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), | 499 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), |
| 499 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 500 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 500 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), | 501 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), |
| 501 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 502 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 502 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), | 503 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), |
| 503 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 504 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 504 } | 505 } |
| OLD | NEW |