| 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/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 29 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 30 #include "chrome/browser/web_applications/web_app.h" | 30 #include "chrome/browser/web_applications/web_app.h" |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/grit/generated_resources.h" | 32 #include "chrome/grit/generated_resources.h" |
| 33 #include "chrome/test/base/in_process_browser_test.h" | 33 #include "chrome/test/base/in_process_browser_test.h" |
| 34 #include "chrome/test/base/ui_test_utils.h" | 34 #include "chrome/test/base/ui_test_utils.h" |
| 35 #include "components/infobars/core/confirm_infobar_delegate.h" | 35 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 36 #include "components/infobars/core/infobar.h" | 36 #include "components/infobars/core/infobar.h" |
| 37 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
| 38 #include "content/public/common/content_switches.h" | 38 #include "content/public/common/content_switches.h" |
| 39 #include "content/public/common/page_transition_types.h" | |
| 40 #include "content/public/test/browser_test_utils.h" | 39 #include "content/public/test/browser_test_utils.h" |
| 41 #include "extensions/browser/extension_system.h" | 40 #include "extensions/browser/extension_system.h" |
| 42 #include "extensions/common/extension.h" | 41 #include "extensions/common/extension.h" |
| 43 #include "net/dns/mock_host_resolver.h" | 42 #include "net/dns/mock_host_resolver.h" |
| 44 #include "net/test/embedded_test_server/embedded_test_server.h" | 43 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 45 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
| 46 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
| 46 #include "ui/base/page_transition_types.h" |
| 47 | 47 |
| 48 using content::WebContents; | 48 using content::WebContents; |
| 49 using task_manager::browsertest_util::MatchAboutBlankTab; | 49 using task_manager::browsertest_util::MatchAboutBlankTab; |
| 50 using task_manager::browsertest_util::MatchAnyApp; | 50 using task_manager::browsertest_util::MatchAnyApp; |
| 51 using task_manager::browsertest_util::MatchAnyExtension; | 51 using task_manager::browsertest_util::MatchAnyExtension; |
| 52 using task_manager::browsertest_util::MatchAnyTab; | 52 using task_manager::browsertest_util::MatchAnyTab; |
| 53 using task_manager::browsertest_util::MatchApp; | 53 using task_manager::browsertest_util::MatchApp; |
| 54 using task_manager::browsertest_util::MatchExtension; | 54 using task_manager::browsertest_util::MatchExtension; |
| 55 using task_manager::browsertest_util::MatchTab; | 55 using task_manager::browsertest_util::MatchTab; |
| 56 using task_manager::browsertest_util::WaitForTaskManagerRows; | 56 using task_manager::browsertest_util::WaitForTaskManagerRows; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 ShowTaskManager(); | 123 ShowTaskManager(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeTabContentsChanges) { | 126 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeTabContentsChanges) { |
| 127 ShowTaskManager(); | 127 ShowTaskManager(); |
| 128 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); | 128 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); |
| 129 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 129 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 130 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchTab("title1.html"))); | 130 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchTab("title1.html"))); |
| 131 | 131 |
| 132 // Open a new tab and make sure the task manager notices it. | 132 // Open a new tab and make sure the task manager notices it. |
| 133 AddTabAtIndex(0, GetTestURL(), content::PAGE_TRANSITION_TYPED); | 133 AddTabAtIndex(0, GetTestURL(), ui::PAGE_TRANSITION_TYPED); |
| 134 | 134 |
| 135 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); | 135 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); |
| 136 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); | 136 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); |
| 137 | 137 |
| 138 // Close the tab and verify that we notice. | 138 // Close the tab and verify that we notice. |
| 139 browser()->tab_strip_model()->CloseWebContentsAt(0, | 139 browser()->tab_strip_model()->CloseWebContentsAt(0, |
| 140 TabStripModel::CLOSE_NONE); | 140 TabStripModel::CLOSE_NONE); |
| 141 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchTab("title1.html"))); | 141 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchTab("title1.html"))); |
| 142 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 142 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 143 } | 143 } |
| 144 | 144 |
| 145 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, KillTab) { | 145 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, KillTab) { |
| 146 ShowTaskManager(); | 146 ShowTaskManager(); |
| 147 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); | 147 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); |
| 148 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 148 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 149 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchTab("title1.html"))); | 149 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchTab("title1.html"))); |
| 150 | 150 |
| 151 // Open a new tab and make sure the task manager notices it. | 151 // Open a new tab and make sure the task manager notices it. |
| 152 AddTabAtIndex(0, GetTestURL(), content::PAGE_TRANSITION_TYPED); | 152 AddTabAtIndex(0, GetTestURL(), ui::PAGE_TRANSITION_TYPED); |
| 153 | 153 |
| 154 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); | 154 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); |
| 155 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); | 155 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); |
| 156 | 156 |
| 157 // Killing the tab via task manager should remove the row. | 157 // Killing the tab via task manager should remove the row. |
| 158 int tab = FindResourceIndex(MatchTab("title1.html")); | 158 int tab = FindResourceIndex(MatchTab("title1.html")); |
| 159 ASSERT_NE(-1, tab); | 159 ASSERT_NE(-1, tab); |
| 160 ASSERT_TRUE(model()->GetResourceWebContents(tab) != NULL); | 160 ASSERT_TRUE(model()->GetResourceWebContents(tab) != NULL); |
| 161 ASSERT_TRUE(model()->CanActivate(tab)); | 161 ASSERT_TRUE(model()->CanActivate(tab)); |
| 162 TaskManager::GetInstance()->KillProcess(tab); | 162 TaskManager::GetInstance()->KillProcess(tab); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 ASSERT_NO_FATAL_FAILURE( | 373 ASSERT_NO_FATAL_FAILURE( |
| 374 WaitForTaskManagerRows(1, MatchExtension("My extension 1"))); | 374 WaitForTaskManagerRows(1, MatchExtension("My extension 1"))); |
| 375 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyExtension())); | 375 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyExtension())); |
| 376 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 376 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 377 | 377 |
| 378 // Open a new tab to an extension URL. Afterwards, the third entry (background | 378 // Open a new tab to an extension URL. Afterwards, the third entry (background |
| 379 // page) should be an extension resource whose title starts with "Extension:". | 379 // page) should be an extension resource whose title starts with "Extension:". |
| 380 // The fourth entry (page.html) is also of type extension and has both a | 380 // The fourth entry (page.html) is also of type extension and has both a |
| 381 // WebContents and an extension. The title should start with "Extension:". | 381 // WebContents and an extension. The title should start with "Extension:". |
| 382 GURL url("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html"); | 382 GURL url("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html"); |
| 383 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 383 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
| 384 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchExtension("Foobar"))); | 384 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchExtension("Foobar"))); |
| 385 ASSERT_NO_FATAL_FAILURE( | 385 ASSERT_NO_FATAL_FAILURE( |
| 386 WaitForTaskManagerRows(1, MatchExtension("My extension 1"))); | 386 WaitForTaskManagerRows(1, MatchExtension("My extension 1"))); |
| 387 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyExtension())); | 387 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyExtension())); |
| 388 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); | 388 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); |
| 389 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 389 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 390 | 390 |
| 391 int extension_tab = FindResourceIndex(MatchExtension("Foobar")); | 391 int extension_tab = FindResourceIndex(MatchExtension("Foobar")); |
| 392 ASSERT_NE(-1, extension_tab); | 392 ASSERT_NE(-1, extension_tab); |
| 393 ASSERT_TRUE(model()->GetResourceWebContents(extension_tab) != NULL); | 393 ASSERT_TRUE(model()->GetResourceWebContents(extension_tab) != NULL); |
| 394 ASSERT_TRUE(model()->CanActivate(extension_tab)); | 394 ASSERT_TRUE(model()->CanActivate(extension_tab)); |
| 395 | 395 |
| 396 int background_page = FindResourceIndex(MatchExtension("My extension 1")); | 396 int background_page = FindResourceIndex(MatchExtension("My extension 1")); |
| 397 ASSERT_NE(-1, background_page); | 397 ASSERT_NE(-1, background_page); |
| 398 ASSERT_TRUE(model()->GetResourceWebContents(background_page) == NULL); | 398 ASSERT_TRUE(model()->GetResourceWebContents(background_page) == NULL); |
| 399 ASSERT_FALSE(model()->CanActivate(background_page)); | 399 ASSERT_FALSE(model()->CanActivate(background_page)); |
| 400 } | 400 } |
| 401 | 401 |
| 402 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeExtensionTab) { | 402 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeExtensionTab) { |
| 403 // With the task manager closed, open a new tab to an extension URL. | 403 // With the task manager closed, open a new tab to an extension URL. |
| 404 // Afterwards, when we open the task manager, the third entry (background | 404 // Afterwards, when we open the task manager, the third entry (background |
| 405 // page) should be an extension resource whose title starts with "Extension:". | 405 // page) should be an extension resource whose title starts with "Extension:". |
| 406 // The fourth entry (page.html) is also of type extension and has both a | 406 // The fourth entry (page.html) is also of type extension and has both a |
| 407 // WebContents and an extension. The title should start with "Extension:". | 407 // WebContents and an extension. The title should start with "Extension:". |
| 408 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("good") | 408 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("good") |
| 409 .AppendASCII("Extensions") | 409 .AppendASCII("Extensions") |
| 410 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | 410 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") |
| 411 .AppendASCII("1.0.0.0"))); | 411 .AppendASCII("1.0.0.0"))); |
| 412 GURL url("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html"); | 412 GURL url("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html"); |
| 413 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 413 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
| 414 | 414 |
| 415 ShowTaskManager(); | 415 ShowTaskManager(); |
| 416 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchExtension("Foobar"))); | 416 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchExtension("Foobar"))); |
| 417 ASSERT_NO_FATAL_FAILURE( | 417 ASSERT_NO_FATAL_FAILURE( |
| 418 WaitForTaskManagerRows(1, MatchExtension("My extension 1"))); | 418 WaitForTaskManagerRows(1, MatchExtension("My extension 1"))); |
| 419 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyExtension())); | 419 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyExtension())); |
| 420 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); | 420 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); |
| 421 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 421 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 422 | 422 |
| 423 int extension_tab = FindResourceIndex(MatchExtension("Foobar")); | 423 int extension_tab = FindResourceIndex(MatchExtension("Foobar")); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 440 const extensions::Extension* extension = | 440 const extensions::Extension* extension = |
| 441 service->GetExtensionById(last_loaded_extension_id(), false); | 441 service->GetExtensionById(last_loaded_extension_id(), false); |
| 442 | 442 |
| 443 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); | 443 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); |
| 444 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 444 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 445 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension())); | 445 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension())); |
| 446 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyApp())); | 446 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyApp())); |
| 447 | 447 |
| 448 // Open a new tab to the app's launch URL and make sure we notice that. | 448 // Open a new tab to the app's launch URL and make sure we notice that. |
| 449 GURL url(extension->GetResourceURL("main.html")); | 449 GURL url(extension->GetResourceURL("main.html")); |
| 450 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 450 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
| 451 | 451 |
| 452 // There should be 1 "App: " tab and the original new tab page. | 452 // There should be 1 "App: " tab and the original new tab page. |
| 453 ASSERT_NO_FATAL_FAILURE( | 453 ASSERT_NO_FATAL_FAILURE( |
| 454 WaitForTaskManagerRows(1, MatchApp("Packaged App Test"))); | 454 WaitForTaskManagerRows(1, MatchApp("Packaged App Test"))); |
| 455 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyApp())); | 455 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyApp())); |
| 456 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); | 456 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); |
| 457 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 457 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 458 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension())); | 458 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension())); |
| 459 | 459 |
| 460 // Check that the third entry (main.html) is of type extension and has both | 460 // Check that the third entry (main.html) is of type extension and has both |
| (...skipping 19 matching lines...) Expand all Loading... |
| 480 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTab) { | 480 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTab) { |
| 481 ASSERT_TRUE(LoadExtension( | 481 ASSERT_TRUE(LoadExtension( |
| 482 test_data_dir_.AppendASCII("packaged_app"))); | 482 test_data_dir_.AppendASCII("packaged_app"))); |
| 483 ExtensionService* service = extensions::ExtensionSystem::Get( | 483 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 484 browser()->profile())->extension_service(); | 484 browser()->profile())->extension_service(); |
| 485 const extensions::Extension* extension = | 485 const extensions::Extension* extension = |
| 486 service->GetExtensionById(last_loaded_extension_id(), false); | 486 service->GetExtensionById(last_loaded_extension_id(), false); |
| 487 | 487 |
| 488 // Open a new tab to the app's launch URL and make sure we notice that. | 488 // Open a new tab to the app's launch URL and make sure we notice that. |
| 489 GURL url(extension->GetResourceURL("main.html")); | 489 GURL url(extension->GetResourceURL("main.html")); |
| 490 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 490 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
| 491 | 491 |
| 492 ShowTaskManager(); | 492 ShowTaskManager(); |
| 493 | 493 |
| 494 ASSERT_NO_FATAL_FAILURE( | 494 ASSERT_NO_FATAL_FAILURE( |
| 495 WaitForTaskManagerRows(1, MatchApp("Packaged App Test"))); | 495 WaitForTaskManagerRows(1, MatchApp("Packaged App Test"))); |
| 496 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 496 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 497 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension())); | 497 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension())); |
| 498 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyApp())); | 498 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyApp())); |
| 499 | 499 |
| 500 // Check that the third entry (main.html) is of type extension and has both | 500 // Check that the third entry (main.html) is of type extension and has both |
| (...skipping 18 matching lines...) Expand all Loading... |
| 519 replace_host.SetHostStr(host_str); | 519 replace_host.SetHostStr(host_str); |
| 520 GURL base_url = embedded_test_server()->GetURL( | 520 GURL base_url = embedded_test_server()->GetURL( |
| 521 "/extensions/api_test/app_process/"); | 521 "/extensions/api_test/app_process/"); |
| 522 base_url = base_url.ReplaceComponents(replace_host); | 522 base_url = base_url.ReplaceComponents(replace_host); |
| 523 | 523 |
| 524 // Open a new tab to an app URL before the app is loaded. | 524 // Open a new tab to an app URL before the app is loaded. |
| 525 GURL url(base_url.Resolve("path1/empty.html")); | 525 GURL url(base_url.Resolve("path1/empty.html")); |
| 526 content::WindowedNotificationObserver observer( | 526 content::WindowedNotificationObserver observer( |
| 527 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 527 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 528 content::NotificationService::AllSources()); | 528 content::NotificationService::AllSources()); |
| 529 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 529 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
| 530 observer.Wait(); | 530 observer.Wait(); |
| 531 | 531 |
| 532 // Check that the new entry's title starts with "Tab:". | 532 // Check that the new entry's title starts with "Tab:". |
| 533 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); | 533 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); |
| 534 | 534 |
| 535 // Load the hosted app and make sure it still starts with "Tab:", | 535 // Load the hosted app and make sure it still starts with "Tab:", |
| 536 // since it hasn't changed to an app process yet. | 536 // since it hasn't changed to an app process yet. |
| 537 ASSERT_TRUE(LoadExtension( | 537 ASSERT_TRUE(LoadExtension( |
| 538 test_data_dir_.AppendASCII("api_test").AppendASCII("app_process"))); | 538 test_data_dir_.AppendASCII("api_test").AppendASCII("app_process"))); |
| 539 // Force the TaskManager to query the title. | 539 // Force the TaskManager to query the title. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 replace_host.SetHostStr(host_str); | 584 replace_host.SetHostStr(host_str); |
| 585 GURL base_url = | 585 GURL base_url = |
| 586 embedded_test_server()->GetURL("/extensions/api_test/app_process/"); | 586 embedded_test_server()->GetURL("/extensions/api_test/app_process/"); |
| 587 base_url = base_url.ReplaceComponents(replace_host); | 587 base_url = base_url.ReplaceComponents(replace_host); |
| 588 | 588 |
| 589 // Open a new tab to an app URL before the app is loaded. | 589 // Open a new tab to an app URL before the app is loaded. |
| 590 GURL url(base_url.Resolve("path1/empty.html")); | 590 GURL url(base_url.Resolve("path1/empty.html")); |
| 591 content::WindowedNotificationObserver observer( | 591 content::WindowedNotificationObserver observer( |
| 592 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 592 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 593 content::NotificationService::AllSources()); | 593 content::NotificationService::AllSources()); |
| 594 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 594 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
| 595 observer.Wait(); | 595 observer.Wait(); |
| 596 | 596 |
| 597 // Load the hosted app and make sure it still starts with "Tab:", | 597 // Load the hosted app and make sure it still starts with "Tab:", |
| 598 // since it hasn't changed to an app process yet. | 598 // since it hasn't changed to an app process yet. |
| 599 ASSERT_TRUE(LoadExtension( | 599 ASSERT_TRUE(LoadExtension( |
| 600 test_data_dir_.AppendASCII("api_test").AppendASCII("app_process"))); | 600 test_data_dir_.AppendASCII("api_test").AppendASCII("app_process"))); |
| 601 | 601 |
| 602 // Now reload, which should transition this tab to being an App. | 602 // Now reload, which should transition this tab to being an App. |
| 603 ui_test_utils::NavigateToURL(browser(), url); | 603 ui_test_utils::NavigateToURL(browser(), url); |
| 604 | 604 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 620 replace_host.SetHostStr(host_str); | 620 replace_host.SetHostStr(host_str); |
| 621 GURL base_url = | 621 GURL base_url = |
| 622 embedded_test_server()->GetURL("/extensions/api_test/app_process/"); | 622 embedded_test_server()->GetURL("/extensions/api_test/app_process/"); |
| 623 base_url = base_url.ReplaceComponents(replace_host); | 623 base_url = base_url.ReplaceComponents(replace_host); |
| 624 | 624 |
| 625 // Open a new tab to an app URL before the app is loaded. | 625 // Open a new tab to an app URL before the app is loaded. |
| 626 GURL url(base_url.Resolve("path1/empty.html")); | 626 GURL url(base_url.Resolve("path1/empty.html")); |
| 627 content::WindowedNotificationObserver observer( | 627 content::WindowedNotificationObserver observer( |
| 628 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 628 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 629 content::NotificationService::AllSources()); | 629 content::NotificationService::AllSources()); |
| 630 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 630 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
| 631 observer.Wait(); | 631 observer.Wait(); |
| 632 | 632 |
| 633 // Load the hosted app and make sure it still starts with "Tab:", | 633 // Load the hosted app and make sure it still starts with "Tab:", |
| 634 // since it hasn't changed to an app process yet. | 634 // since it hasn't changed to an app process yet. |
| 635 ASSERT_TRUE(LoadExtension( | 635 ASSERT_TRUE(LoadExtension( |
| 636 test_data_dir_.AppendASCII("api_test").AppendASCII("app_process"))); | 636 test_data_dir_.AppendASCII("api_test").AppendASCII("app_process"))); |
| 637 | 637 |
| 638 ShowTaskManager(); | 638 ShowTaskManager(); |
| 639 | 639 |
| 640 // The TaskManager should show this as a "Tab: " because the page hasn't been | 640 // The TaskManager should show this as a "Tab: " because the page hasn't been |
| (...skipping 28 matching lines...) Expand all Loading... |
| 669 | 669 |
| 670 // Crashy, http://crbug.com/42301. | 670 // Crashy, http://crbug.com/42301. |
| 671 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, | 671 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, |
| 672 DISABLED_PopulateWebCacheFields) { | 672 DISABLED_PopulateWebCacheFields) { |
| 673 ShowTaskManager(); | 673 ShowTaskManager(); |
| 674 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 674 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 675 | 675 |
| 676 int resource_count = TaskManager::GetInstance()->model()->ResourceCount(); | 676 int resource_count = TaskManager::GetInstance()->model()->ResourceCount(); |
| 677 | 677 |
| 678 // Open a new tab and make sure we notice that. | 678 // Open a new tab and make sure we notice that. |
| 679 AddTabAtIndex(0, GetTestURL(), content::PAGE_TRANSITION_TYPED); | 679 AddTabAtIndex(0, GetTestURL(), ui::PAGE_TRANSITION_TYPED); |
| 680 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); | 680 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); |
| 681 | 681 |
| 682 // Check that we get some value for the cache columns. | 682 // Check that we get some value for the cache columns. |
| 683 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(resource_count), | 683 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(resource_count), |
| 684 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 684 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 685 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(resource_count), | 685 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(resource_count), |
| 686 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 686 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 687 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(resource_count), | 687 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(resource_count), |
| 688 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); | 688 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT)); |
| 689 } | 689 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 } | 758 } |
| 759 | 759 |
| 760 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, DevToolsOldUnockedWindow) { | 760 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, DevToolsOldUnockedWindow) { |
| 761 DevToolsWindow* devtools = | 761 DevToolsWindow* devtools = |
| 762 DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), false); | 762 DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), false); |
| 763 ShowTaskManager(); // Task manager shown AFTER dev tools window. | 763 ShowTaskManager(); // Task manager shown AFTER dev tools window. |
| 764 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnyTab())); | 764 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnyTab())); |
| 765 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnyTab())); | 765 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnyTab())); |
| 766 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools); | 766 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools); |
| 767 } | 767 } |
| OLD | NEW |