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 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 } else { | 1087 } else { |
1088 ASSERT_NO_FATAL_FAILURE( | 1088 ASSERT_NO_FATAL_FAILURE( |
1089 WaitForTaskManagerRows(0, MatchSubframe("http://b.com/"))); | 1089 WaitForTaskManagerRows(0, MatchSubframe("http://b.com/"))); |
1090 ASSERT_NO_FATAL_FAILURE( | 1090 ASSERT_NO_FATAL_FAILURE( |
1091 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/"))); | 1091 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/"))); |
1092 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnySubframe())); | 1092 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnySubframe())); |
1093 } | 1093 } |
1094 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("aac"))); | 1094 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("aac"))); |
1095 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 1095 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
1096 } | 1096 } |
| 1097 |
| 1098 // Tests what happens when a tab does a same-site navigation away from a page |
| 1099 // with cross-site iframes. |
| 1100 IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, |
| 1101 LeavePageWithCrossSiteIframes) { |
| 1102 ShowTaskManager(); |
| 1103 |
| 1104 host_resolver()->AddRule("*", "127.0.0.1"); |
| 1105 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 1106 content::SetupCrossSiteRedirector(embedded_test_server()); |
| 1107 |
| 1108 // Navigate the tab to a page on a.com with cross-process subframes. |
| 1109 GURL a_dotcom_with_iframes(embedded_test_server()->GetURL( |
| 1110 "/cross-site/a.com/iframe_cross_site.html")); |
| 1111 browser()->OpenURL(content::OpenURLParams(a_dotcom_with_iframes, |
| 1112 content::Referrer(), CURRENT_TAB, |
| 1113 ui::PAGE_TRANSITION_TYPED, false)); |
| 1114 |
| 1115 ASSERT_NO_FATAL_FAILURE( |
| 1116 WaitForTaskManagerRows(1, MatchTab("cross-site iframe test"))); |
| 1117 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 1118 |
| 1119 if (!ShouldExpectSubframes()) { |
| 1120 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); |
| 1121 } else { |
| 1122 ASSERT_NO_FATAL_FAILURE( |
| 1123 WaitForTaskManagerRows(1, MatchSubframe("http://b.com/"))); |
| 1124 ASSERT_NO_FATAL_FAILURE( |
| 1125 WaitForTaskManagerRows(1, MatchSubframe("http://c.com/"))); |
| 1126 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnySubframe())); |
| 1127 } |
| 1128 |
| 1129 // Navigate the tab to a page on a.com without cross-process subframes, and |
| 1130 // the subframe processes should disappear. |
| 1131 GURL a_dotcom_simple( |
| 1132 embedded_test_server()->GetURL("/cross-site/a.com/title2.html")); |
| 1133 browser()->OpenURL(content::OpenURLParams(a_dotcom_simple, |
| 1134 content::Referrer(), CURRENT_TAB, |
| 1135 ui::PAGE_TRANSITION_TYPED, false)); |
| 1136 ASSERT_NO_FATAL_FAILURE( |
| 1137 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); |
| 1138 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); |
| 1139 |
| 1140 HideTaskManager(); |
| 1141 ShowTaskManager(); |
| 1142 |
| 1143 ASSERT_NO_FATAL_FAILURE( |
| 1144 WaitForTaskManagerRows(1, MatchTab("Title Of Awesomeness"))); |
| 1145 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnySubframe())); |
| 1146 } |
OLD | NEW |