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

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: Rebase. 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnyTab())); 742 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnyTab()));
742 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools); 743 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools);
743 } 744 }
744 745
745 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, KillSubframe) { 746 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, KillSubframe) {
746 ShowTaskManager(); 747 ShowTaskManager();
747 748
748 GURL main_url(embedded_test_server()->GetURL( 749 GURL main_url(embedded_test_server()->GetURL(
749 "/cross-site/a.com/iframe_cross_site.html")); 750 "/cross-site/a.com/iframe_cross_site.html"));
750 browser()->OpenURL(content::OpenURLParams(main_url, content::Referrer(), 751 browser()->OpenURL(content::OpenURLParams(main_url, content::Referrer(),
751 CURRENT_TAB, 752 WindowOpenDisposition::CURRENT_TAB,
752 ui::PAGE_TRANSITION_TYPED, false)); 753 ui::PAGE_TRANSITION_TYPED, false));
753 754
754 ASSERT_NO_FATAL_FAILURE( 755 ASSERT_NO_FATAL_FAILURE(
755 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test"))); 756 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test")));
756 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 757 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
757 758
758 if (!ShouldExpectSubframes()) { 759 if (!ShouldExpectSubframes()) {
759 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 760 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
760 } else { 761 } else {
761 ASSERT_NO_FATAL_FAILURE( 762 ASSERT_NO_FATAL_FAILURE(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 // Tests what happens when a tab navigates to a site (a.com) that it previously 798 // Tests what happens when a tab navigates to a site (a.com) that it previously
798 // has a cross-process subframe into (b.com). 799 // has a cross-process subframe into (b.com).
799 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, NavigateToSubframeProcess) { 800 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, NavigateToSubframeProcess) {
800 ShowTaskManager(); 801 ShowTaskManager();
801 802
802 // Navigate the tab to a page on a.com with cross-process subframes to 803 // Navigate the tab to a page on a.com with cross-process subframes to
803 // b.com and c.com. 804 // b.com and c.com.
804 GURL a_dotcom(embedded_test_server()->GetURL( 805 GURL a_dotcom(embedded_test_server()->GetURL(
805 "/cross-site/a.com/iframe_cross_site.html")); 806 "/cross-site/a.com/iframe_cross_site.html"));
806 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(), 807 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(),
807 CURRENT_TAB, 808 WindowOpenDisposition::CURRENT_TAB,
808 ui::PAGE_TRANSITION_TYPED, false)); 809 ui::PAGE_TRANSITION_TYPED, false));
809 810
810 ASSERT_NO_FATAL_FAILURE( 811 ASSERT_NO_FATAL_FAILURE(
811 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test"))); 812 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test")));
812 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 813 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
813 814
814 if (!ShouldExpectSubframes()) { 815 if (!ShouldExpectSubframes()) {
815 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 816 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
816 } else { 817 } else {
817 ASSERT_NO_FATAL_FAILURE( 818 ASSERT_NO_FATAL_FAILURE(
818 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/"))); 819 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/")));
819 ASSERT_NO_FATAL_FAILURE( 820 ASSERT_NO_FATAL_FAILURE(
820 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/"))); 821 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/")));
821 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnySubframe())); 822 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnySubframe()));
822 } 823 }
823 824
824 // Now navigate to a page on b.com with a simple (same-site) iframe. 825 // Now navigate to a page on b.com with a simple (same-site) iframe.
825 // This should not show any subframe resources in the task manager. 826 // This should not show any subframe resources in the task manager.
826 GURL b_dotcom( 827 GURL b_dotcom(
827 embedded_test_server()->GetURL("/cross-site/b.com/iframe.html")); 828 embedded_test_server()->GetURL("/cross-site/b.com/iframe.html"));
828 829
829 browser()->OpenURL(content::OpenURLParams(b_dotcom, content::Referrer(), 830 browser()->OpenURL(content::OpenURLParams(b_dotcom, content::Referrer(),
830 CURRENT_TAB, 831 WindowOpenDisposition::CURRENT_TAB,
831 ui::PAGE_TRANSITION_TYPED, false)); 832 ui::PAGE_TRANSITION_TYPED, false));
832 833
833 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test"))); 834 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test")));
834 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 835 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
835 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 836 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
836 HideTaskManager(); 837 HideTaskManager();
837 ShowTaskManager(); 838 ShowTaskManager();
838 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test"))); 839 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test")));
839 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 840 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
840 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 841 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
841 } 842 }
842 843
843 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, 844 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest,
844 NavigateToSiteWithSubframeToOriginalSite) { 845 NavigateToSiteWithSubframeToOriginalSite) {
845 ShowTaskManager(); 846 ShowTaskManager();
846 847
847 // Navigate to a page on b.com with a simple (same-site) iframe. 848 // Navigate to a page on b.com with a simple (same-site) iframe.
848 // This should not show any subframe resources in the task manager. 849 // This should not show any subframe resources in the task manager.
849 GURL b_dotcom( 850 GURL b_dotcom(
850 embedded_test_server()->GetURL("/cross-site/b.com/iframe.html")); 851 embedded_test_server()->GetURL("/cross-site/b.com/iframe.html"));
851 852
852 browser()->OpenURL(content::OpenURLParams(b_dotcom, content::Referrer(), 853 browser()->OpenURL(content::OpenURLParams(b_dotcom, content::Referrer(),
853 CURRENT_TAB, 854 WindowOpenDisposition::CURRENT_TAB,
854 ui::PAGE_TRANSITION_TYPED, false)); 855 ui::PAGE_TRANSITION_TYPED, false));
855 856
856 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test"))); 857 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("iframe test")));
857 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 858 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
858 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 859 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
859 860
860 // Now navigate the tab to a page on a.com with cross-process subframes to 861 // Now navigate the tab to a page on a.com with cross-process subframes to
861 // b.com and c.com. 862 // b.com and c.com.
862 GURL a_dotcom(embedded_test_server()->GetURL( 863 GURL a_dotcom(embedded_test_server()->GetURL(
863 "/cross-site/a.com/iframe_cross_site.html")); 864 "/cross-site/a.com/iframe_cross_site.html"));
864 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(), 865 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(),
865 CURRENT_TAB, 866 WindowOpenDisposition::CURRENT_TAB,
866 ui::PAGE_TRANSITION_TYPED, false)); 867 ui::PAGE_TRANSITION_TYPED, false));
867 868
868 ASSERT_NO_FATAL_FAILURE( 869 ASSERT_NO_FATAL_FAILURE(
869 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test"))); 870 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test")));
870 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 871 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
871 872
872 if (!ShouldExpectSubframes()) { 873 if (!ShouldExpectSubframes()) {
873 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 874 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
874 } else { 875 } else {
875 ASSERT_NO_FATAL_FAILURE( 876 ASSERT_NO_FATAL_FAILURE(
(...skipping 21 matching lines...) Expand all
897 // back to the site of the parent document (a.com). 898 // back to the site of the parent document (a.com).
898 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, 899 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest,
899 CrossSiteIframeBecomesSameSite) { 900 CrossSiteIframeBecomesSameSite) {
900 ShowTaskManager(); 901 ShowTaskManager();
901 902
902 // Navigate the tab to a page on a.com with cross-process subframes to 903 // Navigate the tab to a page on a.com with cross-process subframes to
903 // b.com and c.com. 904 // b.com and c.com.
904 GURL a_dotcom(embedded_test_server()->GetURL( 905 GURL a_dotcom(embedded_test_server()->GetURL(
905 "/cross-site/a.com/iframe_cross_site.html")); 906 "/cross-site/a.com/iframe_cross_site.html"));
906 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(), 907 browser()->OpenURL(content::OpenURLParams(a_dotcom, content::Referrer(),
907 CURRENT_TAB, 908 WindowOpenDisposition::CURRENT_TAB,
908 ui::PAGE_TRANSITION_TYPED, false)); 909 ui::PAGE_TRANSITION_TYPED, false));
909 910
910 ASSERT_NO_FATAL_FAILURE( 911 ASSERT_NO_FATAL_FAILURE(
911 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test"))); 912 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test")));
912 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 913 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
913 914
914 if (!ShouldExpectSubframes()) { 915 if (!ShouldExpectSubframes()) {
915 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 916 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
916 } else { 917 } else {
917 ASSERT_NO_FATAL_FAILURE( 918 ASSERT_NO_FATAL_FAILURE(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 957 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
957 } 958 }
958 959
959 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, 960 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest,
960 LeavePageWithCrossSiteIframes) { 961 LeavePageWithCrossSiteIframes) {
961 ShowTaskManager(); 962 ShowTaskManager();
962 963
963 // Navigate the tab to a page on a.com with cross-process subframes. 964 // Navigate the tab to a page on a.com with cross-process subframes.
964 GURL a_dotcom_with_iframes(embedded_test_server()->GetURL( 965 GURL a_dotcom_with_iframes(embedded_test_server()->GetURL(
965 "/cross-site/a.com/iframe_cross_site.html")); 966 "/cross-site/a.com/iframe_cross_site.html"));
966 browser()->OpenURL(content::OpenURLParams(a_dotcom_with_iframes, 967 browser()->OpenURL(content::OpenURLParams(
967 content::Referrer(), CURRENT_TAB, 968 a_dotcom_with_iframes, content::Referrer(),
968 ui::PAGE_TRANSITION_TYPED, false)); 969 WindowOpenDisposition::CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false));
969 970
970 ASSERT_NO_FATAL_FAILURE( 971 ASSERT_NO_FATAL_FAILURE(
971 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test"))); 972 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test")));
972 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 973 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
973 974
974 if (!ShouldExpectSubframes()) { 975 if (!ShouldExpectSubframes()) {
975 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 976 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
976 } else { 977 } else {
977 ASSERT_NO_FATAL_FAILURE( 978 ASSERT_NO_FATAL_FAILURE(
978 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/"))); 979 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/")));
979 ASSERT_NO_FATAL_FAILURE( 980 ASSERT_NO_FATAL_FAILURE(
980 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/"))); 981 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/")));
981 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnySubframe())); 982 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnySubframe()));
982 } 983 }
983 984
984 // Navigate the tab to a page on a.com without cross-process subframes, and 985 // Navigate the tab to a page on a.com without cross-process subframes, and
985 // the subframe processes should disappear. 986 // the subframe processes should disappear.
986 GURL a_dotcom_simple( 987 GURL a_dotcom_simple(
987 embedded_test_server()->GetURL("/cross-site/a.com/title2.html")); 988 embedded_test_server()->GetURL("/cross-site/a.com/title2.html"));
988 browser()->OpenURL(content::OpenURLParams(a_dotcom_simple, 989 browser()->OpenURL(content::OpenURLParams(
989 content::Referrer(), CURRENT_TAB, 990 a_dotcom_simple, content::Referrer(), WindowOpenDisposition::CURRENT_TAB,
990 ui::PAGE_TRANSITION_TYPED, false)); 991 ui::PAGE_TRANSITION_TYPED, false));
991 ASSERT_NO_FATAL_FAILURE( 992 ASSERT_NO_FATAL_FAILURE(
992 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); 993 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness")));
993 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 994 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
994 995
995 HideTaskManager(); 996 HideTaskManager();
996 ShowTaskManager(); 997 ShowTaskManager();
997 998
998 ASSERT_NO_FATAL_FAILURE( 999 ASSERT_NO_FATAL_FAILURE(
999 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); 1000 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness")));
1000 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); 1001 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe()));
1001 } 1002 }
1002 1003
1003 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, OrderingOfDependentRows) { 1004 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, OrderingOfDependentRows) {
1004 ShowTaskManager(); 1005 ShowTaskManager();
1005 1006
1006 GURL a_with_frames(embedded_test_server()->GetURL( 1007 GURL a_with_frames(embedded_test_server()->GetURL(
1007 "a.com", "/cross_site_iframe_factory.html?a(b,b,c(d,a,b,c))")); 1008 "a.com", "/cross_site_iframe_factory.html?a(b,b,c(d,a,b,c))"));
1008 browser()->OpenURL(content::OpenURLParams(a_with_frames, content::Referrer(), 1009 browser()->OpenURL(content::OpenURLParams(a_with_frames, content::Referrer(),
1009 CURRENT_TAB, 1010 WindowOpenDisposition::CURRENT_TAB,
1010 ui::PAGE_TRANSITION_TYPED, false)); 1011 ui::PAGE_TRANSITION_TYPED, false));
1011 1012
1012 if (ShouldExpectSubframes()) { 1013 if (ShouldExpectSubframes()) {
1013 ASSERT_NO_FATAL_FAILURE( 1014 ASSERT_NO_FATAL_FAILURE(
1014 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/"))); 1015 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/")));
1015 ASSERT_NO_FATAL_FAILURE( 1016 ASSERT_NO_FATAL_FAILURE(
1016 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/"))); 1017 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/")));
1017 ASSERT_NO_FATAL_FAILURE( 1018 ASSERT_NO_FATAL_FAILURE(
1018 WaitForTaskManagerRows(1, MatchSubframe("http://d.com/"))); 1019 WaitForTaskManagerRows(1, MatchSubframe("http://d.com/")));
1019 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnySubframe())); 1020 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(3, MatchAnySubframe()));
1020 } 1021 }
1021 ASSERT_NO_FATAL_FAILURE( 1022 ASSERT_NO_FATAL_FAILURE(
1022 WaitForTaskManagerRows(1, MatchTab("Cross-site iframe factory"))); 1023 WaitForTaskManagerRows(1, MatchTab("Cross-site iframe factory")));
1023 1024
1024 int index = FindResourceIndex(MatchTab("Cross-site iframe factory")); 1025 int index = FindResourceIndex(MatchTab("Cross-site iframe factory"));
1025 std::vector<int> subframe_offsets; 1026 std::vector<int> subframe_offsets;
1026 if (ShouldExpectSubframes()) { 1027 if (ShouldExpectSubframes()) {
1027 subframe_offsets = { 1028 subframe_offsets = {
1028 FindResourceIndex(MatchSubframe("http://b.com/")) - index, 1029 FindResourceIndex(MatchSubframe("http://b.com/")) - index,
1029 FindResourceIndex(MatchSubframe("http://c.com/")) - index, 1030 FindResourceIndex(MatchSubframe("http://c.com/")) - index,
1030 FindResourceIndex(MatchSubframe("http://d.com/")) - index}; 1031 FindResourceIndex(MatchSubframe("http://d.com/")) - index};
1031 EXPECT_THAT(subframe_offsets, testing::UnorderedElementsAre(1, 2, 3)); 1032 EXPECT_THAT(subframe_offsets, testing::UnorderedElementsAre(1, 2, 3));
1032 } 1033 }
1033 1034
1034 // Opening a new tab should appear below the existing tab. 1035 // Opening a new tab should appear below the existing tab.
1035 GURL other_tab_url(embedded_test_server()->GetURL( 1036 GURL other_tab_url(embedded_test_server()->GetURL(
1036 "d.com", "/cross_site_iframe_factory.html?d(a(c(b)))")); 1037 "d.com", "/cross_site_iframe_factory.html?d(a(c(b)))"));
1037 browser()->OpenURL(content::OpenURLParams(other_tab_url, content::Referrer(), 1038 browser()->OpenURL(
1038 NEW_FOREGROUND_TAB, 1039 content::OpenURLParams(other_tab_url, content::Referrer(),
1039 ui::PAGE_TRANSITION_TYPED, false)); 1040 WindowOpenDisposition::NEW_FOREGROUND_TAB,
1041 ui::PAGE_TRANSITION_TYPED, false));
1040 1042
1041 ASSERT_NO_FATAL_FAILURE( 1043 ASSERT_NO_FATAL_FAILURE(
1042 WaitForTaskManagerRows(2, MatchTab("Cross-site iframe factory"))); 1044 WaitForTaskManagerRows(2, MatchTab("Cross-site iframe factory")));
1043 if (ShouldExpectSubframes()) { 1045 if (ShouldExpectSubframes()) {
1044 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(6, MatchAnySubframe())); 1046 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(6, MatchAnySubframe()));
1045 ASSERT_NO_FATAL_FAILURE( 1047 ASSERT_NO_FATAL_FAILURE(
1046 WaitForTaskManagerRows(2, MatchSubframe("http://b.com/"))); 1048 WaitForTaskManagerRows(2, MatchSubframe("http://b.com/")));
1047 ASSERT_NO_FATAL_FAILURE( 1049 ASSERT_NO_FATAL_FAILURE(
1048 WaitForTaskManagerRows(2, MatchSubframe("http://c.com/"))); 1050 WaitForTaskManagerRows(2, MatchSubframe("http://c.com/")));
1049 ASSERT_NO_FATAL_FAILURE( 1051 ASSERT_NO_FATAL_FAILURE(
(...skipping 28 matching lines...) Expand all
1078 1080
1079 // Because the subframes for tab 2 are nested, their order is deterministic. 1081 // Because the subframes for tab 2 are nested, their order is deterministic.
1080 EXPECT_EQ("Subframe: http://a.com/", 1082 EXPECT_EQ("Subframe: http://a.com/",
1081 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); 1083 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1)));
1082 EXPECT_EQ("Subframe: http://c.com/", 1084 EXPECT_EQ("Subframe: http://c.com/",
1083 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); 1085 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2)));
1084 EXPECT_EQ("Subframe: http://b.com/", 1086 EXPECT_EQ("Subframe: http://b.com/",
1085 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); 1087 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3)));
1086 } 1088 }
1087 } 1089 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/view_source_browsertest.cc ('k') | chrome/browser/ui/android/bluetooth_chooser_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698