| OLD | NEW |
| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 browser()->tab_strip_model()->GetActiveWebContents(); | 336 browser()->tab_strip_model()->GetActiveWebContents(); |
| 337 GURL frame_url = | 337 GURL frame_url = |
| 338 embedded_test_server()->GetURL("b.com", "/page_with_embedded_pdf.html"); | 338 embedded_test_server()->GetURL("b.com", "/page_with_embedded_pdf.html"); |
| 339 | 339 |
| 340 // Ensure the page finishes loading without crashing. | 340 // Ensure the page finishes loading without crashing. |
| 341 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", frame_url)); | 341 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", frame_url)); |
| 342 | 342 |
| 343 // Wait until the guest for PDF is created. | 343 // Wait until the guest for PDF is created. |
| 344 test_guest_view_manager()->WaitForSingleGuestCreated(); | 344 test_guest_view_manager()->WaitForSingleGuestCreated(); |
| 345 } | 345 } |
| 346 |
| 347 // Verify that a popup can be opened after navigating a remote frame. This has |
| 348 // to be a chrome/ test to ensure that the popup blocker doesn't block the |
| 349 // popup. See https://crbug.com/670770. |
| 350 IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, |
| 351 NavigateRemoteFrameAndOpenPopup) { |
| 352 // Start on a page with an <iframe>. |
| 353 GURL main_url(embedded_test_server()->GetURL("a.com", "/iframe.html")); |
| 354 ui_test_utils::NavigateToURL(browser(), main_url); |
| 355 |
| 356 // Navigate the iframe cross-site. |
| 357 content::WebContents* active_web_contents = |
| 358 browser()->tab_strip_model()->GetActiveWebContents(); |
| 359 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
| 360 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", frame_url)); |
| 361 |
| 362 // Run a script in the parent frame to (1) navigate iframe to another URL, |
| 363 // and (2) open a popup. Note that ExecuteScript will run this with a user |
| 364 // gesture, so both steps should succeed. |
| 365 frame_url = embedded_test_server()->GetURL("c.com", "/title1.html"); |
| 366 content::WindowedNotificationObserver popup_observer( |
| 367 chrome::NOTIFICATION_TAB_ADDED, |
| 368 content::NotificationService::AllSources()); |
| 369 bool popup_handle_is_valid = false; |
| 370 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| 371 active_web_contents, |
| 372 "document.querySelector('iframe').src = '" + frame_url.spec() + "';\n" |
| 373 "var w = window.open('about:blank');\n" |
| 374 "window.domAutomationController.send(!!w);\n", |
| 375 &popup_handle_is_valid)); |
| 376 popup_observer.Wait(); |
| 377 |
| 378 // The popup shouldn't be blocked. |
| 379 EXPECT_TRUE(popup_handle_is_valid); |
| 380 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
| 381 } |
| OLD | NEW |