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

Side by Side Diff: chrome/browser/chrome_site_per_process_browsertest.cc

Issue 2410303006: Avoiding going through RenderFrameProxy when targeting a *new* frame. (Closed)
Patch Set: s/shift/ctrl/ in a "comment" in the test html file. 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/frame_tree/anchor_targeting_remote_frame.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 main_lost_focus = true; 242 main_lost_focus = true;
243 if (status == "\"popup-got-focus\"") 243 if (status == "\"popup-got-focus\"")
244 popup_got_focus = true; 244 popup_got_focus = true;
245 if (main_lost_focus && popup_got_focus) 245 if (main_lost_focus && popup_got_focus)
246 break; 246 break;
247 } 247 }
248 248
249 // The popup should be focused now. 249 // The popup should be focused now.
250 EXPECT_EQ(popup, browser()->tab_strip_model()->GetActiveWebContents()); 250 EXPECT_EQ(popup, browser()->tab_strip_model()->GetActiveWebContents());
251 } 251 }
252
253 // Verify that ctrl-click of an anchor targeting a remote frame works (i.e. that
254 // it opens the link in a new tab). See also https://crbug.com/647772.
255 IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
256 AnchorCtrlClickWhenTargetIsCrossSite) {
257 // Navigate to anchor_targeting_remote_frame.html.
258 GURL main_url(embedded_test_server()->GetURL(
259 "a.com", "/frame_tree/anchor_targeting_remote_frame.html"));
260 ui_test_utils::NavigateToURL(browser(), main_url);
261
262 // Verify that there is only 1 active tab (with the right contents committed).
263 EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
264 content::WebContents* main_contents =
265 browser()->tab_strip_model()->GetWebContentsAt(0);
266 EXPECT_EQ(main_url, main_contents->GetLastCommittedURL());
267
268 // Ctrl-click the anchor/link in the page.
269 content::WebContentsAddedObserver new_tab_observer;
270 #if defined(OS_MACOSX)
271 std::string new_tab_click_script = "simulateClick({ metaKey: true });";
272 #else
273 std::string new_tab_click_script = "simulateClick({ ctrlKey: true });";
274 #endif
275 EXPECT_TRUE(ExecuteScript(main_contents, new_tab_click_script));
276
277 // Wait for a new tab to appear (the whole point of this test).
278 content::WebContents* new_contents = new_tab_observer.GetWebContents();
279
280 // Verify that the new tab has the right contents and is in the right, new
281 // place in the tab strip.
282 EXPECT_TRUE(WaitForLoadStop(new_contents));
283 EXPECT_EQ(2, browser()->tab_strip_model()->count());
284 EXPECT_EQ(new_contents, browser()->tab_strip_model()->GetWebContentsAt(1));
285 GURL expected_url(embedded_test_server()->GetURL("c.com", "/title1.html"));
286 EXPECT_EQ(expected_url, new_contents->GetLastCommittedURL());
287 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/frame_tree/anchor_targeting_remote_frame.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698