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 "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 } | 599 } |
600 | 600 |
601 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabChanges) { | 601 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabChanges) { |
602 ShowTaskManager(); | 602 ShowTaskManager(); |
603 | 603 |
604 // The app under test acts on URLs whose host is "localhost", | 604 // The app under test acts on URLs whose host is "localhost", |
605 // so the URLs we navigate to must have host "localhost". | 605 // so the URLs we navigate to must have host "localhost". |
606 host_resolver()->AddRule("*", "127.0.0.1"); | 606 host_resolver()->AddRule("*", "127.0.0.1"); |
607 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 607 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
608 GURL::Replacements replace_host; | 608 GURL::Replacements replace_host; |
609 std::string host_str("localhost"); // must stay in scope with replace_host | 609 replace_host.SetHostStr("localhost"); |
610 replace_host.SetHostStr(host_str); | |
611 GURL base_url = embedded_test_server()->GetURL( | 610 GURL base_url = embedded_test_server()->GetURL( |
612 "/extensions/api_test/app_process/"); | 611 "/extensions/api_test/app_process/"); |
613 base_url = base_url.ReplaceComponents(replace_host); | 612 base_url = base_url.ReplaceComponents(replace_host); |
614 | 613 |
615 // Open a new tab to an app URL before the app is loaded. | 614 // Open a new tab to an app URL before the app is loaded. |
616 GURL url(base_url.Resolve("path1/empty.html")); | 615 GURL url(base_url.Resolve("path1/empty.html")); |
617 content::WindowedNotificationObserver observer( | 616 content::WindowedNotificationObserver observer( |
618 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 617 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
619 content::NotificationService::AllSources()); | 618 content::NotificationService::AllSources()); |
620 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); | 619 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension())); | 663 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension())); |
665 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyApp())); | 664 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyApp())); |
666 } | 665 } |
667 | 666 |
668 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabAfterReload) { | 667 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabAfterReload) { |
669 // The app under test acts on URLs whose host is "localhost", | 668 // The app under test acts on URLs whose host is "localhost", |
670 // so the URLs we navigate to must have host "localhost". | 669 // so the URLs we navigate to must have host "localhost". |
671 host_resolver()->AddRule("*", "127.0.0.1"); | 670 host_resolver()->AddRule("*", "127.0.0.1"); |
672 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 671 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
673 GURL::Replacements replace_host; | 672 GURL::Replacements replace_host; |
674 std::string host_str("localhost"); // must stay in scope with replace_host | 673 replace_host.SetHostStr("localhost"); |
675 replace_host.SetHostStr(host_str); | |
676 GURL base_url = | 674 GURL base_url = |
677 embedded_test_server()->GetURL("/extensions/api_test/app_process/"); | 675 embedded_test_server()->GetURL("/extensions/api_test/app_process/"); |
678 base_url = base_url.ReplaceComponents(replace_host); | 676 base_url = base_url.ReplaceComponents(replace_host); |
679 | 677 |
680 // Open a new tab to an app URL before the app is loaded. | 678 // Open a new tab to an app URL before the app is loaded. |
681 GURL url(base_url.Resolve("path1/empty.html")); | 679 GURL url(base_url.Resolve("path1/empty.html")); |
682 content::WindowedNotificationObserver observer( | 680 content::WindowedNotificationObserver observer( |
683 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 681 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
684 content::NotificationService::AllSources()); | 682 content::NotificationService::AllSources()); |
685 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); | 683 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
(...skipping 14 matching lines...) Expand all Loading... |
700 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyApp())); | 698 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyApp())); |
701 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension())); | 699 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyExtension())); |
702 } | 700 } |
703 | 701 |
704 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabBeforeReload) { | 702 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabBeforeReload) { |
705 // The app under test acts on URLs whose host is "localhost", | 703 // The app under test acts on URLs whose host is "localhost", |
706 // so the URLs we navigate to must have host "localhost". | 704 // so the URLs we navigate to must have host "localhost". |
707 host_resolver()->AddRule("*", "127.0.0.1"); | 705 host_resolver()->AddRule("*", "127.0.0.1"); |
708 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 706 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
709 GURL::Replacements replace_host; | 707 GURL::Replacements replace_host; |
710 std::string host_str("localhost"); // must stay in scope with replace_host | 708 replace_host.SetHostStr("localhost"); |
711 replace_host.SetHostStr(host_str); | |
712 GURL base_url = | 709 GURL base_url = |
713 embedded_test_server()->GetURL("/extensions/api_test/app_process/"); | 710 embedded_test_server()->GetURL("/extensions/api_test/app_process/"); |
714 base_url = base_url.ReplaceComponents(replace_host); | 711 base_url = base_url.ReplaceComponents(replace_host); |
715 | 712 |
716 // Open a new tab to an app URL before the app is loaded. | 713 // Open a new tab to an app URL before the app is loaded. |
717 GURL url(base_url.Resolve("path1/empty.html")); | 714 GURL url(base_url.Resolve("path1/empty.html")); |
718 content::WindowedNotificationObserver observer( | 715 content::WindowedNotificationObserver observer( |
719 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 716 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
720 content::NotificationService::AllSources()); | 717 content::NotificationService::AllSources()); |
721 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); | 718 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 } else { | 1087 } else { |
1091 ASSERT_NO_FATAL_FAILURE( | 1088 ASSERT_NO_FATAL_FAILURE( |
1092 WaitForTaskManagerRows(0, MatchSubframe("http://b.com/"))); | 1089 WaitForTaskManagerRows(0, MatchSubframe("http://b.com/"))); |
1093 ASSERT_NO_FATAL_FAILURE( | 1090 ASSERT_NO_FATAL_FAILURE( |
1094 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/"))); | 1091 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/"))); |
1095 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnySubframe())); | 1092 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnySubframe())); |
1096 } | 1093 } |
1097 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("aac"))); | 1094 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("aac"))); |
1098 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 1095 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
1099 } | 1096 } |
OLD | NEW |