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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2411693003: Move blocking of top-level navigations to nested URLs with extension origins from non-extension pro… (Closed)
Patch Set: review nits Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.cc ('k') | content/public/browser/navigation_handle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0325fcccd8abb2372db3d09b18148368d6b4805a 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 NavigationHandleWatcher : public WebContentsObserver {
+ public:
+ NavigationHandleWatcher(WebContents* web_contents)
+ : WebContentsObserver(web_contents) {}
+ void DidStartNavigation(NavigationHandle* navigation_handle) override {
+ DCHECK_EQ(GURL("http://b.com/"),
+ navigation_handle->GetStartingSiteInstance()->GetSiteURL());
+ }
+};
+
+// Verifies that the SiteInstance of a NavigationHandle correctly identifies the
+// RenderFrameHost that started the navigation (and not the destination RFH).
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
+ NavigationHandleSiteInstance) {
+ // 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.
+ NavigationHandleWatcher 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
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.cc ('k') | content/public/browser/navigation_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698