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

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

Issue 7080049: Tests for bug 5988. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: removed debugging output... Created 9 years, 6 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/dynamic2.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/resource_dispatcher_host_browsertest.cc
diff --git a/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc b/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7845777db50255fab7a1e2664e217def2c57e7cc
--- /dev/null
+++ b/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc
@@ -0,0 +1,72 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list.h"
+#include "chrome/test/in_process_browser_test.h"
+#include "chrome/test/ui_test_utils.h"
+#include "content/common/notification_type.h"
+#include "content/browser/tab_contents/tab_contents.h"
+#include "net/test/test_server.h"
+
+class ResourceDispatcherHostBrowserTest : public InProcessBrowserTest {
+ public:
+ ResourceDispatcherHostBrowserTest() {
+ EnableDOMAutomation();
+ }
+
+ protected:
+ RenderViewHost* render_view_host() {
+ return browser()->GetSelectedTabContents()->render_view_host();
+ }
+
+ string16 GetPopupTitle(GURL url);
+};
+
+string16 ResourceDispatcherHostBrowserTest::GetPopupTitle(GURL url) {
Paweł Hajdan Jr. 2011/06/07 08:28:55 nit: Why not const GURL& url?
shinyak (Google) 2011/06/07 08:54:14 Done.
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ ui_test_utils::WindowedNotificationObserver observer(
+ NotificationType::BROWSER_WINDOW_READY,
+ NotificationService::AllSources());
+
+ // Create dynamic popup.
+ EXPECT_TRUE(ui_test_utils::ExecuteJavaScript(
Paweł Hajdan Jr. 2011/06/07 08:28:55 When this fails, observer.Wait() below will hang.
shinyak (Google) 2011/06/07 08:54:14 Done.
+ render_view_host(), L"", L"OpenPopup();"));
+
+ observer.Wait();
+
+ std::set<Browser*> excluded;
+ excluded.insert(browser());
+ Browser* popup = ui_test_utils::GetBrowserNotInSet(excluded);
+
+ EXPECT_TRUE(popup);
Paweł Hajdan Jr. 2011/06/07 08:28:55 Similarly here, if popup is false the next line wi
shinyak (Google) 2011/06/07 08:54:14 Done.
+
+ return popup->GetWindowTitleForCurrentTab();
+}
+
+// Test title for content created by javascript window.open().
+// See http://crbug.com/5988
+IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, DynamicTitle1) {
+ ASSERT_TRUE(test_server()->Start());
+
+ GURL url(test_server()->GetURL("files/dynamic1.html"));
+ string16 title = GetPopupTitle(url);
+ ASSERT_EQ(string16::size_type(0),
Paweł Hajdan Jr. 2011/06/07 08:28:55 nit: I just realized it may be simpler to use Star
shinyak (Google) 2011/06/07 08:54:14 Done.
+ title.find(ASCIIToUTF16("My Popup Title")))
+ << "Actual title: " << title;
+}
+
+// Test title for content created by javascript window.open().
+// See http://crbug.com/5988
+IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, DynamicTitle2) {
+ ASSERT_TRUE(test_server()->Start());
+
+ GURL url(test_server()->GetURL("files/dynamic2.html"));
+ string16 title = GetPopupTitle(url);
+ ASSERT_EQ(string16::size_type(0),
+ title.find(ASCIIToUTF16("My Dynamic Title")))
+ << "Actual title: " << title;
+}
« no previous file with comments | « chrome/test/data/dynamic2.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698