From 9463788c6a3bfdc54f8d4ada196078e155e762d5 Mon Sep 17 00:00:00 2001
From: "jrg@chromium.org"
 <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Thu, 27 May 2010 21:18:33 +0000
Subject: Revert 48417 - More test enabling.

 RedirectTest.ClientServerServer passes locally so I'm trying reenabling it.
 file a bug for RedirectTest.ClientCancelledByNewNavigationAfterProvisionalLoad .
 file a bug for SessionHistoryTest.CrossFrameFormBackForward
 mark SessionHistoryTest.LocationReplace as failing rather than disabled
 fix UnloadTest.BrowserCloseTabWhenOtherTabHasListener (the popup was being caught by the popup blocker)

TEST=buildbots
BUG=12913

Review URL: http://codereview.chromium.org/2264001

TBR=estade@chromium.org




Looks like UnloadTest.BrowserCloseTabWhenOtherTabHasListener still unhappy on bot?

http://buildbot.jail.google.com/buildbot/chromium/builders/XP%20Tests/builds/20319/steps/ui_tests/logs/stdio

[----------] Global test environment tear-down
[==========] 315 tests from 72 test cases ran. (1089094 ms total)
[  PASSED  ] 308 tests.
[  FAILED  ] 7 tests, listed below:
[  FAILED  ] MouseLeaveTest.FLAKY_TestOnMouseOut
[  FAILED  ] HistoryTester.FAILS_VerifyHistoryLength2
[  FAILED  ] HistoryTester.FAILS_VerifyHistoryLength3
[  FAILED  ] WorkerTest.FLAKY_WorkerHttpLayoutTests
[  FAILED  ] UnloadTest.BrowserCloseTabWhenOtherTabHasListener
[  FAILED  ] SessionHistoryTest.FAILS_LocationReplace
[  FAILED  ] SessionHistoryTest.FLAKY_HistorySearchXSS




Review URL: http://codereview.chromium.org/2225009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48433 0039d316-1c4b-4281-b951-d872f2087c98
---
 chrome/browser/history/redirect_uitest.cc |  5 +--
 chrome/browser/session_history_uitest.cc  |  3 +-
 chrome/browser/unload_uitest.cc           | 57 ++++++++++++++-----------------
 3 files changed, 30 insertions(+), 35 deletions(-)

diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc
index b2d4fb8..a94000e 100644
--- a/chrome/browser/history/redirect_uitest.cc
+++ b/chrome/browser/history/redirect_uitest.cc
@@ -138,7 +138,9 @@ TEST_F(RedirectTest, DISABLED_ClientCancelled) {
 }
 
 // Tests a client->server->server redirect
-TEST_F(RedirectTest, ClientServerServer) {
+// TODO(creis): This is disabled temporarily while I figure out why it is
+// failing.
+TEST_F(RedirectTest, DISABLED_ClientServerServer) {
   scoped_refptr<HTTPTestServer> server =
       HTTPTestServer::CreateServer(kDocRoot, NULL);
   ASSERT_TRUE(NULL != server.get());
@@ -241,7 +243,6 @@ TEST_F(RedirectTest, ClientFragments) {
 // alternatively load the second page from disk, but we would need to start
 // the browser for this testcase with --process-per-tab, and I don't think
 // we can do this at test-case-level granularity at the moment.
-// http://crbug.com/45056
 TEST_F(RedirectTest,
        DISABLED_ClientCancelledByNewNavigationAfterProvisionalLoad) {
   // We want to initiate a second navigation after the provisional load for
diff --git a/chrome/browser/session_history_uitest.cc b/chrome/browser/session_history_uitest.cc
index 7fc93f5..830f9be 100644
--- a/chrome/browser/session_history_uitest.cc
+++ b/chrome/browser/session_history_uitest.cc
@@ -268,7 +268,6 @@ TEST_F(SessionHistoryTest, FrameFormBackForward) {
 // document state"
 // Test that back/forward preserves POST data and document state when navigating
 // across frames (ie, from frame -> nonframe).
-// http://crbug.com/45058
 TEST_F(SessionHistoryTest, DISABLED_CrossFrameFormBackForward) {
   scoped_refptr<HTTPTestServer> server =
       HTTPTestServer::CreateServer(kDocRoot, NULL);
@@ -467,7 +466,7 @@ TEST_F(SessionHistoryTest, JavascriptHistory) {
 }
 
 // This test is failing consistently. See http://crbug.com/22560
-TEST_F(SessionHistoryTest, FAILS_LocationReplace) {
+TEST_F(SessionHistoryTest, DISABLED_LocationReplace) {
   // Test that using location.replace doesn't leave the title of the old page
   // visible.
   scoped_refptr<HTTPTestServer> server =
diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc
index ec1a58b..e0185c8 100644
--- a/chrome/browser/unload_uitest.cc
+++ b/chrome/browser/unload_uitest.cc
@@ -85,9 +85,9 @@ const std::string TWO_SECOND_BEFORE_UNLOAD_ALERT_HTML =
 
 const std::string CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER =
     "<html><head><title>only_one_unload</title></head>"
-    "<body onclick=\"window.open('data:text/html,"
+    "<body onload=\"window.open('data:text/html,"
     "<html><head><title>popup</title></head></body>')\" "
-    "onbeforeunload='return;'>"
+    "onbeforeunload='return;'"
     "</body></html>";
 
 class UnloadTest : public UITest {
@@ -292,7 +292,6 @@ TEST_F(UnloadTest, BrowserCloseUnload) {
 #define BrowserCloseWithInnerFocusedFrame \
     DISABLED_BrowserCloseWithInnerFocusedFrame
 #endif
-
 // Tests closing the browser with a beforeunload handler and clicking
 // OK in the beforeunload confirm dialog.
 TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) {
@@ -397,46 +396,42 @@ TEST_F(UnloadTest, BrowserCloseTwoSecondBeforeUnloadAlert) {
                         L"twosecondbeforeunloadalert");
 }
 
-#if defined(OS_MACOSX)
-// http://crbug.com/45162
-#define MAYBE_BrowserCloseTabWhenOtherTabHasListener \
-    DISABLED_BrowserCloseTabWhenOtherTabHasListener
-#else
-#define MAYBE_BrowserCloseTabWhenOtherTabHasListener \
-    BrowserCloseTabWhenOtherTabHasListener
-#endif
+// TODO(brettw) bug 12913 this test was broken by WebKit merge 42202:44252.
+// Apparently popup titles are broken somehow.
 
 // Tests that if there's a renderer process with two tabs, one of which has an
 // unload handler, and the other doesn't, the tab that doesn't have an unload
-// handler can be closed.
-TEST_F(UnloadTest, MAYBE_BrowserCloseTabWhenOtherTabHasListener) {
+// handler can be closed.  If this test fails, the Close() call will hang.
+TEST_F(UnloadTest, DISABLED_BrowserCloseTabWhenOtherTabHasListener) {
   NavigateToDataURL(CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER, L"only_one_unload");
-
-  scoped_refptr<BrowserProxy> browser = automation()->GetBrowserWindow(0);
-  ASSERT_TRUE(browser.get());
-  scoped_refptr<WindowProxy> window = browser->GetWindow();
-  ASSERT_TRUE(window.get());
-
-  gfx::Rect tab_view_bounds;
-  ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER,
-              &tab_view_bounds, true));
-  // Simulate a click to force user_gesture to true; if we don't, the resulting
-  // popup will be constrained, which isn't what we want to test.
-  ASSERT_TRUE(window->SimulateOSClick(tab_view_bounds.CenterPoint(),
-                                      views::Event::EF_LEFT_BUTTON_DOWN));
-  ASSERT_TRUE(browser->WaitForTabCountToBecome(2, action_timeout_ms()));
-
-  scoped_refptr<TabProxy> popup_tab(browser->GetActiveTab());
+  int window_count;
+  ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count));
+  ASSERT_EQ(2, window_count);
+
+  scoped_refptr<BrowserProxy> popup_browser_proxy(
+      automation()->GetBrowserWindow(1));
+  ASSERT_TRUE(popup_browser_proxy.get());
+  int popup_tab_count;
+  EXPECT_TRUE(popup_browser_proxy->GetTabCount(&popup_tab_count));
+  EXPECT_EQ(1, popup_tab_count);
+  scoped_refptr<TabProxy> popup_tab(popup_browser_proxy->GetActiveTab());
   ASSERT_TRUE(popup_tab.get());
   std::wstring popup_title;
+  ASSERT_TRUE(popup_tab.get() != NULL);
   EXPECT_TRUE(popup_tab->GetTabTitle(&popup_title));
   EXPECT_EQ(std::wstring(L"popup"), popup_title);
   EXPECT_TRUE(popup_tab->Close(true));
 
-  ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_timeout_ms()));
-  scoped_refptr<TabProxy> main_tab(browser->GetActiveTab());
+  scoped_refptr<BrowserProxy> main_browser_proxy(
+      automation()->GetBrowserWindow(0));
+  ASSERT_TRUE(main_browser_proxy.get());
+  int main_tab_count;
+  EXPECT_TRUE(main_browser_proxy->GetTabCount(&main_tab_count));
+  EXPECT_EQ(1, main_tab_count);
+  scoped_refptr<TabProxy> main_tab(main_browser_proxy->GetActiveTab());
   ASSERT_TRUE(main_tab.get());
   std::wstring main_title;
+  ASSERT_TRUE(main_tab.get() != NULL);
   EXPECT_TRUE(main_tab->GetTabTitle(&main_title));
   EXPECT_EQ(std::wstring(L"only_one_unload"), main_title);
 }
-- 
cgit v1.1