summaryrefslogtreecommitdiffstats
path: root/chrome/test/interactive_ui
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-03 20:42:34 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-03 20:42:34 +0000
commit02d9082f51934314ae22c23b92fe60397259ced0 (patch)
treed8d1579aacbaac59e71f91a15fcb693c2a2060c7 /chrome/test/interactive_ui
parent36c1ff9fd1b301c7b2de0f364e9ba10835d3a9c6 (diff)
downloadchromium_src-02d9082f51934314ae22c23b92fe60397259ced0.zip
chromium_src-02d9082f51934314ae22c23b92fe60397259ced0.tar.gz
chromium_src-02d9082f51934314ae22c23b92fe60397259ced0.tar.bz2
Move MouseLeave ui test to interactive ui tests target.
BUG=45581,26349,45581 TEST=it runs, succeeds on bots Review URL: http://codereview.chromium.org/2520002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/interactive_ui')
-rw-r--r--chrome/test/interactive_ui/interactive_ui_tests.gypi1
-rw-r--r--chrome/test/interactive_ui/mouseleave_interactive_uitest.cc79
2 files changed, 80 insertions, 0 deletions
diff --git a/chrome/test/interactive_ui/interactive_ui_tests.gypi b/chrome/test/interactive_ui/interactive_ui_tests.gypi
index 20166a2..ada1f5b 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/test/in_process_browser_test.h',
'<(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',
'<(DEPTH)/chrome/test/interactive_ui/npapi_interactive_test.cc',
'<(DEPTH)/chrome/test/interactive_ui/view_event_test_base.cc',
'<(DEPTH)/chrome/test/interactive_ui/view_event_test_base.h',
diff --git a/chrome/test/interactive_ui/mouseleave_interactive_uitest.cc b/chrome/test/interactive_ui/mouseleave_interactive_uitest.cc
new file mode 100644
index 0000000..a735c8e
--- /dev/null
+++ b/chrome/test/interactive_ui/mouseleave_interactive_uitest.cc
@@ -0,0 +1,79 @@
+// Copyright (c) 2009 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/file_path.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/point.h"
+#include "gfx/rect.h"
+#include "googleurl/src/gurl.h"
+
+namespace {
+
+class MouseLeaveTest : public UITest {
+ public:
+ MouseLeaveTest() {
+ dom_automation_enabled_ = true;
+ show_window_ = true;
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(MouseLeaveTest);
+};
+
+TEST_F(MouseLeaveTest, TestOnMouseOut) {
+ GURL test_url = ui_test_utils::GetTestUrl(
+ FilePath(FilePath::kCurrentDirectory),
+ FilePath(FILE_PATH_LITERAL("mouseleave.html")));
+
+ 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(GetActiveTab());
+ ASSERT_TRUE(tab.get());
+
+ gfx::Rect tab_view_bounds;
+ ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, &tab_view_bounds,
+ true));
+ gfx::Point in_content_point(
+ tab_view_bounds.x() + tab_view_bounds.width() / 2,
+ tab_view_bounds.y() + 10);
+ gfx::Point above_content_point(
+ tab_view_bounds.x() + tab_view_bounds.width() / 2,
+ tab_view_bounds.y() - 2);
+
+ // Start by moving the point just above the content.
+ ASSERT_TRUE(window->SimulateOSMouseMove(above_content_point));
+
+ // Navigate to the test html page.
+ ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url));
+
+ const int timeout_ms = 5 * action_max_timeout_ms();
+
+ // Wait for the onload() handler to complete so we can do the
+ // next part of the test.
+ ASSERT_TRUE(WaitUntilCookieValue(
+ tab.get(), test_url, "__state", timeout_ms, "initial"));
+
+ // Move the cursor to the top-center of the content, which will trigger
+ // a javascript onMouseOver event.
+ ASSERT_TRUE(window->SimulateOSMouseMove(in_content_point));
+
+ // Wait on the correct intermediate value of the cookie.
+ ASSERT_TRUE(WaitUntilCookieValue(
+ tab.get(), test_url, "__state", timeout_ms, "initial,entered"));
+
+ // Move the cursor above the content again, which should trigger
+ // a javascript onMouseOut event.
+ ASSERT_TRUE(window->SimulateOSMouseMove(above_content_point));
+
+ // Wait on the correct final value of the cookie.
+ ASSERT_TRUE(WaitUntilCookieValue(
+ tab.get(), test_url, "__state", timeout_ms, "initial,entered,left"));
+}
+
+} // namespace