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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 1960703003: Take session history SiteInstance into account for unique origin navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 (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 "content/browser/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 6262 matching lines...) Expand 10 before | Expand all | Expand 10 after
6273 6273
6274 EXPECT_TRUE(observer.WasUserInteractionReceived()); 6274 EXPECT_TRUE(observer.WasUserInteractionReceived());
6275 6275
6276 // Target an event to the main frame. 6276 // Target an event to the main frame.
6277 observer.Reset(); 6277 observer.Reset();
6278 SimulateMouseClick(root->current_frame_host()->GetRenderWidgetHost(), 1, 1); 6278 SimulateMouseClick(root->current_frame_host()->GetRenderWidgetHost(), 1, 1);
6279 6279
6280 EXPECT_TRUE(observer.WasUserInteractionReceived()); 6280 EXPECT_TRUE(observer.WasUserInteractionReceived());
6281 } 6281 }
6282 6282
6283 // Ensures that navigating to data: URLs present in session history will
6284 // correctly commit the navigation in the same process as the parent frame.
6285 // See https://crbug.com/606996.
6286 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
6287 NavigateSubframeToDataUrlInSessionHistory) {
6288 GURL main_url(embedded_test_server()->GetURL(
6289 "a.com", "/cross_site_iframe_factory.html?a(b,b)"));
6290 GURL about_blank_url("about:blank");
Charlie Reis 2016/05/09 17:05:10 Looks unused.
nasko 2016/05/09 18:33:15 I wonder why clang didn't complain.
6291 EXPECT_TRUE(NavigateToURL(shell(), main_url));
6292
6293 FrameTreeNode* root = web_contents()->GetFrameTree()->root();
6294 EXPECT_EQ(2U, root->child_count());
6295 EXPECT_EQ(
6296 " Site A ------------ proxies for B\n"
6297 " |--Site B ------- proxies for A\n"
6298 " +--Site B ------- proxies for A\n"
6299 "Where A = http://a.com/\n"
6300 " B = http://b.com/",
6301 DepictFrameTree(root));
6302
6303 TestNavigationObserver observer(shell()->web_contents());
6304 FrameTreeNode* child = root->child_at(0);
6305
6306 // Navigate iframe to a data URL, which will commit in a new SiteInstance.
6307 GURL data_url("data:text/html,dataurl");
6308 NavigateFrameToURL(child, data_url);
6309 EXPECT_TRUE(observer.last_navigation_succeeded());
6310 EXPECT_EQ(data_url, observer.last_navigation_url());
6311 SiteInstanceImpl* orig_site_instance =
Charlie Reis 2016/05/09 17:05:10 scoped_refptr
nasko 2016/05/09 18:33:15 Done.
6312 child->current_frame_host()->GetSiteInstance();
6313 EXPECT_NE(orig_site_instance, root->current_frame_host()->GetSiteInstance());
Charlie Reis 2016/05/09 17:05:10 nit: Reverse order. (orig_site_instance is the ac
nasko 2016/05/09 18:33:15 Done.
6314
6315 // Navigate it to another cross-site url.
6316 GURL cross_site_url(embedded_test_server()->GetURL("c.com", "/title1.html"));
6317 NavigateFrameToURL(child, cross_site_url);
6318 EXPECT_TRUE(observer.last_navigation_succeeded());
6319 EXPECT_EQ(cross_site_url, observer.last_navigation_url());
6320 EXPECT_EQ(3, web_contents()->GetController().GetEntryCount());
6321 EXPECT_NE(orig_site_instance, child->current_frame_host()->GetSiteInstance());
6322
6323 // Go back and ensure the data: URL committed in the same SiteInstance as the
6324 // original navigation.
6325 EXPECT_TRUE(web_contents()->GetController().CanGoBack());
6326 TestFrameNavigationObserver frame_observer(child);
6327 web_contents()->GetController().GoBack();
6328 frame_observer.WaitForCommit();
6329 EXPECT_EQ(orig_site_instance, child->current_frame_host()->GetSiteInstance());
6330 }
6331
6283 } // namespace content 6332 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698