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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 954793002: Make load events in iframe elements work with OOPIF (Chromium side). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename DispatchFrameOwnerLoadEvent to DispatchLoadEventForFrameOwner Created 5 years, 10 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
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 9c9c0f2f05c6805d133c20fe6a0a725a15077d01..2b692fbf6e02a0ab3e21143c3bfe1ca931a3478f 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -1318,4 +1318,38 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteDidStopLoading) {
EXPECT_EQ(url, observer.last_navigation_url());
}
+// Verify that load events for iframe elements work when the child frame is
+// out-of-process. In such cases, the load event is forwarded from the child
+// frame to the parent frame via the browser process.
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, LoadEventForwarding) {
+ // Load a page with a cross-site frame. The parent page has an onload
+ // handler in the iframe element that appends "LOADED" to the document title.
+ {
+ GURL main_url(
+ embedded_test_server()->GetURL("/frame_with_load_event.html"));
+ base::string16 expected_title(base::UTF8ToUTF16("LOADED"));
+ TitleWatcher title_watcher(shell()->web_contents(), expected_title);
+ EXPECT_TRUE(NavigateToURL(shell(), main_url));
+ EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title);
+ }
+
+ // It is safe to obtain the root frame tree node here, as it doesn't change.
+ FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
+ ->GetFrameTree()
+ ->root();
+
+ // Load another cross-site page into the iframe and check that the load event
+ // is fired.
+ {
+ GURL foo_url(embedded_test_server()->GetURL("foo.com", "/title1.html"));
+ base::string16 expected_title(base::UTF8ToUTF16("LOADEDLOADED"));
+ TitleWatcher title_watcher(shell()->web_contents(), expected_title);
+ TestNavigationObserver observer(shell()->web_contents());
+ NavigateFrameToURL(root->child_at(0), foo_url);
+ EXPECT_TRUE(observer.last_navigation_succeeded());
+ EXPECT_EQ(foo_url, observer.last_navigation_url());
+ EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title);
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698