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

Unified Diff: content/browser/renderer_host/render_view_host_browsertest.cc

Issue 7497058: New windows opened in javascript with target = "_blank" should (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: removed unnecessary #include Created 9 years, 4 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
« no previous file with comments | « chrome/test/data/window.open.blank.html ('k') | content/renderer/render_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_view_host_browsertest.cc
diff --git a/content/browser/renderer_host/render_view_host_browsertest.cc b/content/browser/renderer_host/render_view_host_browsertest.cc
index fa2c9e6dafdabf621ee1138fac665a1600c02c7b..89e30ef64efc918fca184584b9680da55ae26ed7 100644
--- a/content/browser/renderer_host/render_view_host_browsertest.cc
+++ b/content/browser/renderer_host/render_view_host_browsertest.cc
@@ -50,7 +50,9 @@ class ExecuteNotificationObserver : public NotificationObserver {
class RenderViewHostTest : public InProcessBrowserTest {
public:
- RenderViewHostTest() : last_execute_id_(0) {}
+ RenderViewHostTest() : last_execute_id_(0) {
+ EnableDOMAutomation();
+ }
void ExecuteJavascriptAndGetValue(const char* script,
ExecuteNotificationObserver* out_result) {
@@ -71,6 +73,17 @@ class RenderViewHostTest : public InProcessBrowserTest {
last_execute_id_ = execute_id;
}
+ protected:
+ bool GetCreatedWindowName(const GURL& url,
+ const wchar_t* function,
+ std::string* window_name) {
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ return ui_test_utils::ExecuteJavaScriptAndExtractString(
+ browser()->GetSelectedTabContents()->render_view_host(),
+ L"", function, window_name);
+ }
+
private:
int last_execute_id_;
};
@@ -235,7 +248,7 @@ class RenderViewHostTestTabContentsObserver : public TabContentsObserver {
IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) {
ASSERT_TRUE(test_server()->Start());
RenderViewHostTestTabContentsObserver observer(
- browser()->GetSelectedTabContents());
+ browser()->GetSelectedTabContents());
GURL test_url = test_server()->GetURL("files/simple.html");
ui_test_utils::NavigateToURL(browser(), test_url);
@@ -244,3 +257,25 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) {
observer.observed_socket_address().ToString());
EXPECT_EQ(1, observer.navigation_count());
}
+
+// Regression test for http://crbug.com/88129
+IN_PROC_BROWSER_TEST_F(RenderViewHostTest, WindowOpen1) {
+ ASSERT_TRUE(test_server()->Start());
+
+ GURL url(test_server()->GetURL("files/window.open.blank.html"));
+ std::string window_name;
+ ASSERT_TRUE(GetCreatedWindowName(url, L"openWindow1();", &window_name));
+
+ EXPECT_EQ(window_name, "blank") << "Actual Window Name: " << window_name;
+}
+
+// Regression test for http://crbug.com/88129
+IN_PROC_BROWSER_TEST_F(RenderViewHostTest, WindowOpen2) {
+ ASSERT_TRUE(test_server()->Start());
+
+ GURL url(test_server()->GetURL("files/window.open.blank.html"));
+ std::string window_name;
+ ASSERT_TRUE(GetCreatedWindowName(url, L"openWindow2();", &window_name));
+
+ EXPECT_EQ(window_name, "") << "Actual Window Name: " << window_name;
+}
« no previous file with comments | « chrome/test/data/window.open.blank.html ('k') | content/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698