Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: chrome/browser/task_manager/task_manager_browsertest.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix weird formatting in recent_tabs_sub_menu_model.cc Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <stddef.h> 5 #include <stddef.h>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 // Killing the tab via task manager should remove the row. 240 // Killing the tab via task manager should remove the row.
241 int tab = FindResourceIndex(MatchTab("title1.html")); 241 int tab = FindResourceIndex(MatchTab("title1.html"));
242 ASSERT_NE(-1, tab); 242 ASSERT_NE(-1, tab);
243 ASSERT_NE(-1, model()->GetTabId(tab)); 243 ASSERT_NE(-1, model()->GetTabId(tab));
244 model()->Kill(tab); 244 model()->Kill(tab);
245 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchTab("title1.html"))); 245 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchTab("title1.html")));
246 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 246 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
247 247
248 // Tab should reappear in task manager upon reload. 248 // Tab should reappear in task manager upon reload.
249 chrome::Reload(browser(), CURRENT_TAB); 249 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB);
250 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); 250 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html")));
251 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); 251 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab()));
252 } 252 }
253 253
254 // Regression test for http://crbug.com/444945. 254 // Regression test for http://crbug.com/444945.
255 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NavigateAwayFromHungRenderer) { 255 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NavigateAwayFromHungRenderer) {
256 ShowTaskManager(); 256 ShowTaskManager();
257 257
258 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); 258 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
259 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 259 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 << "New WebContents must be in the same process as the old WebContents, " 292 << "New WebContents must be in the same process as the old WebContents, "
293 << "so that the new tab doesn't finish loading (what this test is all " 293 << "so that the new tab doesn't finish loading (what this test is all "
294 << "about)"; 294 << "about)";
295 ASSERT_EQ(tab1->GetSiteInstance(), tab2->GetSiteInstance()) 295 ASSERT_EQ(tab1->GetSiteInstance(), tab2->GetSiteInstance())
296 << "New WebContents must initially be in the same site instance as the " 296 << "New WebContents must initially be in the same site instance as the "
297 << "old WebContents"; 297 << "old WebContents";
298 298
299 // Now navigate this tab to a different site. This should wind up in a 299 // Now navigate this tab to a different site. This should wind up in a
300 // different renderer process, so it should complete and show up in the task 300 // different renderer process, so it should complete and show up in the task
301 // manager. 301 // manager.
302 tab2->OpenURL(content::OpenURLParams(url3, content::Referrer(), CURRENT_TAB, 302 tab2->OpenURL(content::OpenURLParams(url3, content::Referrer(),
303 WindowOpenDisposition::CURRENT_TAB,
303 ui::PAGE_TRANSITION_TYPED, false)); 304 ui::PAGE_TRANSITION_TYPED, false));
304 305
305 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test"))); 306 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test")));
306 } 307 }
307 308
308 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeExtensionTabChanges) { 309 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeExtensionTabChanges) {
309 ShowTaskManager(); 310 ShowTaskManager();
310 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); 311 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
311 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 312 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
312 313
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnyTab())); 738 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnyTab()));
738 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools); 739 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools);
739 } 740 }
740 741
741 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, KillSubframe) { 742 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, KillSubframe) {
742 ShowTaskManager(); 743 ShowTaskManager();
743 744
744 GURL main_url(embedded_test_server()->GetURL( 745 GURL main_url(embedded_test_server()->GetURL(
745 "/cross-site/a.com/iframe_cross_site.html")); 746 "/cross-site/a.com/iframe_cross_site.html"));
746 browser()->OpenURL(content::OpenURLParams(main_url, content::Referrer(), 747 browser()->OpenURL(content::OpenURLParams(main_url, content::Referrer(),
747 CURRENT_TAB, 748 WindowOpenDisposition::CURRENT_TAB,
748 ui::PAGE_TRANSITION_TYPED, false)); 749 ui::PAGE_TRANSITION_TYPED, false));
749 750
750 ASSERT_NO_FATAL_FAILURE( 751 ASSERT_NO_FATAL_FAILURE(
751 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test"))); 752 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test")));
752 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 753 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
753 754
754 if (!ShouldExpectSubframes()) { 755 if (!ShouldExpectSubframes()) {
755 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 756 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
756 } else { 757 } else {
757 ASSERT_NO_FATAL_FAILURE( 758 ASSERT_NO_FATAL_FAILURE(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 // Tests what happens when a tab navigates to a site (a.com) that it previously 794 // Tests what happens when a tab navigates to a site (a.com) that it previously
794 // has a cross-process subframe into (b.com). 795 // has a cross-process subframe into (b.com).
795 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, NavigateToSubframeProcess) { 796 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, NavigateToSubframeProcess) {
796 ShowTaskManager(); 797 ShowTaskManager();
797 798
798 // Navigate the tab to a page on a.com with cross-process subframes to 799 // Navigate the tab to a page on a.com with cross-process subframes to
799 // b.com and c.com. 800 // b.com and c.com.
800 GURL a_dotcom(embedded_test_server()->GetURL( 801 GURL a_dotcom(embedded_test_server()->GetURL(
801 "/cross-site/a.com/iframe_cross_site.html")); 802 "/cross-site/a.com/iframe_cross_site.html"));
802 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(), 803 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(),
803 CURRENT_TAB, 804 WindowOpenDisposition::CURRENT_TAB,
804 ui::PAGE_TRANSITION_TYPED, false)); 805 ui::PAGE_TRANSITION_TYPED, false));
805 806
806 ASSERT_NO_FATAL_FAILURE( 807 ASSERT_NO_FATAL_FAILURE(
807 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test"))); 808 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test")));
808 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 809 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
809 810
810 if (!ShouldExpectSubframes()) { 811 if (!ShouldExpectSubframes()) {
811 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 812 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
812 } else { 813 } else {
813 ASSERT_NO_FATAL_FAILURE( 814 ASSERT_NO_FATAL_FAILURE(
814 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/"))); 815 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/")));
815 ASSERT_NO_FATAL_FAILURE( 816 ASSERT_NO_FATAL_FAILURE(
816 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/"))); 817 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/")));
817 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnySubframe())); 818 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnySubframe()));
818 } 819 }
819 820
820 // Now navigate to a page on b.com with a simple (same-site) iframe. 821 // Now navigate to a page on b.com with a simple (same-site) iframe.
821 // This should not show any subframe resources in the task manager. 822 // This should not show any subframe resources in the task manager.
822 GURL b_dotcom( 823 GURL b_dotcom(
823 embedded_test_server()->GetURL("/cross-site/b.com/iframe.html")); 824 embedded_test_server()->GetURL("/cross-site/b.com/iframe.html"));
824 825
825 browser()->OpenURL(content::OpenURLParams(b_dotcom, content::Referrer(), 826 browser()->OpenURL(content::OpenURLParams(b_dotcom, content::Referrer(),
826 CURRENT_TAB, 827 WindowOpenDisposition::CURRENT_TAB,
827 ui::PAGE_TRANSITION_TYPED, false)); 828 ui::PAGE_TRANSITION_TYPED, false));
828 829
829 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test"))); 830 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test")));
830 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 831 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
831 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 832 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
832 HideTaskManager(); 833 HideTaskManager();
833 ShowTaskManager(); 834 ShowTaskManager();
834 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test"))); 835 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test")));
835 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 836 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
836 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 837 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
837 } 838 }
838 839
839 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, 840 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest,
840 NavigateToSiteWithSubframeToOriginalSite) { 841 NavigateToSiteWithSubframeToOriginalSite) {
841 ShowTaskManager(); 842 ShowTaskManager();
842 843
843 // Navigate to a page on b.com with a simple (same-site) iframe. 844 // Navigate to a page on b.com with a simple (same-site) iframe.
844 // This should not show any subframe resources in the task manager. 845 // This should not show any subframe resources in the task manager.
845 GURL b_dotcom( 846 GURL b_dotcom(
846 embedded_test_server()->GetURL("/cross-site/b.com/iframe.html")); 847 embedded_test_server()->GetURL("/cross-site/b.com/iframe.html"));
847 848
848 browser()->OpenURL(content::OpenURLParams(b_dotcom, content::Referrer(), 849 browser()->OpenURL(content::OpenURLParams(b_dotcom, content::Referrer(),
849 CURRENT_TAB, 850 WindowOpenDisposition::CURRENT_TAB,
850 ui::PAGE_TRANSITION_TYPED, false)); 851 ui::PAGE_TRANSITION_TYPED, false));
851 852
852 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test"))); 853 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test")));
853 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 854 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
854 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 855 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
855 856
856 // Now navigate the tab to a page on a.com with cross-process subframes to 857 // Now navigate the tab to a page on a.com with cross-process subframes to
857 // b.com and c.com. 858 // b.com and c.com.
858 GURL a_dotcom(embedded_test_server()->GetURL( 859 GURL a_dotcom(embedded_test_server()->GetURL(
859 "/cross-site/a.com/iframe_cross_site.html")); 860 "/cross-site/a.com/iframe_cross_site.html"));
860 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(), 861 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(),
861 CURRENT_TAB, 862 WindowOpenDisposition::CURRENT_TAB,
862 ui::PAGE_TRANSITION_TYPED, false)); 863 ui::PAGE_TRANSITION_TYPED, false));
863 864
864 ASSERT_NO_FATAL_FAILURE( 865 ASSERT_NO_FATAL_FAILURE(
865 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test"))); 866 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test")));
866 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 867 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
867 868
868 if (!ShouldExpectSubframes()) { 869 if (!ShouldExpectSubframes()) {
869 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 870 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
870 } else { 871 } else {
871 ASSERT_NO_FATAL_FAILURE( 872 ASSERT_NO_FATAL_FAILURE(
(...skipping 21 matching lines...) Expand all
893 // back to the site of the parent document (a.com). 894 // back to the site of the parent document (a.com).
894 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, 895 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest,
895 CrossSiteIframeBecomesSameSite) { 896 CrossSiteIframeBecomesSameSite) {
896 ShowTaskManager(); 897 ShowTaskManager();
897 898
898 // Navigate the tab to a page on a.com with cross-process subframes to 899 // Navigate the tab to a page on a.com with cross-process subframes to
899 // b.com and c.com. 900 // b.com and c.com.
900 GURL a_dotcom(embedded_test_server()->GetURL( 901 GURL a_dotcom(embedded_test_server()->GetURL(
901 "/cross-site/a.com/iframe_cross_site.html")); 902 "/cross-site/a.com/iframe_cross_site.html"));
902 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(), 903 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(),
903 CURRENT_TAB, 904 WindowOpenDisposition::CURRENT_TAB,
904 ui::PAGE_TRANSITION_TYPED, false)); 905 ui::PAGE_TRANSITION_TYPED, false));
905 906
906 ASSERT_NO_FATAL_FAILURE( 907 ASSERT_NO_FATAL_FAILURE(
907 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test"))); 908 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test")));
908 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 909 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
909 910
910 if (!ShouldExpectSubframes()) { 911 if (!ShouldExpectSubframes()) {
911 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 912 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
912 } else { 913 } else {
913 ASSERT_NO_FATAL_FAILURE( 914 ASSERT_NO_FATAL_FAILURE(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 953 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
953 } 954 }
954 955
955 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, 956 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest,
956 LeavePageWithCrossSiteIframes) { 957 LeavePageWithCrossSiteIframes) {
957 ShowTaskManager(); 958 ShowTaskManager();
958 959
959 // Navigate the tab to a page on a.com with cross-process subframes. 960 // Navigate the tab to a page on a.com with cross-process subframes.
960 GURL a_dotcom_with_iframes(embedded_test_server()->GetURL( 961 GURL a_dotcom_with_iframes(embedded_test_server()->GetURL(
961 "/cross-site/a.com/iframe_cross_site.html")); 962 "/cross-site/a.com/iframe_cross_site.html"));
962 browser()->OpenURL(content::OpenURLParams(a_dotcom_with_iframes, 963 browser()->OpenURL(content::OpenURLParams(
963 content::Referrer(), CURRENT_TAB, 964 a_dotcom_with_iframes, content::Referrer(),
964 ui::PAGE_TRANSITION_TYPED, false)); 965 WindowOpenDisposition::CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false));
965 966
966 ASSERT_NO_FATAL_FAILURE( 967 ASSERT_NO_FATAL_FAILURE(
967 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test"))); 968 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test")));
968 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 969 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
969 970
970 if (!ShouldExpectSubframes()) { 971 if (!ShouldExpectSubframes()) {
971 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 972 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
972 } else { 973 } else {
973 ASSERT_NO_FATAL_FAILURE( 974 ASSERT_NO_FATAL_FAILURE(
974 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/"))); 975 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/")));
975 ASSERT_NO_FATAL_FAILURE( 976 ASSERT_NO_FATAL_FAILURE(
976 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/"))); 977 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/")));
977 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnySubframe())); 978 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnySubframe()));
978 } 979 }
979 980
980 // Navigate the tab to a page on a.com without cross-process subframes, and 981 // Navigate the tab to a page on a.com without cross-process subframes, and
981 // the subframe processes should disappear. 982 // the subframe processes should disappear.
982 GURL a_dotcom_simple( 983 GURL a_dotcom_simple(
983 embedded_test_server()->GetURL("/cross-site/a.com/title2.html")); 984 embedded_test_server()->GetURL("/cross-site/a.com/title2.html"));
984 browser()->OpenURL(content::OpenURLParams(a_dotcom_simple, 985 browser()->OpenURL(content::OpenURLParams(
985 content::Referrer(), CURRENT_TAB, 986 a_dotcom_simple, content::Referrer(), WindowOpenDisposition::CURRENT_TAB,
986 ui::PAGE_TRANSITION_TYPED, false)); 987 ui::PAGE_TRANSITION_TYPED, false));
987 ASSERT_NO_FATAL_FAILURE( 988 ASSERT_NO_FATAL_FAILURE(
988 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); 989 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness")));
989 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 990 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
990 991
991 HideTaskManager(); 992 HideTaskManager();
992 ShowTaskManager(); 993 ShowTaskManager();
993 994
994 ASSERT_NO_FATAL_FAILURE( 995 ASSERT_NO_FATAL_FAILURE(
995 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); 996 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness")));
996 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 997 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
997 } 998 }
998 999
999 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, OrderingOfDependentRows) { 1000 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, OrderingOfDependentRows) {
1000 ShowTaskManager(); 1001 ShowTaskManager();
1001 1002
1002 GURL a_with_frames(embedded_test_server()->GetURL( 1003 GURL a_with_frames(embedded_test_server()->GetURL(
1003 "a.com", "/cross_site_iframe_factory.html?a(b,b,c(d,a,b,c))")); 1004 "a.com", "/cross_site_iframe_factory.html?a(b,b,c(d,a,b,c))"));
1004 browser()->OpenURL(content::OpenURLParams(a_with_frames, content::Referrer(), 1005 browser()->OpenURL(content::OpenURLParams(a_with_frames, content::Referrer(),
1005 CURRENT_TAB, 1006 WindowOpenDisposition::CURRENT_TAB,
1006 ui::PAGE_TRANSITION_TYPED, false)); 1007 ui::PAGE_TRANSITION_TYPED, false));
1007 1008
1008 if (ShouldExpectSubframes()) { 1009 if (ShouldExpectSubframes()) {
1009 ASSERT_NO_FATAL_FAILURE( 1010 ASSERT_NO_FATAL_FAILURE(
1010 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/"))); 1011 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/")));
1011 ASSERT_NO_FATAL_FAILURE( 1012 ASSERT_NO_FATAL_FAILURE(
1012 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/"))); 1013 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/")));
1013 ASSERT_NO_FATAL_FAILURE( 1014 ASSERT_NO_FATAL_FAILURE(
1014 WaitForTaskManagerRows(1, MatchSubframe("http://d.com/"))); 1015 WaitForTaskManagerRows(1, MatchSubframe("http://d.com/")));
1015 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnySubframe())); 1016 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnySubframe()));
1016 } 1017 }
1017 ASSERT_NO_FATAL_FAILURE( 1018 ASSERT_NO_FATAL_FAILURE(
1018 WaitForTaskManagerRows(1, MatchTab("Cross-site iframe factory"))); 1019 WaitForTaskManagerRows(1, MatchTab("Cross-site iframe factory")));
1019 1020
1020 int index = FindResourceIndex(MatchTab("Cross-site iframe factory")); 1021 int index = FindResourceIndex(MatchTab("Cross-site iframe factory"));
1021 std::vector<int> subframe_offsets; 1022 std::vector<int> subframe_offsets;
1022 if (ShouldExpectSubframes()) { 1023 if (ShouldExpectSubframes()) {
1023 subframe_offsets = { 1024 subframe_offsets = {
1024 FindResourceIndex(MatchSubframe("http://b.com/")) - index, 1025 FindResourceIndex(MatchSubframe("http://b.com/")) - index,
1025 FindResourceIndex(MatchSubframe("http://c.com/")) - index, 1026 FindResourceIndex(MatchSubframe("http://c.com/")) - index,
1026 FindResourceIndex(MatchSubframe("http://d.com/")) - index}; 1027 FindResourceIndex(MatchSubframe("http://d.com/")) - index};
1027 EXPECT_THAT(subframe_offsets, testing::UnorderedElementsAre(1, 2, 3)); 1028 EXPECT_THAT(subframe_offsets, testing::UnorderedElementsAre(1, 2, 3));
1028 } 1029 }
1029 1030
1030 // Opening a new tab should appear below the existing tab. 1031 // Opening a new tab should appear below the existing tab.
1031 GURL other_tab_url(embedded_test_server()->GetURL( 1032 GURL other_tab_url(embedded_test_server()->GetURL(
1032 "d.com", "/cross_site_iframe_factory.html?d(a(c(b)))")); 1033 "d.com", "/cross_site_iframe_factory.html?d(a(c(b)))"));
1033 browser()->OpenURL(content::OpenURLParams(other_tab_url, content::Referrer(), 1034 browser()->OpenURL(
1034 NEW_FOREGROUND_TAB, 1035 content::OpenURLParams(other_tab_url, content::Referrer(),
1035 ui::PAGE_TRANSITION_TYPED, false)); 1036 WindowOpenDisposition::NEW_FOREGROUND_TAB,
1037 ui::PAGE_TRANSITION_TYPED, false));
1036 1038
1037 ASSERT_NO_FATAL_FAILURE( 1039 ASSERT_NO_FATAL_FAILURE(
1038 WaitForTaskManagerRows(2, MatchTab("Cross-site iframe factory"))); 1040 WaitForTaskManagerRows(2, MatchTab("Cross-site iframe factory")));
1039 if (ShouldExpectSubframes()) { 1041 if (ShouldExpectSubframes()) {
1040 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(6, MatchAnySubframe())); 1042 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(6, MatchAnySubframe()));
1041 ASSERT_NO_FATAL_FAILURE( 1043 ASSERT_NO_FATAL_FAILURE(
1042 WaitForTaskManagerRows(2, MatchSubframe("http://b.com/"))); 1044 WaitForTaskManagerRows(2, MatchSubframe("http://b.com/")));
1043 ASSERT_NO_FATAL_FAILURE( 1045 ASSERT_NO_FATAL_FAILURE(
1044 WaitForTaskManagerRows(2, MatchSubframe("http://c.com/"))); 1046 WaitForTaskManagerRows(2, MatchSubframe("http://c.com/")));
1045 ASSERT_NO_FATAL_FAILURE( 1047 ASSERT_NO_FATAL_FAILURE(
(...skipping 28 matching lines...) Expand all
1074 1076
1075 // Because the subframes for tab 2 are nested, their order is deterministic. 1077 // Because the subframes for tab 2 are nested, their order is deterministic.
1076 EXPECT_EQ("Subframe: http://a.com/", 1078 EXPECT_EQ("Subframe: http://a.com/",
1077 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); 1079 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1)));
1078 EXPECT_EQ("Subframe: http://c.com/", 1080 EXPECT_EQ("Subframe: http://c.com/",
1079 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); 1081 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2)));
1080 EXPECT_EQ("Subframe: http://b.com/", 1082 EXPECT_EQ("Subframe: http://b.com/",
1081 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); 1083 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3)));
1082 } 1084 }
1083 } 1085 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698