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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 // Open a new tab and make sure we notice that. | 104 // Open a new tab and make sure we notice that. |
105 GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), | 105 GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), |
106 FilePath(kTitle1File))); | 106 FilePath(kTitle1File))); |
107 AddTabAtIndex(0, url, PageTransition::TYPED); | 107 AddTabAtIndex(0, url, PageTransition::TYPED); |
108 WaitForResourceChange(3); | 108 WaitForResourceChange(3); |
109 | 109 |
110 // Check that the third entry is a tab contents resource whose title starts | 110 // Check that the third entry is a tab contents resource whose title starts |
111 // starts with "Tab:". | 111 // starts with "Tab:". |
112 ASSERT_TRUE(model()->GetResourceTabContents(2) != NULL); | 112 ASSERT_TRUE(model()->GetResourceTabContents(2) != NULL); |
113 string16 prefix = l10n_util::GetStringFUTF16( | 113 string16 prefix = WideToUTF16Hack(l10n_util::GetStringF( |
114 IDS_TASK_MANAGER_TAB_PREFIX, string16()); | 114 IDS_TASK_MANAGER_TAB_PREFIX, L"")); |
115 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true)); | 115 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true)); |
116 | 116 |
117 // Close the tab and verify that we notice. | 117 // Close the tab and verify that we notice. |
118 TabContents* first_tab = browser()->GetTabContentsAt(0); | 118 TabContents* first_tab = browser()->GetTabContentsAt(0); |
119 ASSERT_TRUE(first_tab); | 119 ASSERT_TRUE(first_tab); |
120 browser()->CloseTabContents(first_tab); | 120 browser()->CloseTabContents(first_tab); |
121 WaitForResourceChange(2); | 121 WaitForResourceChange(2); |
122 } | 122 } |
123 | 123 |
124 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeBGContentsChanges) { | 124 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeBGContentsChanges) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // Open a new tab to an extension URL and make sure we notice that. | 186 // Open a new tab to an extension URL and make sure we notice that. |
187 GURL url("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html"); | 187 GURL url("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html"); |
188 AddTabAtIndex(0, url, PageTransition::TYPED); | 188 AddTabAtIndex(0, url, PageTransition::TYPED); |
189 WaitForResourceChange(4); | 189 WaitForResourceChange(4); |
190 | 190 |
191 // Check that the third entry (background) is an extension resource whose | 191 // Check that the third entry (background) is an extension resource whose |
192 // title starts with "Extension:". | 192 // title starts with "Extension:". |
193 ASSERT_EQ(TaskManager::Resource::EXTENSION, model()->GetResourceType(2)); | 193 ASSERT_EQ(TaskManager::Resource::EXTENSION, model()->GetResourceType(2)); |
194 ASSERT_TRUE(model()->GetResourceTabContents(2) == NULL); | 194 ASSERT_TRUE(model()->GetResourceTabContents(2) == NULL); |
195 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); | 195 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); |
196 string16 prefix = l10n_util::GetStringFUTF16( | 196 string16 prefix = WideToUTF16Hack(l10n_util::GetStringF( |
197 IDS_TASK_MANAGER_EXTENSION_PREFIX, string16()); | 197 IDS_TASK_MANAGER_EXTENSION_PREFIX, L"")); |
198 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true)); | 198 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true)); |
199 | 199 |
200 // Check that the fourth entry (page.html) is of type extension and has both | 200 // Check that the fourth entry (page.html) is of type extension and has both |
201 // a tab contents and an extension. The title should start with "Extension:". | 201 // a tab contents and an extension. The title should start with "Extension:". |
202 ASSERT_EQ(TaskManager::Resource::EXTENSION, model()->GetResourceType(3)); | 202 ASSERT_EQ(TaskManager::Resource::EXTENSION, model()->GetResourceType(3)); |
203 ASSERT_TRUE(model()->GetResourceTabContents(3) != NULL); | 203 ASSERT_TRUE(model()->GetResourceTabContents(3) != NULL); |
204 ASSERT_TRUE(model()->GetResourceExtension(3) != NULL); | 204 ASSERT_TRUE(model()->GetResourceExtension(3) != NULL); |
205 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(3), prefix, true)); | 205 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(3), prefix, true)); |
206 | 206 |
207 // Unload extension to avoid crash on Windows. | 207 // Unload extension to avoid crash on Windows. |
(...skipping 18 matching lines...) Expand all Loading... |
226 // Open a new tab to the app's launch URL and make sure we notice that. | 226 // Open a new tab to the app's launch URL and make sure we notice that. |
227 GURL url(extension->GetResourceURL("main.html")); | 227 GURL url(extension->GetResourceURL("main.html")); |
228 AddTabAtIndex(0, url, PageTransition::TYPED); | 228 AddTabAtIndex(0, url, PageTransition::TYPED); |
229 WaitForResourceChange(3); | 229 WaitForResourceChange(3); |
230 | 230 |
231 // Check that the third entry (main.html) is of type extension and has both | 231 // Check that the third entry (main.html) is of type extension and has both |
232 // a tab contents and an extension. The title should start with "App:". | 232 // a tab contents and an extension. The title should start with "App:". |
233 ASSERT_EQ(TaskManager::Resource::EXTENSION, model()->GetResourceType(2)); | 233 ASSERT_EQ(TaskManager::Resource::EXTENSION, model()->GetResourceType(2)); |
234 ASSERT_TRUE(model()->GetResourceTabContents(2) != NULL); | 234 ASSERT_TRUE(model()->GetResourceTabContents(2) != NULL); |
235 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); | 235 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); |
236 string16 prefix = l10n_util::GetStringFUTF16( | 236 string16 prefix = WideToUTF16Hack(l10n_util::GetStringF( |
237 IDS_TASK_MANAGER_APP_PREFIX, string16()); | 237 IDS_TASK_MANAGER_APP_PREFIX, L"")); |
238 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true)); | 238 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true)); |
239 | 239 |
240 // Unload extension to avoid crash on Windows. | 240 // Unload extension to avoid crash on Windows. |
241 UnloadExtension(last_loaded_extension_id_); | 241 UnloadExtension(last_loaded_extension_id_); |
242 WaitForResourceChange(2); | 242 WaitForResourceChange(2); |
243 } | 243 } |
244 | 244 |
245 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeNotificationChanges) { | 245 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeNotificationChanges) { |
246 EXPECT_EQ(0, model()->ResourceCount()); | 246 EXPECT_EQ(0, model()->ResourceCount()); |
247 | 247 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 WaitForResourceChange(3); | 384 WaitForResourceChange(3); |
385 | 385 |
386 // Check that we get some value for the cache columns. | 386 // Check that we get some value for the cache columns. |
387 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), | 387 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), |
388 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 388 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
389 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), | 389 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), |
390 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 390 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
391 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), | 391 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), |
392 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 392 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
393 } | 393 } |
OLD | NEW |