| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // (you see the task manager). | 207 // (you see the task manager). |
| 208 browser()->window()->ShowTaskManager(); | 208 browser()->window()->ShowTaskManager(); |
| 209 | 209 |
| 210 // Browser and the New Tab Page. | 210 // Browser and the New Tab Page. |
| 211 TaskManagerBrowserTestUtil::WaitForResourceChange(2); | 211 TaskManagerBrowserTestUtil::WaitForResourceChange(2); |
| 212 | 212 |
| 213 // Open a new background contents and make sure we notice that. | 213 // Open a new background contents and make sure we notice that. |
| 214 GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), | 214 GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), |
| 215 FilePath(kTitle1File))); | 215 FilePath(kTitle1File))); |
| 216 | 216 |
| 217 ui_test_utils::WindowedNotificationObserver observer( | 217 content::WindowedNotificationObserver observer( |
| 218 chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, | 218 chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, |
| 219 content::Source<Profile>(browser()->profile())); | 219 content::Source<Profile>(browser()->profile())); |
| 220 | 220 |
| 221 BackgroundContentsService* service = | 221 BackgroundContentsService* service = |
| 222 BackgroundContentsServiceFactory::GetForProfile(browser()->profile()); | 222 BackgroundContentsServiceFactory::GetForProfile(browser()->profile()); |
| 223 string16 application_id(ASCIIToUTF16("test_app_id")); | 223 string16 application_id(ASCIIToUTF16("test_app_id")); |
| 224 service->LoadBackgroundContents(browser()->profile(), | 224 service->LoadBackgroundContents(browser()->profile(), |
| 225 url, | 225 url, |
| 226 ASCIIToUTF16("background_page"), | 226 ASCIIToUTF16("background_page"), |
| 227 application_id); | 227 application_id); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 ASSERT_TRUE(test_server()->Start()); | 361 ASSERT_TRUE(test_server()->Start()); |
| 362 GURL::Replacements replace_host; | 362 GURL::Replacements replace_host; |
| 363 std::string host_str("localhost"); // must stay in scope with replace_host | 363 std::string host_str("localhost"); // must stay in scope with replace_host |
| 364 replace_host.SetHostStr(host_str); | 364 replace_host.SetHostStr(host_str); |
| 365 GURL base_url = test_server()->GetURL( | 365 GURL base_url = test_server()->GetURL( |
| 366 "files/extensions/api_test/app_process/"); | 366 "files/extensions/api_test/app_process/"); |
| 367 base_url = base_url.ReplaceComponents(replace_host); | 367 base_url = base_url.ReplaceComponents(replace_host); |
| 368 | 368 |
| 369 // Open a new tab to an app URL before the app is loaded. | 369 // Open a new tab to an app URL before the app is loaded. |
| 370 GURL url(base_url.Resolve("path1/empty.html")); | 370 GURL url(base_url.Resolve("path1/empty.html")); |
| 371 ui_test_utils::WindowedNotificationObserver observer( | 371 content::WindowedNotificationObserver observer( |
| 372 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 372 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 373 content::NotificationService::AllSources()); | 373 content::NotificationService::AllSources()); |
| 374 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 374 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); |
| 375 observer.Wait(); | 375 observer.Wait(); |
| 376 | 376 |
| 377 // Check that the third entry's title starts with "Tab:". | 377 // Check that the third entry's title starts with "Tab:". |
| 378 string16 tab_prefix = l10n_util::GetStringFUTF16( | 378 string16 tab_prefix = l10n_util::GetStringFUTF16( |
| 379 IDS_TASK_MANAGER_TAB_PREFIX, string16()); | 379 IDS_TASK_MANAGER_TAB_PREFIX, string16()); |
| 380 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), tab_prefix, true)); | 380 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), tab_prefix, true)); |
| 381 | 381 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 531 TaskManagerBrowserTestUtil::WaitForResourceChange(3); |
| 532 | 532 |
| 533 // Check that we get some value for the cache columns. | 533 // Check that we get some value for the cache columns. |
| 534 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), | 534 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(2), |
| 535 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 535 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 536 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), | 536 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(2), |
| 537 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 537 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 538 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), | 538 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(2), |
| 539 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 539 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 540 } | 540 } |
| OLD | NEW |