Chromium Code Reviews| 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..a4b944aacbe085daf2ae1c30096b0d7579b8fc06 100644 |
| --- a/content/browser/renderer_host/render_view_host_browsertest.cc |
| +++ b/content/browser/renderer_host/render_view_host_browsertest.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/utf_string_conversions.h" |
| #include "base/values.h" |
| #include "chrome/browser/ui/browser.h" |
| +#include "chrome/common/chrome_notification_types.h" |
| #include "chrome/test/base/in_process_browser_test.h" |
| #include "chrome/test/base/ui_test_utils.h" |
| #include "content/browser/renderer_host/render_view_host.h" |
| @@ -50,7 +51,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 +74,25 @@ 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); |
| + |
| + ui_test_utils::WindowedNotificationObserver observer( |
| + chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| + NotificationService::AllSources()); |
| + |
| + if (!ui_test_utils::ExecuteJavaScriptAndExtractString( |
| + browser()->GetSelectedTabContents()->render_view_host(), |
| + L"", function, window_name)) |
| + return false; |
| + |
| + // observer.Wait(); |
|
darin (slow to review)
2011/08/29 17:33:41
why is this code commented out?
|
| + return true; |
| + } |
| + |
| private: |
| int last_execute_id_; |
| }; |
| @@ -244,3 +266,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; |
| +} |