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