summaryrefslogtreecommitdiffstats
path: root/chrome/test/interactive_ui
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-08 19:47:50 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-08 19:47:50 +0000
commitae75a18bf4bc3f566e7315327375794f1a6c220c (patch)
tree1f3a5be07f37e6048e27f4295db9e6988d6bec3d /chrome/test/interactive_ui
parentcc1a4ca35f3095776c98f84f476b098037967c6d (diff)
downloadchromium_src-ae75a18bf4bc3f566e7315327375794f1a6c220c.zip
chromium_src-ae75a18bf4bc3f566e7315327375794f1a6c220c.tar.gz
chromium_src-ae75a18bf4bc3f566e7315327375794f1a6c220c.tar.bz2
Make FastShutdown ui test more reliable on linux.
See previous patch at http://codereview.chromium.org/2830010/show This patch puts the responsibility of waiting on the test rather than making ui_test.cc robust. The reason for moving the test to interactive tests (instead of straight up ui tests) is that waving the mouse around can break the test. BUG=46614 TEST=test passes many times locally; try bots Review URL: http://codereview.chromium.org/3338013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58863 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/interactive_ui')
-rw-r--r--chrome/test/interactive_ui/fast_shutdown_interactive_uitest.cc63
-rw-r--r--chrome/test/interactive_ui/interactive_ui_tests.gypi1
2 files changed, 64 insertions, 0 deletions
diff --git a/chrome/test/interactive_ui/fast_shutdown_interactive_uitest.cc b/chrome/test/interactive_ui/fast_shutdown_interactive_uitest.cc
new file mode 100644
index 0000000..05a0d96
--- /dev/null
+++ b/chrome/test/interactive_ui/fast_shutdown_interactive_uitest.cc
@@ -0,0 +1,63 @@
+// Copyright (c) 2010 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 "app/message_box_flags.h"
+#include "base/file_path.h"
+#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/browser/view_ids.h"
+#include "chrome/test/automation/automation_proxy.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 "chrome/test/ui_test_utils.h"
+#include "gfx/rect.h"
+#include "views/event.h"
+
+class FastShutdown : public UITest {
+};
+
+#if defined(OS_MACOSX)
+// SimulateOSClick is broken on the Mac: http://crbug.com/45162
+#define MAYBE_SlowTermination DISABLED_SlowTermination
+#elif defined(OS_LINUX)
+#define MAYBE_SlowTermination SlowTermination
+#elif defined(OS_WIN)
+// Times out: http://crbug.com/46616
+#define MAYBE_SlowTermination DISABLED_SlowTermination
+#else
+#define MAYBE_SlowTermination SlowTermination
+#endif
+
+// This tests for a previous error where uninstalling an onbeforeunload
+// handler would enable fast shutdown even if an onUnload handler still
+// existed.
+TEST_F(FastShutdown, MAYBE_SlowTermination) {
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser.get());
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
+ ASSERT_TRUE(window.get());
+
+ // This page has an unload handler.
+ const FilePath dir(FILE_PATH_LITERAL("fast_shutdown"));
+ const FilePath file(FILE_PATH_LITERAL("on_unloader.html"));
+ NavigateToURL(ui_test_utils::GetTestUrl(dir, file));
+ gfx::Rect bounds;
+ ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, &bounds, true));
+ // This click will launch a popup which has a before unload handler.
+ ASSERT_TRUE(window->SimulateOSClick(bounds.CenterPoint(),
+ views::Event::EF_LEFT_BUTTON_DOWN));
+ ASSERT_TRUE(browser->WaitForTabCountToBecome(2));
+ // Close the tab, removing the one and only before unload handler.
+ scoped_refptr<TabProxy> tab(browser->GetTab(1));
+ ASSERT_TRUE(tab->Close(true));
+
+ // Close the browser. We should launch the unload handler, which is an
+ // alert().
+ ASSERT_TRUE(browser->ApplyAccelerator(IDC_CLOSE_WINDOW));
+ ASSERT_TRUE(automation()->WaitForAppModalDialog());
+ ASSERT_TRUE(automation()->ClickAppModalDialogButton(
+ MessageBoxFlags::DIALOGBUTTON_OK));
+ ASSERT_TRUE(WaitForBrowserProcessToQuit());
+}
diff --git a/chrome/test/interactive_ui/interactive_ui_tests.gypi b/chrome/test/interactive_ui/interactive_ui_tests.gypi
index c07e74c..2c9be8e 100644
--- a/chrome/test/interactive_ui/interactive_ui_tests.gypi
+++ b/chrome/test/interactive_ui/interactive_ui_tests.gypi
@@ -41,6 +41,7 @@
'<(DEPTH)/chrome/browser/views/tabs/tab_dragging_test.cc',
'<(DEPTH)/chrome/test/in_process_browser_test.cc',
'<(DEPTH)/chrome/test/in_process_browser_test.h',
+ '<(DEPTH)/chrome/test/interactive_ui/fast_shutdown_interactive_uitest.cc',
'<(DEPTH)/chrome/test/interactive_ui/infobars_uitest.cc',
'<(DEPTH)/chrome/test/interactive_ui/keyboard_access_uitest.cc',
'<(DEPTH)/chrome/test/interactive_ui/mouseleave_interactive_uitest.cc',