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

Unified Diff: content/browser/frame_host/render_frame_host_manager_browsertest.cc

Issue 1224363002: OOPIF: Fix window.open to work from frames with remote parent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move OpenPopup to content_browser_test_utils_internal.cc, add back two is_active_ checks. Created 5 years, 5 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/frame_host/render_frame_host_manager_browsertest.cc
diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
index f626fc7ee6d95bbc10ec8d7795e836adee7a9fe2..9adba43d82d5ba38d4336f3ba8b4330e83473105 100644
--- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc
+++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -37,6 +37,7 @@
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
+#include "content/test/content_browser_test_utils_internal.h"
#include "net/base/net_util.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
@@ -64,19 +65,6 @@ void OpenUrlViaClickTarget(const internal::ToRenderFrameHost& adapter,
std::string(kOpenUrlViaClickTargetFunc) + "(\"" + url.spec() + "\");"));
}
-Shell* OpenPopup(const internal::ToRenderFrameHost& opener,
- const std::string& name) {
- ShellAddedObserver new_shell_observer;
- bool success = false;
- EXPECT_TRUE(ExecuteScriptAndExtractBool(
- opener,
- "window.domAutomationController.send(!!window.open('', '" + name + "'));",
- &success));
- EXPECT_TRUE(success);
- Shell* new_shell = new_shell_observer.GetShell();
- return new_shell;
-}
-
} // anonymous namespace
class RenderFrameHostManagerTest : public ContentBrowserTest {
@@ -578,7 +566,9 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
EXPECT_TRUE(orig_site_instance.get() != NULL);
// Open a popup using window.open with a 'foo' window.name.
- Shell* new_shell = OpenPopup(shell()->web_contents(), "foo");
+ Shell* new_shell =
+ OpenPopup(shell()->web_contents(), GURL("about:blank"), "foo");
Charlie Reis 2015/07/11 00:12:08 url::kAboutBlankURL (here and below)
+ EXPECT_TRUE(new_shell);
// The window.name for the new popup should be "foo".
std::string name;
@@ -602,7 +592,9 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
EXPECT_EQ("foo", name);
// Open another popup from the 'foo' popup and navigate it cross-site.
- Shell* new_shell2 = OpenPopup(new_shell->web_contents(), "bar");
+ Shell* new_shell2 =
+ OpenPopup(new_shell->web_contents(), GURL("about:blank"), "bar");
+ EXPECT_TRUE(new_shell2);
GURL bar_url(embedded_test_server()->GetURL("bar.com", "/title3.html"));
EXPECT_TRUE(NavigateToURL(new_shell2, bar_url));
@@ -1900,7 +1892,9 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
EXPECT_TRUE(orig_site_instance);
// Open a popup and navigate it cross-site.
- Shell* new_shell = OpenPopup(shell()->web_contents(), "foo");
+ Shell* new_shell =
+ OpenPopup(shell()->web_contents(), GURL("about:blank"), "foo");
+ EXPECT_TRUE(new_shell);
FrameTreeNode* popup_root =
static_cast<WebContentsImpl*>(new_shell->web_contents())
->GetFrameTree()
« no previous file with comments | « content/browser/frame_host/interstitial_page_impl.cc ('k') | content/browser/renderer_host/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698