summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history
diff options
context:
space:
mode:
authorjnd@google.com <jnd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-24 11:31:40 +0000
committerjnd@google.com <jnd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-24 11:31:40 +0000
commit12ea9b27f4b143c59b6cb749f729025e484e7c5d (patch)
treef63cdf60d6767fa2be6c4c6cf455d3a49ba069c0 /chrome/browser/history
parentd6aa6b6b5ee96766e099ea83a897faea2ca784af (diff)
downloadchromium_src-12ea9b27f4b143c59b6cb749f729025e484e7c5d.zip
chromium_src-12ea9b27f4b143c59b6cb749f729025e484e7c5d.tar.gz
chromium_src-12ea9b27f4b143c59b6cb749f729025e484e7c5d.tar.bz2
Fix a few test failures when landing http://trac.webkit.org/changeset/57178.
http://trac.webkit.org/changeset/57178 broke some tests in browser_test and ui_test. This patch is same as the patch in http://codereview.chromium.org/3136019/show except test RedirectTest.ClientCancelled. RedirectTest.ClientCancelled was broken on windows platform when landing the original patch. So I revert it. After digging in code, I found the root cause of why the test was broken on windows platform. Please refer to http://crbug.com/53091 for details. So I add FAILS_ prefix to RedirectTest.ClientCancelled on windows platform. BUG=17655 TEST=RedirectTest.ClientCancelled, AppApiTest.AppProcess, ExtensionBrowserTest.WindowOpenExtension, ExtensionBrowserTest.WindowOpenInvalidExtension Review URL: http://codereview.chromium.org/3186023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57168 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r--chrome/browser/history/redirect_uitest.cc36
1 files changed, 33 insertions, 3 deletions
diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc
index 7e3ac11..5df9999 100644
--- a/chrome/browser/history/redirect_uitest.cc
+++ b/chrome/browser/history/redirect_uitest.cc
@@ -13,10 +13,14 @@
#include "base/string_util.h"
#include "base/string16.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/view_ids.h"
+#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
+#include "chrome/test/automation/window_proxy.h"
#include "chrome/test/ui/ui_test.h"
#include "net/base/net_util.h"
#include "net/test/test_server.h"
+#include "views/event.h"
namespace {
@@ -105,7 +109,17 @@ TEST_F(RedirectTest, ClientEmptyReferer) {
// Tests to make sure a location change when a pending redirect exists isn't
// flagged as a redirect.
-TEST_F(RedirectTest, ClientCancelled) {
+#if defined(OS_MACOSX)
+// SimulateOSClick is broken on the Mac: http://crbug.com/45162
+#define MAYBE_ClientCancelled DISABLED_ClientCancelled
+#elif defined(OS_WIN)
+// http://crbug.com/53091
+#define MAYBE_ClientCancelled FAILS_ClientCancelled
+#else
+#define MAYBE_ClientCancelled ClientCancelled
+#endif
+
+TEST_F(RedirectTest, MAYBE_ClientCancelled) {
FilePath first_path(test_data_directory_);
first_path = first_path.AppendASCII("cancelled_redirect_test.html");
ASSERT_TRUE(file_util::AbsolutePath(&first_path));
@@ -113,10 +127,26 @@ TEST_F(RedirectTest, ClientCancelled) {
NavigateToURLBlockUntilNavigationsComplete(first_url, 1);
- NavigateToURL(GURL("javascript:click()")); // User initiated location change.
-
+ scoped_refptr<BrowserProxy> browser = automation()->GetBrowserWindow(0);
+ ASSERT_TRUE(browser.get());
+ scoped_refptr<WindowProxy> window = browser->GetWindow();
+ ASSERT_TRUE(window.get());
scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
+ int64 last_nav_time = 0;
+ EXPECT_TRUE(tab_proxy->GetLastNavigationTime(&last_nav_time));
+ // Simulate a click to force to make a user-initiated location change;
+ // otherwise, a non user-initiated in-page location change will be treated
+ // as client redirect and the redirect will be recoreded, which can cause
+ // this test failed.
+ gfx::Rect tab_view_bounds;
+ ASSERT_TRUE(browser->BringToFront());
+ ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, &tab_view_bounds,
+ true));
+ ASSERT_TRUE(
+ window->SimulateOSClick(tab_view_bounds.CenterPoint(),
+ views::Event::EF_LEFT_BUTTON_DOWN));
+ EXPECT_TRUE(tab_proxy->WaitForNavigation(last_nav_time));
std::vector<GURL> redirects;
ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));