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/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" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTabs) { | 247 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTabs) { |
248 // Show the task manager. This populates the model, and helps with debugging | 248 // Show the task manager. This populates the model, and helps with debugging |
249 // (you see the task manager). | 249 // (you see the task manager). |
250 browser()->window()->ShowTaskManager(); | 250 browser()->window()->ShowTaskManager(); |
251 // Wait for loading of task manager. | 251 // Wait for loading of task manager. |
252 TaskManagerBrowserTestUtil::WaitForResourceChange(2); | 252 TaskManagerBrowserTestUtil::WaitForResourceChange(2); |
253 | 253 |
254 ASSERT_TRUE(LoadExtension( | 254 ASSERT_TRUE(LoadExtension( |
255 test_data_dir_.AppendASCII("packaged_app"))); | 255 test_data_dir_.AppendASCII("packaged_app"))); |
256 ExtensionService* service = browser()->profile()->GetExtensionService(); | 256 ExtensionService* service = browser()->profile()->GetExtensionService(); |
257 const Extension* extension = | 257 const extensions::Extension* extension = |
258 service->GetExtensionById(last_loaded_extension_id_, false); | 258 service->GetExtensionById(last_loaded_extension_id_, false); |
259 | 259 |
260 // Browser and the New Tab Page. | 260 // Browser and the New Tab Page. |
261 TaskManagerBrowserTestUtil::WaitForResourceChange(2); | 261 TaskManagerBrowserTestUtil::WaitForResourceChange(2); |
262 | 262 |
263 // Open a new tab to the app's launch URL and make sure we notice that. | 263 // Open a new tab to the app's launch URL and make sure we notice that. |
264 GURL url(extension->GetResourceURL("main.html")); | 264 GURL url(extension->GetResourceURL("main.html")); |
265 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 265 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); |
266 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 266 TaskManagerBrowserTestUtil::WaitForResourceChange(3); |
267 | 267 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 | 415 |
416 // Wait until we see the loaded extension in the task manager (the three | 416 // Wait until we see the loaded extension in the task manager (the three |
417 // resources are: the browser process, New Tab Page, and the extension). | 417 // resources are: the browser process, New Tab Page, and the extension). |
418 LOG(INFO) << "waiting for resource change"; | 418 LOG(INFO) << "waiting for resource change"; |
419 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 419 TaskManagerBrowserTestUtil::WaitForResourceChange(3); |
420 | 420 |
421 EXPECT_TRUE(model()->GetResourceExtension(0) == NULL); | 421 EXPECT_TRUE(model()->GetResourceExtension(0) == NULL); |
422 EXPECT_TRUE(model()->GetResourceExtension(1) == NULL); | 422 EXPECT_TRUE(model()->GetResourceExtension(1) == NULL); |
423 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); | 423 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); |
424 | 424 |
425 const Extension* extension = model()->GetResourceExtension(2); | 425 const extensions::Extension* extension = model()->GetResourceExtension(2); |
426 ASSERT_TRUE(extension != NULL); | 426 ASSERT_TRUE(extension != NULL); |
427 | 427 |
428 // Reload the extension a few times and make sure our resource count | 428 // Reload the extension a few times and make sure our resource count |
429 // doesn't increase. | 429 // doesn't increase. |
430 LOG(INFO) << "First extension reload"; | 430 LOG(INFO) << "First extension reload"; |
431 ReloadExtension(extension->id()); | 431 ReloadExtension(extension->id()); |
432 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 432 TaskManagerBrowserTestUtil::WaitForResourceChange(3); |
433 extension = model()->GetResourceExtension(2); | 433 extension = model()->GetResourceExtension(2); |
434 ASSERT_TRUE(extension != NULL); | 434 ASSERT_TRUE(extension != NULL); |
435 | 435 |
(...skipping 27 matching lines...) Expand all Loading... |
463 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 463 TaskManagerBrowserTestUtil::WaitForResourceChange(3); |
464 | 464 |
465 // Check that we get some value for the cache columns. | 465 // Check that we get some value for the cache columns. |
466 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), | 466 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), |
467 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 467 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
468 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), | 468 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), |
469 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 469 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
470 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), | 470 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), |
471 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 471 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
472 } | 472 } |
OLD | NEW |