diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-22 19:57:24 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-22 19:57:24 +0000 |
commit | 8dd404bbb05b99e7ee13b4e70899ebbcaeb3e8fb (patch) | |
tree | 0e4b5ba4be534f7e769db542d0882d6983fcb59a /chrome/test/automated_ui_tests | |
parent | 24f4035eb84f25a51bf7ed6696671c99bf89bb25 (diff) | |
download | chromium_src-8dd404bbb05b99e7ee13b4e70899ebbcaeb3e8fb.zip chromium_src-8dd404bbb05b99e7ee13b4e70899ebbcaeb3e8fb.tar.gz chromium_src-8dd404bbb05b99e7ee13b4e70899ebbcaeb3e8fb.tar.bz2 |
Automated ui test porting + cleanup:
- Change POINTs to gfx::Point
- Get rid of 2 unused automation messages (the messages themselves are staying for now so we don't mess with the reference build)
-- add new automation messages to replace GetWindowHWND, which is not portable
- re-enable automated_ui_test_interactive_test (it seems to have been dropped when we converted to gyp)
- compile additional tests on linux (they don't pass, so they are disabled)
- stub out linux tab dragging automation implementation (browser side)
- delete various cruft
BUG=19758
Review URL: http://codereview.chromium.org/211033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26846 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automated_ui_tests')
3 files changed, 27 insertions, 27 deletions
diff --git a/chrome/test/automated_ui_tests/automated_ui_test_base.cc b/chrome/test/automated_ui_tests/automated_ui_test_base.cc index 5f2ef95..81ed10e 100644 --- a/chrome/test/automated_ui_tests/automated_ui_test_base.cc +++ b/chrome/test/automated_ui_tests/automated_ui_test_base.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/gfx/point.h" +#include "base/gfx/rect.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/view_ids.h" #include "chrome/test/automated_ui_tests/automated_ui_test_base.h" @@ -9,10 +11,7 @@ #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" #include "chrome/test/ui/ui_test.h" - -#if defined(TOOLKIT_VIEWS) -#include "views/view.h" -#endif +#include "views/event.h" AutomatedUITestBase::AutomatedUITestBase() {} @@ -84,7 +83,6 @@ bool AutomatedUITestBase::DuplicateTab() { return RunCommand(IDC_DUPLICATE_TAB); } -#if defined(OS_WIN) bool AutomatedUITestBase::DragTabOut() { BrowserProxy* browser = active_browser(); if (browser == NULL) { @@ -141,13 +139,13 @@ bool AutomatedUITestBase::DragTabOut() { return false; } - // Click on the center of the tab, and drag it downwads. - POINT start; - POINT end; - start.x = dragged_tab_bounds.x() + dragged_tab_bounds.width()/2; - start.y = dragged_tab_bounds.y() + dragged_tab_bounds.height()/2; - end.x = start.x; - end.y = start.y + 3*urlbar_bounds.height(); + // Click on the center of the tab, and drag it downwards. + gfx::Point start; + gfx::Point end; + start.set_x(dragged_tab_bounds.x() + dragged_tab_bounds.width() / 2); + start.set_y(dragged_tab_bounds.y() + dragged_tab_bounds.height() / 2); + end.set_x(start.x()); + end.set_y(start.y() + 3 * urlbar_bounds.height()); if (!browser->SimulateDragWithTimeout(start, end, views::Event::EF_LEFT_BUTTON_DOWN, @@ -203,8 +201,8 @@ bool AutomatedUITestBase::DragActiveTab(bool drag_right) { } // Click on the center of the tab, and drag it to the left or the right. - POINT dragged_tab_point(dragged_tab_bounds.CenterPoint().ToPOINT()); - POINT destination_point(dragged_tab_point); + gfx::Point dragged_tab_point = dragged_tab_bounds.CenterPoint(); + gfx::Point destination_point = dragged_tab_point; int new_tab_index; if (drag_right) { @@ -213,14 +211,14 @@ bool AutomatedUITestBase::DragActiveTab(bool drag_right) { return false; } new_tab_index = tab_index + 1; - destination_point.x += 2 * dragged_tab_bounds.width() / 3; + destination_point.Offset(2 * dragged_tab_bounds.width() / 3, 0); } else { if (tab_index <= 0) { LogInfoMessage("cant_drag_to_left"); return false; } new_tab_index = tab_index - 1; - destination_point.x -= 2 * dragged_tab_bounds.width() / 3; + destination_point.Offset(-2 * dragged_tab_bounds.width() / 3, 0); } if (!browser->SimulateDragWithTimeout(dragged_tab_point, @@ -239,7 +237,6 @@ bool AutomatedUITestBase::DragActiveTab(bool drag_right) { return true; } -#endif bool AutomatedUITestBase::FindInPage() { if (!RunCommandAsync(IDC_FIND)) diff --git a/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc b/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc index 66f57b0..f7ac5fc 100644 --- a/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc +++ b/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc @@ -7,6 +7,12 @@ #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/ui/ui_test.h" +#if defined(OS_WINDOWS) +#define MAYBE(x) x +#else +#define MAYBE(x) DISABLED_##x +#endif + namespace { bool WaitForURLDisplayedForTab(BrowserProxy* browser, int tab_index, @@ -24,21 +30,21 @@ bool WaitForURLDisplayedForTab(BrowserProxy* browser, int tab_index, return false; } -} +} // namespace -TEST_F(AutomatedUITestBase, DragOut) { +TEST_F(AutomatedUITestBase, MAYBE(DragOut)) { int tab_count; active_browser()->GetTabCount(&tab_count); ASSERT_EQ(1, tab_count); ASSERT_FALSE(DragTabOut()); NewTab(); - Navigate(GURL(L"about:")); + Navigate(GURL("about:")); active_browser()->GetTabCount(&tab_count); ASSERT_EQ(2, tab_count); NewTab(); active_browser()->GetTabCount(&tab_count); ASSERT_EQ(3, tab_count); - GURL chrome_downloads_url(L"chrome://downloads/"); + GURL chrome_downloads_url("chrome://downloads/"); Navigate(chrome_downloads_url); ASSERT_TRUE(WaitForURLDisplayedForTab(active_browser(), 2, chrome_downloads_url)); @@ -48,7 +54,7 @@ TEST_F(AutomatedUITestBase, DragOut) { ASSERT_EQ(2, window_count); } -TEST_F(AutomatedUITestBase, DragLeftRight) { +TEST_F(AutomatedUITestBase, MAYBE(DragLeftRight)) { int tab_count; active_browser()->GetTabCount(&tab_count); ASSERT_EQ(1, tab_count); @@ -57,13 +63,13 @@ TEST_F(AutomatedUITestBase, DragLeftRight) { NewTab(); active_browser()->GetTabCount(&tab_count); ASSERT_EQ(2, tab_count); - GURL about_url(L"about:"); + GURL about_url("about:"); Navigate(about_url); NewTab(); active_browser()->GetTabCount(&tab_count); ASSERT_EQ(3, tab_count); - GURL chrome_downloads_url(L"chrome://downloads/"); + GURL chrome_downloads_url("chrome://downloads/"); Navigate(chrome_downloads_url); ASSERT_TRUE(WaitForURLDisplayedForTab(active_browser(), 2, chrome_downloads_url)); diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc index 394b91c..252689c 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.cc +++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc @@ -319,15 +319,12 @@ bool AutomatedUITest::DoAction(const std::string& action) { did_complete_action = PressDownArrow(); } else if (LowerCaseEqualsASCII(action, "downloads")) { did_complete_action = ShowDownloads(); -// TODO(estade): port. -#if defined(OS_WIN) } else if (LowerCaseEqualsASCII(action, "dragtableft")) { did_complete_action = DragActiveTab(false); } else if (LowerCaseEqualsASCII(action, "dragtabout")) { did_complete_action = DragTabOut(); } else if (LowerCaseEqualsASCII(action, "dragtabright")) { did_complete_action = DragActiveTab(true); -#endif // defined(OS_WIN) } else if (LowerCaseEqualsASCII(action, "duplicatetab")) { did_complete_action = DuplicateTab(); } else if (LowerCaseEqualsASCII(action, "editsearchengines")) { |