| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/browser_navigator.h" |
| 10 #include "chrome/browser/browser_window.h" | 11 #include "chrome/browser/browser_window.h" |
| 11 #include "chrome/browser/extensions/crashed_extension_infobar.h" | 12 #include "chrome/browser/extensions/crashed_extension_infobar.h" |
| 12 #include "chrome/browser/extensions/extension_browsertest.h" | 13 #include "chrome/browser/extensions/extension_browsertest.h" |
| 13 #include "chrome/browser/tab_contents/infobar_delegate.h" | 14 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 14 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
| 15 #include "chrome/browser/tabs/tab_strip_model.h" | 16 #include "chrome/browser/tabs/tab_strip_model.h" |
| 16 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 17 #include "chrome/common/page_transition_types.h" | 18 #include "chrome/common/page_transition_types.h" |
| 18 #include "chrome/test/in_process_browser_test.h" | 19 #include "chrome/test/in_process_browser_test.h" |
| 19 #include "chrome/test/ui_test_utils.h" | 20 #include "chrome/test/ui_test_utils.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Show the task manager. This populates the model, and helps with debugging | 96 // Show the task manager. This populates the model, and helps with debugging |
| 96 // (you see the task manager). | 97 // (you see the task manager). |
| 97 browser()->window()->ShowTaskManager(); | 98 browser()->window()->ShowTaskManager(); |
| 98 | 99 |
| 99 // Browser and the New Tab Page. | 100 // Browser and the New Tab Page. |
| 100 EXPECT_EQ(2, model()->ResourceCount()); | 101 EXPECT_EQ(2, model()->ResourceCount()); |
| 101 | 102 |
| 102 // Open a new tab and make sure we notice that. | 103 // Open a new tab and make sure we notice that. |
| 103 GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), | 104 GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), |
| 104 FilePath(kTitle1File))); | 105 FilePath(kTitle1File))); |
| 105 Browser::AddTabWithURLParams params(url, PageTransition::TYPED); | 106 AddTabAtIndex(0, url, PageTransition::TYPED); |
| 106 params.index = 0; | |
| 107 browser()->AddTabWithURL(¶ms); | |
| 108 EXPECT_EQ(browser(), params.target); | |
| 109 WaitForResourceChange(3); | 107 WaitForResourceChange(3); |
| 110 | 108 |
| 111 // Close the tab and verify that we notice. | 109 // Close the tab and verify that we notice. |
| 112 TabContents* first_tab = browser()->GetTabContentsAt(0); | 110 TabContents* first_tab = browser()->GetTabContentsAt(0); |
| 113 ASSERT_TRUE(first_tab); | 111 ASSERT_TRUE(first_tab); |
| 114 browser()->CloseTabContents(first_tab); | 112 browser()->CloseTabContents(first_tab); |
| 115 WaitForResourceChange(2); | 113 WaitForResourceChange(2); |
| 116 } | 114 } |
| 117 | 115 |
| 118 #if defined(OS_WIN) | 116 #if defined(OS_WIN) |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // Show the task manager. This populates the model, and helps with debugging | 242 // Show the task manager. This populates the model, and helps with debugging |
| 245 // (you see the task manager). | 243 // (you see the task manager). |
| 246 browser()->window()->ShowTaskManager(); | 244 browser()->window()->ShowTaskManager(); |
| 247 | 245 |
| 248 // Browser and the New Tab Page. | 246 // Browser and the New Tab Page. |
| 249 EXPECT_EQ(2, model()->ResourceCount()); | 247 EXPECT_EQ(2, model()->ResourceCount()); |
| 250 | 248 |
| 251 // Open a new tab and make sure we notice that. | 249 // Open a new tab and make sure we notice that. |
| 252 GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), | 250 GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), |
| 253 FilePath(kTitle1File))); | 251 FilePath(kTitle1File))); |
| 254 Browser::AddTabWithURLParams params(url, PageTransition::TYPED); | 252 AddTabAtIndex(0, url, PageTransition::TYPED); |
| 255 params.index = 0; | |
| 256 browser()->AddTabWithURL(¶ms); | |
| 257 WaitForResourceChange(3); | 253 WaitForResourceChange(3); |
| 258 | 254 |
| 259 // Check that we get some value for the cache columns. | 255 // Check that we get some value for the cache columns. |
| 260 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), | 256 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), |
| 261 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 257 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 262 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), | 258 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), |
| 263 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 259 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 264 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), | 260 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), |
| 265 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 261 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 266 } | 262 } |
| OLD | NEW |