Index: content/browser/site_per_process_browsertest.cc |
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc |
index 92628471cf7048d46e46597fc0340557251288f1..54cd82043ce6e1f1ddd1207ef3eabdde9fe39190 100644 |
--- a/content/browser/site_per_process_browsertest.cc |
+++ b/content/browser/site_per_process_browsertest.cc |
@@ -41,6 +41,7 @@ |
#include "content/common/renderer.mojom.h" |
#include "content/common/view_messages.h" |
#include "content/public/browser/interstitial_page_delegate.h" |
+#include "content/public/browser/navigation_handle.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_service.h" |
#include "content/public/browser/notification_types.h" |
@@ -8346,4 +8347,33 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
transfer_manager.WaitForNavigationFinished(); |
} |
+class NavigatigationHandleWatcher : public WebContentsObserver { |
+ public: |
+ NavigatigationHandleWatcher(WebContents* web_contents) |
+ : WebContentsObserver(web_contents) {} |
+ void DidStartNavigation(NavigationHandle* navigation_handle) override { |
+ DCHECK_EQ("http://b.com/", |
+ navigation_handle->GetCreatorSiteInstance()->GetSiteURL().spec()); |
+ } |
+}; |
+ |
+// Verifies that the site instance of a navigation handle correctly identifies |
alexmos
2016/10/12 23:13:28
nit: s/site instance/SiteInstance/, s/navigation h
jam
2016/10/13 00:14:46
Done.
|
+// the RenderFrameHost that started the navigation (and not the destination |
+// RFH). |
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigationHandleSiteIntance) { |
alexmos
2016/10/12 23:13:28
nit: s/Intance/Instance/
jam
2016/10/13 00:14:46
Done.
|
+ // Navigate to a page with a cross-site iframe. |
+ GURL main_url(embedded_test_server()->GetURL( |
+ "a.com", "/cross_site_iframe_factory.html?a(b)")); |
+ EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
+ |
+ // Navigate the iframe cross-site. |
+ NavigatigationHandleWatcher watcher(shell()->web_contents()); |
+ TestNavigationObserver load_observer(shell()->web_contents()); |
+ GURL frame_url = embedded_test_server()->GetURL("c.com", "/title1.html"); |
+ EXPECT_TRUE(ExecuteScript( |
+ shell()->web_contents(), |
+ "window.frames[0].location = \"" + frame_url.spec() + "\";")); |
+ load_observer.Wait(); |
+} |
+ |
} // namespace content |