Chromium Code Reviews| 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 "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/background_contents_service.h" | 10 #include "chrome/browser/background_contents_service.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 // Browser and the New Tab Page. | 159 // Browser and the New Tab Page. |
| 160 EXPECT_EQ(2, model()->ResourceCount()); | 160 EXPECT_EQ(2, model()->ResourceCount()); |
| 161 | 161 |
| 162 // Loading an extension with a background page should result in a new | 162 // Loading an extension with a background page should result in a new |
| 163 // resource being created for it. | 163 // resource being created for it. |
| 164 ASSERT_TRUE(LoadExtension( | 164 ASSERT_TRUE(LoadExtension( |
| 165 test_data_dir_.AppendASCII("common").AppendASCII("background_page"))); | 165 test_data_dir_.AppendASCII("common").AppendASCII("background_page"))); |
| 166 WaitForResourceChange(3); | 166 WaitForResourceChange(3); |
| 167 } | 167 } |
| 168 | 168 |
| 169 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeExtensionTabs) { | |
| 170 // Show the task manager. This populates the model, and helps with debugging | |
| 171 // (you see the task manager). | |
| 172 browser()->window()->ShowTaskManager(); | |
| 173 | |
| 174 ASSERT_TRUE(LoadExtension( | |
| 175 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") | |
| 176 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | |
| 177 .AppendASCII("1.0.0.0"))); | |
| 178 | |
| 179 // Browser, Extension background page, and the New Tab Page. | |
| 180 EXPECT_EQ(3, model()->ResourceCount()); | |
| 181 | |
| 182 // Open a new tab to an extension URL and make sure we notice that. | |
| 183 GURL url("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html"); | |
| 184 AddTabAtIndex(0, url, PageTransition::TYPED); | |
| 185 WaitForResourceChange(4); | |
|
Erik does not do reviews
2010/12/02 01:05:17
should we test that this is the right type in the
Charlie Reis
2010/12/02 01:45:43
Good idea. The last one is actually a TabContents
| |
| 186 } | |
| 187 | |
| 169 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeNotificationChanges) { | 188 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeNotificationChanges) { |
| 170 EXPECT_EQ(0, model()->ResourceCount()); | 189 EXPECT_EQ(0, model()->ResourceCount()); |
| 171 | 190 |
| 172 // Show the task manager. | 191 // Show the task manager. |
| 173 browser()->window()->ShowTaskManager(); | 192 browser()->window()->ShowTaskManager(); |
| 174 // Expect to see the browser and the New Tab Page renderer. | 193 // Expect to see the browser and the New Tab Page renderer. |
| 175 EXPECT_EQ(2, model()->ResourceCount()); | 194 EXPECT_EQ(2, model()->ResourceCount()); |
| 176 | 195 |
| 177 // Show a notification. | 196 // Show a notification. |
| 178 NotificationUIManager* notifications = | 197 NotificationUIManager* notifications = |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 WaitForResourceChange(3); | 325 WaitForResourceChange(3); |
| 307 | 326 |
| 308 // Check that we get some value for the cache columns. | 327 // Check that we get some value for the cache columns. |
| 309 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), | 328 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), |
| 310 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 329 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 311 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), | 330 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), |
| 312 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 331 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 313 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), | 332 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), |
| 314 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 333 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 315 } | 334 } |
| OLD | NEW |