diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/bookmark_bar_view_test.cc | 21 | ||||
-rw-r--r-- | chrome/test/interactive_ui/view_event_test_base.cc | 14 |
2 files changed, 25 insertions, 10 deletions
diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/views/bookmark_bar_view_test.cc index 3d683f6..751a1ec 100644 --- a/chrome/browser/views/bookmark_bar_view_test.cc +++ b/chrome/browser/views/bookmark_bar_view_test.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/keyboard_codes.h" #include "base/string_util.h" #include "chrome/browser/automation/ui_controls.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -67,7 +68,7 @@ class TestingPageNavigator : public PageNavigator { class BookmarkBarViewEventTestBase : public ViewEventTestBase { public: BookmarkBarViewEventTestBase() - : ViewEventTestBase(), bb_view_(NULL), model_(NULL) { + : ViewEventTestBase(), model_(NULL), bb_view_(NULL) { } virtual void SetUp() { @@ -746,7 +747,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a down event, which should select the first item. ui_controls::SendKeyPressNotifyWhenDone( - NULL, VK_DOWN, false, false, false, + NULL, base::VKEY_DOWN, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step3)); } @@ -759,7 +760,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a key down event, which should select the next item. ui_controls::SendKeyPressNotifyWhenDone( - NULL, VK_DOWN, false, false, false, + NULL, base::VKEY_DOWN, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step4)); } @@ -772,7 +773,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a right arrow to force the menu to open. ui_controls::SendKeyPressNotifyWhenDone( - NULL, VK_RIGHT, false, false, false, + NULL, base::VKEY_RIGHT, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step5)); } @@ -788,7 +789,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a left arrow to close the submenu. ui_controls::SendKeyPressNotifyWhenDone( - NULL, VK_LEFT, false, false, false, + NULL, base::VKEY_LEFT, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step6)); } @@ -803,7 +804,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a down arrow to wrap back to f1a ui_controls::SendKeyPressNotifyWhenDone( - NULL, VK_DOWN, false, false, false, + NULL, base::VKEY_DOWN, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step7)); } @@ -816,7 +817,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send enter, which should select the item. ui_controls::SendKeyPressNotifyWhenDone( - NULL, VK_RETURN, false, false, false, + NULL, base::VKEY_RETURN, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step8)); } @@ -865,7 +866,7 @@ class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase { void Step3() { // Send escape so that the context menu hides. ui_controls::SendKeyPressNotifyWhenDone( - NULL, VK_ESCAPE, false, false, false, + NULL, base::VKEY_ESCAPE, false, false, false, CreateEventTask(this, &BookmarkBarViewTest11::Step4)); } @@ -952,7 +953,7 @@ class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { void Step4() { // Press tab to give focus to the cancel button. - ui_controls::SendKeyPress(NULL, VK_TAB, false, false, false); + ui_controls::SendKeyPress(NULL, base::VKEY_TAB, false, false, false); // For some reason return isn't processed correctly unless we delay. MessageLoop::current()->PostDelayedTask(FROM_HERE, @@ -962,7 +963,7 @@ class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { void Step5() { // And press enter so that the cancel button is selected. ui_controls::SendKeyPressNotifyWhenDone( - NULL, VK_RETURN, false, false, false, + NULL, base::VKEY_RETURN, false, false, false, CreateEventTask(this, &BookmarkBarViewTest12::Step6)); } diff --git a/chrome/test/interactive_ui/view_event_test_base.cc b/chrome/test/interactive_ui/view_event_test_base.cc index a1203d5..24db9c5 100644 --- a/chrome/test/interactive_ui/view_event_test_base.cc +++ b/chrome/test/interactive_ui/view_event_test_base.cc @@ -4,7 +4,9 @@ #include "chrome/test/interactive_ui/view_event_test_base.h" +#if defined(OS_WIN) #include <ole2.h> +#endif #include "base/message_loop.h" #include "chrome/browser/automation/ui_controls.h" @@ -50,9 +52,11 @@ ViewEventTestBase::ViewEventTestBase() : window_(NULL), content_view_(NULL) { } void ViewEventTestBase::Done() { MessageLoop::current()->Quit(); +#if defined(OS_WIN) // We need to post a message to tickle the Dispatcher getting called and // exiting out of the nested loop. Without this the quit never runs. PostMessage(window_->GetNativeWindow(), WM_USER, 0, 0); +#endif // If we're in a nested message loop, as is the case with menus, we need // to quit twice. The second quit does that for us. @@ -61,16 +65,24 @@ void ViewEventTestBase::Done() { } void ViewEventTestBase::SetUp() { +#if defined(OS_WIN) OleInitialize(NULL); +#endif window_ = views::Window::CreateChromeWindow(NULL, gfx::Rect(), this); } void ViewEventTestBase::TearDown() { if (window_) { +#if defined(OS_WIN) DestroyWindow(window_->GetNativeWindow()); +#else + gtk_widget_destroy(GTK_WIDGET(window_->GetNativeWindow())); +#endif window_ = NULL; } +#if defined(OS_WIN) OleUninitialize(); +#endif } views::View* ViewEventTestBase::GetContentsView() { @@ -89,7 +101,9 @@ void ViewEventTestBase::StartMessageLoopAndRunTest() { window_->Show(); // Make sure the window is the foreground window, otherwise none of the // mouse events are going to be targeted correctly. +#if defined(OS_WIN) SetForegroundWindow(window_->GetNativeWindow()); +#endif // Flush any pending events to make sure we start with a clean slate. MessageLoop::current()->RunAllPending(); |