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

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

Issue 2553783003: Don't consume user gesture in RenderFrameProxy::navigate. (Closed)
Patch Set: Rebase Created 4 years 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 | content/renderer/render_frame_proxy.cc » ('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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 test_guest_view_manager()->WaitForSingleGuestCreated(); 355 test_guest_view_manager()->WaitForSingleGuestCreated();
356 356
357 // Now detach the frame and observe that the guest is destroyed. 357 // Now detach the frame and observe that the guest is destroyed.
358 content::WebContentsDestroyedWatcher observer(guest_web_contents); 358 content::WebContentsDestroyedWatcher observer(guest_web_contents);
359 EXPECT_TRUE(ExecuteScript( 359 EXPECT_TRUE(ExecuteScript(
360 active_web_contents, 360 active_web_contents,
361 "document.body.removeChild(document.querySelector('iframe'));")); 361 "document.body.removeChild(document.querySelector('iframe'));"));
362 observer.Wait(); 362 observer.Wait();
363 EXPECT_EQ(0U, test_guest_view_manager()->GetNumGuestsActive()); 363 EXPECT_EQ(0U, test_guest_view_manager()->GetNumGuestsActive());
364 } 364 }
365
366 // Verify that a popup can be opened after navigating a remote frame. This has
367 // to be a chrome/ test to ensure that the popup blocker doesn't block the
368 // popup. See https://crbug.com/670770.
369 IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
370 NavigateRemoteFrameAndOpenPopup) {
371 // Start on a page with an <iframe>.
372 GURL main_url(embedded_test_server()->GetURL("a.com", "/iframe.html"));
373 ui_test_utils::NavigateToURL(browser(), main_url);
374
375 // Navigate the iframe cross-site.
376 content::WebContents* active_web_contents =
377 browser()->tab_strip_model()->GetActiveWebContents();
378 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html"));
379 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", frame_url));
380
381 // Run a script in the parent frame to (1) navigate iframe to another URL,
382 // and (2) open a popup. Note that ExecuteScript will run this with a user
383 // gesture, so both steps should succeed.
384 frame_url = embedded_test_server()->GetURL("c.com", "/title1.html");
385 content::WindowedNotificationObserver popup_observer(
386 chrome::NOTIFICATION_TAB_ADDED,
387 content::NotificationService::AllSources());
388 bool popup_handle_is_valid = false;
389 EXPECT_TRUE(ExecuteScriptAndExtractBool(
390 active_web_contents,
391 "document.querySelector('iframe').src = '" + frame_url.spec() + "';\n"
392 "var w = window.open('about:blank');\n"
393 "window.domAutomationController.send(!!w);\n",
394 &popup_handle_is_valid));
395 popup_observer.Wait();
396
397 // The popup shouldn't be blocked.
398 EXPECT_TRUE(popup_handle_is_valid);
399 ASSERT_EQ(2, browser()->tab_strip_model()->count());
400 }
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698