Chromium Code Reviews| 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "content/common/content_constants_internal.h" | 10 #include "content/common/content_constants_internal.h" |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1291 EXPECT_EQ(subtree->GetSize(), 3U); | 1291 EXPECT_EQ(subtree->GetSize(), 3U); |
| 1292 | 1292 |
| 1293 EXPECT_TRUE(CompareTrees( | 1293 EXPECT_TRUE(CompareTrees( |
| 1294 GetTree(opener_rvhm->current_host()), | 1294 GetTree(opener_rvhm->current_host()), |
| 1295 GetTree(opener_rvhm->GetSwappedOutRenderViewHost(site_instance1)))); | 1295 GetTree(opener_rvhm->GetSwappedOutRenderViewHost(site_instance1)))); |
| 1296 EXPECT_TRUE(CompareTrees( | 1296 EXPECT_TRUE(CompareTrees( |
| 1297 GetTree(opener_rvhm->current_host()), | 1297 GetTree(opener_rvhm->current_host()), |
| 1298 GetTree(opener_rvhm->GetSwappedOutRenderViewHost(site_instance2)))); | 1298 GetTree(opener_rvhm->GetSwappedOutRenderViewHost(site_instance2)))); |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 // Test for crbug.com/143155. Frame tree updates during unload should not | |
| 1302 // interrupt the intended navigation and show swappedout:// instead. | |
| 1303 // Specifically: | |
| 1304 // 1) Open 2 tabs in the same process, with a frame in the opener. | |
|
nasko
2012/09/20 22:18:04
nit: Should we say "iframe" or "subframe"? We got
Charlie Reis
2012/09/20 23:25:38
Done.
| |
| 1305 // 2) Send the second tab to a different process. | |
| 1306 // This creates a swapped out opener in the first tab. | |
|
nasko
2012/09/20 22:18:04
nit: Technically in the "first tab's process."
Charlie Reis
2012/09/20 23:25:38
No, that's backwards. The swapped out RenderView
| |
| 1307 // 3) Navigate the first tab to the second tab's process, and have the first | |
| 1308 // tab's unload handler remove its frame. | |
| 1309 // This used to cause an update to the frame tree of the swapped out RV, | |
| 1310 // just as it was navigating to a real page. | |
|
nasko
2012/09/20 22:18:04
It might be worthwhile pointing out that the end r
Charlie Reis
2012/09/20 23:25:38
Done.
| |
| 1311 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | |
| 1312 DontPreemptNavigationWithFrameTreeUpdate) { | |
| 1313 // Start two servers with different sites. | |
| 1314 ASSERT_TRUE(test_server()->Start()); | |
| 1315 net::TestServer https_server( | |
| 1316 net::TestServer::TYPE_HTTPS, | |
| 1317 net::TestServer::kLocalhost, | |
| 1318 FilePath(FILE_PATH_LITERAL("content/test/data"))); | |
| 1319 ASSERT_TRUE(https_server.Start()); | |
| 1320 | |
| 1321 // 1. Load a page that deletes its iframe during unload. | |
| 1322 NavigateToURL(shell(), | |
| 1323 test_server()->GetURL("files/remove_frame_on_unload.html")); | |
| 1324 | |
| 1325 // Get the original SiteInstance for later comparison. | |
| 1326 scoped_refptr<SiteInstance> orig_site_instance( | |
| 1327 shell()->web_contents()->GetSiteInstance()); | |
| 1328 | |
| 1329 // Open a same-site page in a new window. | |
| 1330 ShellAddedObserver new_shell_observer; | |
| 1331 bool success = false; | |
| 1332 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool( | |
| 1333 shell()->web_contents()->GetRenderViewHost(), L"", | |
| 1334 L"window.domAutomationController.send(openWindow());", | |
| 1335 &success)); | |
| 1336 EXPECT_TRUE(success); | |
| 1337 Shell* new_shell = new_shell_observer.GetShell(); | |
| 1338 | |
| 1339 // Wait for the navigation in the new window to finish, if it hasn't. | |
| 1340 WaitForLoadStop(new_shell->web_contents()); | |
| 1341 EXPECT_EQ("/files/title1.html", | |
| 1342 new_shell->web_contents()->GetURL().path()); | |
| 1343 | |
| 1344 // Should have the same SiteInstance. | |
| 1345 EXPECT_EQ(orig_site_instance, new_shell->web_contents()->GetSiteInstance()); | |
| 1346 | |
| 1347 // 2. Send the second tab to a different process. | |
| 1348 NavigateToURL(new_shell, https_server.GetURL("files/title1.html")); | |
| 1349 scoped_refptr<SiteInstance> new_site_instance( | |
| 1350 new_shell->web_contents()->GetSiteInstance()); | |
| 1351 EXPECT_NE(orig_site_instance, new_site_instance); | |
| 1352 | |
| 1353 // 3. Send the first tab to the second tab's process. | |
| 1354 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); | |
| 1355 | |
| 1356 // Make sure it ends up at the right page. | |
| 1357 WaitForLoadStop(shell()->web_contents()); | |
|
nasko
2012/09/20 22:18:04
Isn't this redundant with the NavigateToURL waitin
Charlie Reis
2012/09/20 23:25:38
That's what I thought, but the test doesn't fail (
| |
| 1358 EXPECT_EQ(https_server.GetURL("files/title1.html"), | |
| 1359 shell()->web_contents()->GetURL()); | |
| 1360 EXPECT_EQ(new_site_instance, shell()->web_contents()->GetSiteInstance()); | |
| 1361 } | |
| 1362 | |
| 1301 } // namespace content | 1363 } // namespace content |
| OLD | NEW |