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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_browsertest.cc

Issue 1255573005: Create FrameNavigationEntries for the initial blank page in subframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments Created 5 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/browser/frame_host/frame_navigation_entry.h" 9 #include "content/browser/frame_host/frame_navigation_entry.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 capturer.params().transition); 1124 capturer.params().transition);
1125 EXPECT_EQ(NAVIGATION_TYPE_NEW_SUBFRAME, capturer.details().type); 1125 EXPECT_EQ(NAVIGATION_TYPE_NEW_SUBFRAME, capturer.details().type);
1126 EXPECT_FALSE(capturer.details().is_in_page); 1126 EXPECT_FALSE(capturer.details().is_in_page);
1127 } 1127 }
1128 } 1128 }
1129 1129
1130 // Verify the tree of FrameNavigationEntries after initial about:blank commits 1130 // Verify the tree of FrameNavigationEntries after initial about:blank commits
1131 // in subframes, which should not count as real committed loads. 1131 // in subframes, which should not count as real committed loads.
1132 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, 1132 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
1133 FrameNavigationEntry_BlankAutoSubframe) { 1133 FrameNavigationEntry_BlankAutoSubframe) {
1134 GURL about_blank_url(url::kAboutBlankURL);
1134 GURL main_url(embedded_test_server()->GetURL( 1135 GURL main_url(embedded_test_server()->GetURL(
1135 "/navigation_controller/simple_page_1.html")); 1136 "/navigation_controller/simple_page_1.html"));
1136 NavigateToURL(shell(), main_url); 1137 NavigateToURL(shell(), main_url);
1137 const NavigationControllerImpl& controller = 1138 const NavigationControllerImpl& controller =
1138 static_cast<const NavigationControllerImpl&>( 1139 static_cast<const NavigationControllerImpl&>(
1139 shell()->web_contents()->GetController()); 1140 shell()->web_contents()->GetController());
1140 FrameTreeNode* root = 1141 FrameTreeNode* root =
1141 static_cast<WebContentsImpl*>(shell()->web_contents())-> 1142 static_cast<WebContentsImpl*>(shell()->web_contents())->
1142 GetFrameTree()->root(); 1143 GetFrameTree()->root();
1143 1144
1144 // 1. Create a iframe with no URL. 1145 // 1. Create a iframe with no URL.
1145 { 1146 {
1146 LoadCommittedCapturer capturer(shell()->web_contents()); 1147 LoadCommittedCapturer capturer(shell()->web_contents());
1147 std::string script = "var iframe = document.createElement('iframe');" 1148 std::string script = "var iframe = document.createElement('iframe');"
1148 "document.body.appendChild(iframe);"; 1149 "document.body.appendChild(iframe);";
1149 EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script)); 1150 EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script));
1150 capturer.Wait(); 1151 capturer.Wait();
1151 EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type()); 1152 EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type());
1152 } 1153 }
1153 1154
1154 // Check last committed NavigationEntry. 1155 // Check last committed NavigationEntry.
1155 EXPECT_EQ(1, controller.GetEntryCount()); 1156 EXPECT_EQ(1, controller.GetEntryCount());
1156 NavigationEntryImpl* entry = controller.GetLastCommittedEntry(); 1157 NavigationEntryImpl* entry = controller.GetLastCommittedEntry();
1157 EXPECT_EQ(main_url, entry->GetURL()); 1158 EXPECT_EQ(main_url, entry->GetURL());
1158 FrameNavigationEntry* root_entry = entry->root_node()->frame_entry.get(); 1159 FrameNavigationEntry* root_entry = entry->root_node()->frame_entry.get();
1159 EXPECT_EQ(main_url, root_entry->url()); 1160 EXPECT_EQ(main_url, root_entry->url());
1160 1161
1161 // Verify no subframe entries are created. 1162 // Verify subframe entries if we're in --site-per-process mode.
1162 EXPECT_EQ(0U, entry->root_node()->children.size()); 1163 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1163 EXPECT_FALSE(controller.HasCommittedRealLoad(root->child_at(0))); 1164 switches::kSitePerProcess)) {
1165 // The entry should now have one blank subframe FrameNavigationEntry, but
1166 // this does not count as committing a real load.
1167 ASSERT_EQ(1U, entry->root_node()->children.size());
1168 FrameNavigationEntry* frame_entry =
1169 entry->root_node()->children[0]->frame_entry.get();
1170 EXPECT_EQ(about_blank_url, frame_entry->url());
1171 } else {
1172 // There are no subframe FrameNavigationEntries by default.
1173 EXPECT_EQ(0U, entry->root_node()->children.size());
1174 }
1175 EXPECT_FALSE(root->child_at(0)->has_committed_real_load());
1164 1176
1165 // 1a. A nested iframe with no URL should also create no subframe entries. 1177 // 1a. A nested iframe with no URL should also create a subframe entry but not
1178 // count as a real load.
1166 { 1179 {
1167 LoadCommittedCapturer capturer(shell()->web_contents()); 1180 LoadCommittedCapturer capturer(shell()->web_contents());
1168 std::string script = "var iframe = document.createElement('iframe');" 1181 std::string script = "var iframe = document.createElement('iframe');"
1169 "document.body.appendChild(iframe);"; 1182 "document.body.appendChild(iframe);";
1170 EXPECT_TRUE(content::ExecuteScript(root->child_at(0)->current_frame_host(), 1183 EXPECT_TRUE(content::ExecuteScript(root->child_at(0)->current_frame_host(),
1171 script)); 1184 script));
1172 capturer.Wait(); 1185 capturer.Wait();
1173 EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type()); 1186 EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type());
1174 } 1187 }
1175 EXPECT_EQ(0U, entry->root_node()->children.size());
1176 EXPECT_FALSE(controller.HasCommittedRealLoad(root->child_at(0)->child_at(0)));
1177 1188
1178 // 2. Create another iframe with an about:blank URL. 1189 // Verify subframe entries if we're in --site-per-process mode.
1190 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1191 switches::kSitePerProcess)) {
1192 // The nested entry should have one blank subframe FrameNavigationEntry, but
1193 // this does not count as committing a real load.
1194 ASSERT_EQ(1U, entry->root_node()->children[0]->children.size());
1195 FrameNavigationEntry* frame_entry =
1196 entry->root_node()->children[0]->children[0]->frame_entry.get();
1197 EXPECT_EQ(about_blank_url, frame_entry->url());
1198 } else {
1199 // There are no subframe FrameNavigationEntries by default.
1200 EXPECT_EQ(0U, entry->root_node()->children.size());
1201 }
1202 EXPECT_FALSE(root->child_at(0)->child_at(0)->has_committed_real_load());
1203
1204 // 2. Create another iframe with an explicit about:blank URL.
1179 { 1205 {
1180 LoadCommittedCapturer capturer(shell()->web_contents()); 1206 LoadCommittedCapturer capturer(shell()->web_contents());
1181 std::string script = "var iframe = document.createElement('iframe');" 1207 std::string script = "var iframe = document.createElement('iframe');"
1182 "iframe.src = 'about:blank';" 1208 "iframe.src = 'about:blank';"
1183 "document.body.appendChild(iframe);"; 1209 "document.body.appendChild(iframe);";
1184 EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script)); 1210 EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script));
1185 capturer.Wait(); 1211 capturer.Wait();
1186 EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type()); 1212 EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type());
1187 } 1213 }
1188 1214
1189 // Check last committed NavigationEntry. 1215 // Check last committed NavigationEntry.
1190 EXPECT_EQ(1, controller.GetEntryCount()); 1216 EXPECT_EQ(1, controller.GetEntryCount());
1191 EXPECT_EQ(entry, controller.GetLastCommittedEntry()); 1217 EXPECT_EQ(entry, controller.GetLastCommittedEntry());
1192 1218
1193 // Verify no subframe entries are created.
1194 EXPECT_EQ(0U, entry->root_node()->children.size());
1195 EXPECT_FALSE(controller.HasCommittedRealLoad(root->child_at(1)));
1196
1197 // 3. A real same-site navigation in the first iframe should be AUTO.
1198 GURL frame_url(embedded_test_server()->GetURL(
1199 "/navigation_controller/simple_page_1.html"));
1200 {
1201 LoadCommittedCapturer capturer(root->child_at(0));
1202 std::string script = "var frames = document.getElementsByTagName('iframe');"
1203 "frames[0].src = '" + frame_url.spec() + "';";
1204 EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script));
1205 capturer.Wait();
1206 EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type());
1207 }
1208
1209 // Check last committed NavigationEntry.
1210 EXPECT_EQ(1, controller.GetEntryCount());
1211 EXPECT_EQ(entry, controller.GetLastCommittedEntry());
1212
1213 // Verify subframe entries if we're in --site-per-process mode. 1219 // Verify subframe entries if we're in --site-per-process mode.
1214 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1220 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1215 switches::kSitePerProcess)) { 1221 switches::kSitePerProcess)) {
1216 // The entry should now have one subframe FrameNavigationEntry. 1222 // The new entry should have one blank subframe FrameNavigationEntry, but
1217 ASSERT_EQ(1U, entry->root_node()->children.size()); 1223 // this does not count as committing a real load.
1224 ASSERT_EQ(2U, entry->root_node()->children.size());
1218 FrameNavigationEntry* frame_entry = 1225 FrameNavigationEntry* frame_entry =
1219 entry->root_node()->children[0]->frame_entry.get(); 1226 entry->root_node()->children[1]->frame_entry.get();
1220 EXPECT_EQ(frame_url, frame_entry->url()); 1227 EXPECT_EQ(about_blank_url, frame_entry->url());
1221 EXPECT_TRUE(controller.HasCommittedRealLoad(root->child_at(0)));
1222 EXPECT_FALSE(controller.HasCommittedRealLoad(root->child_at(1)));
1223 } else { 1228 } else {
1224 // There are no subframe FrameNavigationEntries by default. 1229 // There are no subframe FrameNavigationEntries by default.
1225 EXPECT_EQ(0U, entry->root_node()->children.size()); 1230 EXPECT_EQ(0U, entry->root_node()->children.size());
1226 } 1231 }
1232 EXPECT_FALSE(root->child_at(1)->has_committed_real_load());
1233
1234 // 3. A real same-site navigation in the nested iframe should be AUTO.
1235 GURL frame_url(embedded_test_server()->GetURL(
1236 "/navigation_controller/simple_page_1.html"));
1237 {
1238 LoadCommittedCapturer capturer(root->child_at(0)->child_at(0));
1239 std::string script = "var frames = document.getElementsByTagName('iframe');"
1240 "frames[0].src = '" + frame_url.spec() + "';";
1241 EXPECT_TRUE(content::ExecuteScript(root->child_at(0)->current_frame_host(),
1242 script));
1243 capturer.Wait();
1244 EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type());
1245 }
1246
1247 // Check last committed NavigationEntry. It should have replaced the previous
1248 // frame entry in the original NavigationEntry.
1249 EXPECT_EQ(1, controller.GetEntryCount());
1250 EXPECT_EQ(entry, controller.GetLastCommittedEntry());
1251
1252 // Verify subframe entries if we're in --site-per-process mode.
1253 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1254 switches::kSitePerProcess)) {
1255 // The entry should still have one nested subframe FrameNavigationEntry.
1256 ASSERT_EQ(1U, entry->root_node()->children[0]->children.size());
1257 FrameNavigationEntry* frame_entry =
1258 entry->root_node()->children[0]->children[0]->frame_entry.get();
1259 EXPECT_EQ(frame_url, frame_entry->url());
1260 } else {
1261 // There are no subframe FrameNavigationEntries by default.
1262 EXPECT_EQ(0U, entry->root_node()->children.size());
1263 }
1264 EXPECT_FALSE(root->child_at(0)->has_committed_real_load());
1265 EXPECT_TRUE(root->child_at(0)->child_at(0)->has_committed_real_load());
1266 EXPECT_FALSE(root->child_at(1)->has_committed_real_load());
1227 1267
1228 // 4. A real cross-site navigation in the second iframe should be AUTO. 1268 // 4. A real cross-site navigation in the second iframe should be AUTO.
1229 GURL foo_url(embedded_test_server()->GetURL( 1269 GURL foo_url(embedded_test_server()->GetURL(
1230 "foo.com", "/navigation_controller/simple_page_2.html")); 1270 "foo.com", "/navigation_controller/simple_page_2.html"));
1231 { 1271 {
1232 LoadCommittedCapturer capturer(root->child_at(1)); 1272 LoadCommittedCapturer capturer(root->child_at(1));
1233 std::string script = "var frames = document.getElementsByTagName('iframe');" 1273 std::string script = "var frames = document.getElementsByTagName('iframe');"
1234 "frames[1].src = '" + foo_url.spec() + "';"; 1274 "frames[1].src = '" + foo_url.spec() + "';";
1235 EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script)); 1275 EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script));
1236 capturer.Wait(); 1276 capturer.Wait();
1237 EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type()); 1277 EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type());
1238 } 1278 }
1239 1279
1240 // Check last committed NavigationEntry. 1280 // Check last committed NavigationEntry.
1241 EXPECT_EQ(1, controller.GetEntryCount()); 1281 EXPECT_EQ(1, controller.GetEntryCount());
1242 EXPECT_EQ(entry, controller.GetLastCommittedEntry()); 1282 EXPECT_EQ(entry, controller.GetLastCommittedEntry());
1243 1283
1244 // Verify subframe entries if we're in --site-per-process mode. 1284 // Verify subframe entries if we're in --site-per-process mode.
1245 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1285 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1246 switches::kSitePerProcess)) { 1286 switches::kSitePerProcess)) {
1247 // The entry should now have two subframe FrameNavigationEntries. 1287 // The entry should still have two subframe FrameNavigationEntries.
1248 ASSERT_EQ(2U, entry->root_node()->children.size()); 1288 ASSERT_EQ(2U, entry->root_node()->children.size());
1249 FrameNavigationEntry* frame_entry = 1289 FrameNavigationEntry* frame_entry =
1250 entry->root_node()->children[1]->frame_entry.get(); 1290 entry->root_node()->children[1]->frame_entry.get();
1251 EXPECT_EQ(foo_url, frame_entry->url()); 1291 EXPECT_EQ(foo_url, frame_entry->url());
1252 EXPECT_TRUE(controller.HasCommittedRealLoad(root->child_at(1)));
1253 } else { 1292 } else {
1254 // There are no subframe FrameNavigationEntries by default. 1293 // There are no subframe FrameNavigationEntries by default.
1255 EXPECT_EQ(0U, entry->root_node()->children.size()); 1294 EXPECT_EQ(0U, entry->root_node()->children.size());
1256 } 1295 }
1296 EXPECT_FALSE(root->child_at(0)->has_committed_real_load());
1297 EXPECT_TRUE(root->child_at(0)->child_at(0)->has_committed_real_load());
1298 EXPECT_TRUE(root->child_at(1)->has_committed_real_load());
1299
1300 // 5. A new navigation to about:blank in the nested frame should count as a
1301 // real load, since that frame has already committed a real load and this is
1302 // not the initial blank page.
1303 {
1304 LoadCommittedCapturer capturer(root->child_at(0)->child_at(0));
1305 std::string script = "var frames = document.getElementsByTagName('iframe');"
1306 "frames[0].src = 'about:blank';";
1307 EXPECT_TRUE(content::ExecuteScript(root->child_at(0)->current_frame_host(),
1308 script));
1309 capturer.Wait();
1310 EXPECT_EQ(ui::PAGE_TRANSITION_MANUAL_SUBFRAME, capturer.transition_type());
1311 }
1312
1313 // This should have created a new NavigationEntry.
1314 EXPECT_EQ(2, controller.GetEntryCount());
1315 EXPECT_NE(entry, controller.GetLastCommittedEntry());
1316 NavigationEntryImpl* entry2 = controller.GetLastCommittedEntry();
1317
1318 // Verify subframe entries if we're in --site-per-process mode.
1319 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1320 switches::kSitePerProcess)) {
1321 ASSERT_EQ(2U, entry->root_node()->children.size());
1322 FrameNavigationEntry* frame_entry =
1323 entry2->root_node()->children[0]->children[0]->frame_entry.get();
1324 EXPECT_EQ(about_blank_url, frame_entry->url());
1325 } else {
1326 // There are no subframe FrameNavigationEntries by default.
1327 EXPECT_EQ(0U, entry->root_node()->children.size());
1328 }
1329 EXPECT_FALSE(root->child_at(0)->has_committed_real_load());
1330 EXPECT_TRUE(root->child_at(0)->child_at(0)->has_committed_real_load());
1331 EXPECT_TRUE(root->child_at(1)->has_committed_real_load());
1257 1332
1258 // Check the end result of the frame tree. 1333 // Check the end result of the frame tree.
1259 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1334 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1260 switches::kSitePerProcess)) { 1335 switches::kSitePerProcess)) {
1261 FrameTreeVisualizer visualizer; 1336 FrameTreeVisualizer visualizer;
1262 EXPECT_EQ( 1337 EXPECT_EQ(
1263 " Site A ------------ proxies for B\n" 1338 " Site A ------------ proxies for B\n"
1264 " |--Site A ------- proxies for B\n" 1339 " |--Site A ------- proxies for B\n"
1340 " | +--Site A -- proxies for B\n"
1265 " +--Site B ------- proxies for A\n" 1341 " +--Site B ------- proxies for A\n"
1266 "Where A = http://127.0.0.1/\n" 1342 "Where A = http://127.0.0.1/\n"
1267 " B = http://foo.com/", 1343 " B = http://foo.com/",
1268 visualizer.DepictFrameTree(root)); 1344 visualizer.DepictFrameTree(root));
1269 } 1345 }
1270 } 1346 }
1271 1347
1272 // Verify the tree of FrameNavigationEntries after NAVIGATION_TYPE_AUTO_SUBFRAME 1348 // Verify the tree of FrameNavigationEntries after NAVIGATION_TYPE_AUTO_SUBFRAME
1273 // commits. 1349 // commits.
1274 // TODO(creis): Test updating entries for history auto subframe navigations. 1350 // TODO(creis): Test updating entries for history auto subframe navigations.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 EXPECT_FALSE(controller.GetPendingEntry()); 1382 EXPECT_FALSE(controller.GetPendingEntry());
1307 1383
1308 // Verify subframe entries if we're in --site-per-process mode. 1384 // Verify subframe entries if we're in --site-per-process mode.
1309 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1385 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1310 switches::kSitePerProcess)) { 1386 switches::kSitePerProcess)) {
1311 // The entry should now have a subframe FrameNavigationEntry. 1387 // The entry should now have a subframe FrameNavigationEntry.
1312 ASSERT_EQ(1U, entry->root_node()->children.size()); 1388 ASSERT_EQ(1U, entry->root_node()->children.size());
1313 FrameNavigationEntry* frame_entry = 1389 FrameNavigationEntry* frame_entry =
1314 entry->root_node()->children[0]->frame_entry.get(); 1390 entry->root_node()->children[0]->frame_entry.get();
1315 EXPECT_EQ(frame_url, frame_entry->url()); 1391 EXPECT_EQ(frame_url, frame_entry->url());
1316 EXPECT_TRUE(controller.HasCommittedRealLoad(root->child_at(0))); 1392 EXPECT_TRUE(root->child_at(0)->has_committed_real_load());
1317 } else { 1393 } else {
1318 // There are no subframe FrameNavigationEntries by default. 1394 // There are no subframe FrameNavigationEntries by default.
1319 EXPECT_EQ(0U, entry->root_node()->children.size()); 1395 EXPECT_EQ(0U, entry->root_node()->children.size());
1320 } 1396 }
1321 1397
1322 // 2. Create a second, initially cross-site iframe. 1398 // 2. Create a second, initially cross-site iframe.
1323 GURL foo_url(embedded_test_server()->GetURL( 1399 GURL foo_url(embedded_test_server()->GetURL(
1324 "foo.com", "/navigation_controller/simple_page_1.html")); 1400 "foo.com", "/navigation_controller/simple_page_1.html"));
1325 { 1401 {
1326 LoadCommittedCapturer capturer(shell()->web_contents()); 1402 LoadCommittedCapturer capturer(shell()->web_contents());
(...skipping 14 matching lines...) Expand all
1341 EXPECT_FALSE(controller.GetPendingEntry()); 1417 EXPECT_FALSE(controller.GetPendingEntry());
1342 1418
1343 // Verify subframe entries if we're in --site-per-process mode. 1419 // Verify subframe entries if we're in --site-per-process mode.
1344 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1420 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1345 switches::kSitePerProcess)) { 1421 switches::kSitePerProcess)) {
1346 // The entry should now have 2 subframe FrameNavigationEntries. 1422 // The entry should now have 2 subframe FrameNavigationEntries.
1347 ASSERT_EQ(2U, entry->root_node()->children.size()); 1423 ASSERT_EQ(2U, entry->root_node()->children.size());
1348 FrameNavigationEntry* frame_entry = 1424 FrameNavigationEntry* frame_entry =
1349 entry->root_node()->children[1]->frame_entry.get(); 1425 entry->root_node()->children[1]->frame_entry.get();
1350 EXPECT_EQ(foo_url, frame_entry->url()); 1426 EXPECT_EQ(foo_url, frame_entry->url());
1351 EXPECT_TRUE(controller.HasCommittedRealLoad(root->child_at(1))); 1427 EXPECT_TRUE(root->child_at(1)->has_committed_real_load());
1352 } else { 1428 } else {
1353 // There are no subframe FrameNavigationEntries by default. 1429 // There are no subframe FrameNavigationEntries by default.
1354 EXPECT_EQ(0U, entry->root_node()->children.size()); 1430 EXPECT_EQ(0U, entry->root_node()->children.size());
1355 } 1431 }
1356 1432
1357 // 3. Create a nested iframe in the second subframe. 1433 // 3. Create a nested iframe in the second subframe.
1358 { 1434 {
1359 LoadCommittedCapturer capturer(shell()->web_contents()); 1435 LoadCommittedCapturer capturer(shell()->web_contents());
1360 std::string script = "var iframe = document.createElement('iframe');" 1436 std::string script = "var iframe = document.createElement('iframe');"
1361 "iframe.src = '" + foo_url.spec() + "';" 1437 "iframe.src = '" + foo_url.spec() + "';"
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 EXPECT_EQ(original_url, capturer.all_params()[1].url); 2360 EXPECT_EQ(original_url, capturer.all_params()[1].url);
2285 EXPECT_EQ(original_url, shell()->web_contents()->GetLastCommittedURL()); 2361 EXPECT_EQ(original_url, shell()->web_contents()->GetLastCommittedURL());
2286 } 2362 }
2287 2363
2288 // Make sure the renderer is still alive. 2364 // Make sure the renderer is still alive.
2289 EXPECT_TRUE( 2365 EXPECT_TRUE(
2290 ExecuteScript(shell()->web_contents(), "console.log('Success');")); 2366 ExecuteScript(shell()->web_contents(), "console.log('Success');"));
2291 } 2367 }
2292 2368
2293 } // namespace content 2369 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl.cc ('k') | content/browser/frame_host/navigation_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698