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

Side by Side 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 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/browser/frame_host/cross_process_frame_connector.h" 10 #include "content/browser/frame_host/cross_process_frame_connector.h"
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 params.transition_type = ui::PAGE_TRANSITION_LINK; 1311 params.transition_type = ui::PAGE_TRANSITION_LINK;
1312 params.frame_tree_node_id = child->frame_tree_node_id(); 1312 params.frame_tree_node_id = child->frame_tree_node_id();
1313 child->navigator()->GetController()->LoadURLWithParams(params); 1313 child->navigator()->GetController()->LoadURLWithParams(params);
1314 nav_observer.Wait(); 1314 nav_observer.Wait();
1315 1315
1316 // Verify that the navigation succeeded and the expected URL was loaded. 1316 // Verify that the navigation succeeded and the expected URL was loaded.
1317 EXPECT_TRUE(observer.last_navigation_succeeded()); 1317 EXPECT_TRUE(observer.last_navigation_succeeded());
1318 EXPECT_EQ(url, observer.last_navigation_url()); 1318 EXPECT_EQ(url, observer.last_navigation_url());
1319 } 1319 }
1320 1320
1321 // Verify that load events for iframe elements work when the child frame is
1322 // out-of-process. In such cases, the load event is forwarded from the child
1323 // frame to the parent frame via the browser process.
1324 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, LoadEventForwarding) {
1325 // Load a page with a cross-site frame. The parent page has an onload
1326 // handler in the iframe element that appends "LOADED" to the document title.
1327 {
1328 GURL main_url(
1329 embedded_test_server()->GetURL("/frame_with_load_event.html"));
1330 base::string16 expected_title(base::UTF8ToUTF16("LOADED"));
1331 TitleWatcher title_watcher(shell()->web_contents(), expected_title);
1332 EXPECT_TRUE(NavigateToURL(shell(), main_url));
1333 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title);
1334 }
1335
1336 // It is safe to obtain the root frame tree node here, as it doesn't change.
1337 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
1338 ->GetFrameTree()
1339 ->root();
1340
1341 // Load another cross-site page into the iframe and check that the load event
1342 // is fired.
1343 {
1344 GURL foo_url(embedded_test_server()->GetURL("foo.com", "/title1.html"));
1345 base::string16 expected_title(base::UTF8ToUTF16("LOADEDLOADED"));
1346 TitleWatcher title_watcher(shell()->web_contents(), expected_title);
1347 TestNavigationObserver observer(shell()->web_contents());
1348 NavigateFrameToURL(root->child_at(0), foo_url);
1349 EXPECT_TRUE(observer.last_navigation_succeeded());
1350 EXPECT_EQ(foo_url, observer.last_navigation_url());
1351 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title);
1352 }
1353 }
1354
1321 } // namespace content 1355 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698