 Chromium Code Reviews
 Chromium Code Reviews Issue 5526002:
  Show extension tabs in task manager and correctly label apps.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 5526002:
  Show extension tabs in task manager and correctly label apps.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: chrome/browser/task_manager/task_manager_browsertest.cc | 
| diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc | 
| index e2e1f7df23d13f6b45b558aaec8d9c986ae2daec..f70b2e6d2f0ce87f45e4981c79e20331fd132178 100644 | 
| --- a/chrome/browser/task_manager/task_manager_browsertest.cc | 
| +++ b/chrome/browser/task_manager/task_manager_browsertest.cc | 
| @@ -106,6 +106,13 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeTabContentsChanges) { | 
| AddTabAtIndex(0, url, PageTransition::TYPED); | 
| WaitForResourceChange(3); | 
| + // Check that the third entry is a tab contents resource whose title starts | 
| + // starts with "Tab:". | 
| + ASSERT_TRUE(model()->GetResourceTabContents(2) != NULL); | 
| + string16 prefix = WideToUTF16Hack(l10n_util::GetStringF( | 
| + IDS_TASK_MANAGER_TAB_PREFIX, L"")); | 
| + ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true)); | 
| + | 
| // Close the tab and verify that we notice. | 
| TabContents* first_tab = browser()->GetTabContentsAt(0); | 
| ASSERT_TRUE(first_tab); | 
| @@ -166,6 +173,61 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_NoticeExtensionChanges) { | 
| WaitForResourceChange(3); | 
| } | 
| +IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeExtensionTabs) { | 
| + // Show the task manager. This populates the model, and helps with debugging | 
| + // (you see the task manager). | 
| + browser()->window()->ShowTaskManager(); | 
| + | 
| + ASSERT_TRUE(LoadExtension( | 
| + test_data_dir_.AppendASCII("good").AppendASCII("Extensions") | 
| + .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | 
| + .AppendASCII("1.0.0.0"))); | 
| + | 
| + // Browser, Extension background page, and the New Tab Page. | 
| + EXPECT_EQ(3, model()->ResourceCount()); | 
| + | 
| + // Open a new tab to an extension URL and make sure we notice that. | 
| + GURL url("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html"); | 
| + AddTabAtIndex(0, url, PageTransition::TYPED); | 
| + WaitForResourceChange(4); | 
| + | 
| + // Check that the third entry (background) is an extension resource whose | 
| + // title starts with "Extension:". | 
| + ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); | 
| + string16 prefix = WideToUTF16Hack(l10n_util::GetStringF( | 
| + IDS_TASK_MANAGER_EXTENSION_PREFIX, L"")); | 
| + ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true)); | 
| + | 
| + // Check that the fourth entry (page.html) is a tab contents resource whose | 
| + // title starts with "Extension:". | 
| + ASSERT_TRUE(model()->GetResourceTabContents(3) != NULL); | 
| + ASSERT_TRUE(StartsWith(model()->GetResourceTitle(3), prefix, true)); | 
| +} | 
| + | 
| +IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTabs) { | 
| + // Show the task manager. This populates the model, and helps with debugging | 
| + // (you see the task manager). | 
| + browser()->window()->ShowTaskManager(); | 
| + | 
| + ASSERT_TRUE(LoadExtension( | 
| + test_data_dir_.AppendASCII("packaged_app"))); | 
| + | 
| + // Browser and the New Tab Page. | 
| + EXPECT_EQ(2, model()->ResourceCount()); | 
| + | 
| + // Open a new tab to the app's launch URL and make sure we notice that. | 
| + GURL url("chrome-extension://pffmiogcfmficciligcchmiebhahbanm/main.html"); | 
| 
Charlie Reis
2010/12/02 02:14:23
I'm guessing this is fragile and won't have the sa
 | 
| + AddTabAtIndex(0, url, PageTransition::TYPED); | 
| + WaitForResourceChange(3); | 
| + | 
| + // Check that the third entry (main.html) is a tab contents resource whose | 
| + // title starts with "App:". | 
| + ASSERT_TRUE(model()->GetResourceTabContents(2) != NULL); | 
| + string16 prefix = WideToUTF16Hack(l10n_util::GetStringF( | 
| + IDS_TASK_MANAGER_APP_PREFIX, L"")); | 
| + ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true)); | 
| +} | 
| + | 
| IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeNotificationChanges) { | 
| EXPECT_EQ(0, model()->ResourceCount()); |