diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 23:18:30 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 23:18:30 +0000 |
commit | a048ea67799ae6c42589496ba18e62cea9a3dee5 (patch) | |
tree | 6dcafd25f954a4aafe00cdca4974f572561682d4 /chrome | |
parent | 29a2bf9a50604c34842cad04f1e4775993f46b6d (diff) | |
download | chromium_src-a048ea67799ae6c42589496ba18e62cea9a3dee5.zip chromium_src-a048ea67799ae6c42589496ba18e62cea9a3dee5.tar.gz chromium_src-a048ea67799ae6c42589496ba18e62cea9a3dee5.tar.bz2 |
Revert "BookmarkBarView tests fixes"
I don't understand why this is still causing the problem, but reverting this for now.
This reverts commit 6bb4f22703226e093644c28afe34d975cc7d549d.
Review URL: http://codereview.chromium.org/1612005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43674 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/bookmark_bar_view_test.cc | 126 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_context_menu.cc | 5 | ||||
-rw-r--r-- | chrome/common/notification_type.h | 6 |
3 files changed, 21 insertions, 116 deletions
diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/views/bookmark_bar_view_test.cc index 78fccfe..c0d116d 100644 --- a/chrome/browser/views/bookmark_bar_view_test.cc +++ b/chrome/browser/views/bookmark_bar_view_test.cc @@ -11,11 +11,9 @@ #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/page_navigator.h" #include "chrome/browser/views/bookmark_bar_view.h" -#include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" #include "chrome/test/interactive_ui/view_event_test_base.h" -#include "chrome/test/ui_test_utils.h" #include "grit/generated_resources.h" #include "views/controls/button/menu_button.h" #include "views/controls/button/text_button.h" @@ -24,25 +22,6 @@ #include "views/controls/menu/submenu_view.h" #include "views/window/window.h" -#if defined(OS_LINUX) -// See http://crbug.com/40040 for details. -#define MAYBE_DND DISABLED_DND -#define MAYBE_DNDToDifferentMenu DISABLED_DNDToDifferentMenu -#define MAYBE_DNDBackToOriginatingMenu DISABLED_DNDBackToOriginatingMenu - -// See http://crbug.com/40039 for details. -#define MAYBE_KeyEvents DISABLED_KeyEvents - -#else - -#define MAYBE_DND DND -#define MAYBE_DNDToDifferentMenu DNDToDifferentMenu -#define MAYBE_DNDBackToOriginatingMenu DNDBackToOriginatingMenu -#define MAYBE_DNDBackToOriginatingMenu DNDBackToOriginatingMenu -#define MAYBE_KeyEvents KeyEvents - -#endif - namespace { // PageNavigator implementation that records the URL. @@ -366,7 +345,7 @@ class BookmarkBarViewTest3 : public BookmarkBarViewEventTestBase { ASSERT_TRUE(child_menu->GetSubmenu()->IsShowing()); // Nothing should have been selected. - EXPECT_EQ(GURL(), navigator_.url_); + ASSERT_TRUE(navigator_.url_ == GURL()); // Hide menu. menu->GetMenuController()->Cancel(true); @@ -377,40 +356,10 @@ class BookmarkBarViewTest3 : public BookmarkBarViewEventTestBase { VIEW_TEST(BookmarkBarViewTest3, Submenus) -// Observer that posts task upon the context menu creation. -// This is necessary for Linux as the context menu has to check -// the clipboard, which invokes the event loop. -class ContextMenuNotificationObserver : public NotificationObserver { - public: - explicit ContextMenuNotificationObserver(Task* task) : task_(task) { - registrar_.Add(this, - NotificationType::BOOKMARK_CONTEXT_MENU_SHOWN, - NotificationService::AllSources()); - } - - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - MessageLoop::current()->PostTask(FROM_HERE, task_); - } - - private: - NotificationRegistrar registrar_; - Task* task_; - - DISALLOW_COPY_AND_ASSIGN(ContextMenuNotificationObserver); -}; - // Tests context menus by way of opening a context menu for a bookmark, // then right clicking to get context menu and selecting the first menu item // (open). class BookmarkBarViewTest4 : public BookmarkBarViewEventTestBase { - public: - BookmarkBarViewTest4() - : ALLOW_THIS_IN_INITIALIZER_LIST( - observer_(CreateEventTask(this, &BookmarkBarViewTest4::Step3))) { - } - protected: virtual void DoTestOnMessageLoop() { // Move the mouse to the first folder on the bookmark bar and press the @@ -434,8 +383,8 @@ class BookmarkBarViewTest4 : public BookmarkBarViewEventTestBase { // Right click on the first child to get its context menu. ui_controls::MoveMouseToCenterAndPress(child_menu, ui_controls::RIGHT, - ui_controls::DOWN | ui_controls::UP, NULL); - // Step3 will be invoked by ContextMenuNotificationObserver. + ui_controls::DOWN | ui_controls::UP, + CreateEventTask(this, &BookmarkBarViewTest4::Step3)); } void Step3() { @@ -452,13 +401,11 @@ class BookmarkBarViewTest4 : public BookmarkBarViewEventTestBase { } void Step4() { - EXPECT_EQ(navigator_.url_, - model_->other_node()->GetChild(0)->GetURL()); + ASSERT_TRUE(navigator_.url_ == + model_->other_node()->GetChild(0)->GetURL()); Done(); } - - ContextMenuNotificationObserver observer_; }; VIEW_TEST(BookmarkBarViewTest4, ContextMenus) @@ -511,9 +458,9 @@ class BookmarkBarViewTest5 : public BookmarkBarViewEventTestBase { void Step4() { // Drop the item so that it's now the second item. - views::MenuItemView* target_menu = + views::MenuItemView* target_menu = bb_view_->GetMenu()->GetSubmenu()->GetMenuItemAt(1); - gfx::Point loc(1, target_menu->height() - 1); + gfx::Point loc(1, target_menu->height() - 1); views::View::ConvertPointToScreen(target_menu, &loc); ui_controls::SendMouseMove(loc.x(), loc.y()); @@ -524,14 +471,14 @@ class BookmarkBarViewTest5 : public BookmarkBarViewEventTestBase { void Step5() { GURL url = model_->GetBookmarkBarNode()->GetChild(0)->GetChild(1)->GetURL(); - EXPECT_EQ(url_dragging_, url); + ASSERT_TRUE(url == url_dragging_); Done(); } GURL url_dragging_; }; -VIEW_TEST(BookmarkBarViewTest5, MAYBE_DND) +VIEW_TEST(BookmarkBarViewTest5, DND) // Tests holding mouse down on overflow button, dragging such that menu pops up // then selecting an item. @@ -641,7 +588,7 @@ class BookmarkBarViewTest7 : public BookmarkBarViewEventTestBase { GURL url_dragging_; }; -VIEW_TEST(BookmarkBarViewTest7, MAYBE_DNDToDifferentMenu) +VIEW_TEST(BookmarkBarViewTest7, DNDToDifferentMenu) // Drags from one menu to next so that original menu closes, then back to // original menu. @@ -728,7 +675,7 @@ class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase { GURL url_dragging_; }; -VIEW_TEST(BookmarkBarViewTest8, MAYBE_DNDBackToOriginatingMenu) +VIEW_TEST(BookmarkBarViewTest8, DNDBackToOriginatingMenu) // Moves the mouse over the scroll button and makes sure we get scrolling. class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase { @@ -766,9 +713,6 @@ class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase { gfx::Point loc(scroll_down_button->width() / 2, scroll_down_button->height() / 2); views::View::ConvertPointToScreen(scroll_down_button, &loc); - - // On linux, the sending one location isn't enough. - ui_controls::SendMouseMove(loc.x() - 1 , loc.y() - 1); ui_controls::SendMouseMoveNotifyWhenDone( loc.x(), loc.y(), CreateEventTask(this, &BookmarkBarViewTest9::Step3)); } @@ -786,12 +730,7 @@ class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase { // Hide menu. bb_view_->GetMenu()->GetMenuController()->Cancel(true); - // On linux, Cancelling menu will call Quit on the message loop, - // which can interfere with Done. We need to run Done in the - // next execution loop. - MessageLoop::current()->PostTask( - FROM_HERE, - NewRunnableMethod(this, &ViewEventTestBase::Done)); + Done(); } int start_y_; @@ -810,7 +749,6 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { ui_controls::MoveMouseToCenterAndPress(button, ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP, CreateEventTask(this, &BookmarkBarViewTest10::Step2)); - MessageLoop::current()->RunAllPending(); } private: @@ -866,7 +804,6 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { ui_controls::SendKeyPressNotifyWhenDone( NULL, base::VKEY_LEFT, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step6)); - MessageLoop::current()->RunAllPending(); } void Step6() { @@ -905,7 +842,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { } }; -VIEW_TEST(BookmarkBarViewTest10, MAYBE_KeyEvents) +VIEW_TEST(BookmarkBarViewTest10, KeyEvents) // Make sure the menu closes with the following sequence: show menu, show // context menu, close context menu (via escape), then click else where. This @@ -1059,12 +996,6 @@ VIEW_TEST(BookmarkBarViewTest12, CloseWithModalDialog) // Tests clicking on the separator of a context menu (this is for coverage of // bug 17862). class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase { - public: - BookmarkBarViewTest13() - : ALLOW_THIS_IN_INITIALIZER_LIST( - observer_(CreateEventTask(this, &BookmarkBarViewTest13::Step3))) { - } - protected: virtual void DoTestOnMessageLoop() { // Move the mouse to the first folder on the bookmark bar and press the @@ -1088,8 +1019,8 @@ class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase { // Right click on the first child to get its context menu. ui_controls::MoveMouseToCenterAndPress(child_menu, ui_controls::RIGHT, - ui_controls::DOWN | ui_controls::UP, NULL); - // Step3 will be invoked by ContextMenuNotificationObserver. + ui_controls::DOWN | ui_controls::UP, + CreateEventTask(this, &BookmarkBarViewTest13::Step3)); } void Step3() { @@ -1132,10 +1063,9 @@ class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase { } void Step5() { + DLOG(WARNING) << " DONE"; Done(); } - - ContextMenuNotificationObserver observer_; }; VIEW_TEST(BookmarkBarViewTest13, ClickOnContextMenuSeparator) @@ -1143,24 +1073,17 @@ VIEW_TEST(BookmarkBarViewTest13, ClickOnContextMenuSeparator) // Makes sure right cliking on a folder on the bookmark bar doesn't result in // both a context menu and showing the menu. class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase { - public: - BookmarkBarViewTest14() - : ALLOW_THIS_IN_INITIALIZER_LIST( - observer_(CreateEventTask(this, &BookmarkBarViewTest14::Step2))) { - } - protected: virtual void DoTestOnMessageLoop() { // Move the mouse to the first folder on the bookmark bar and press the // right mouse button. views::TextButton* button = bb_view_->GetBookmarkButton(0); ui_controls::MoveMouseToCenterAndPress(button, ui_controls::RIGHT, - ui_controls::DOWN | ui_controls::UP, NULL); - // Step2 will be invoked by ContextMenuNotificationObserver. + ui_controls::DOWN | ui_controls::UP, + CreateEventTask(this, &BookmarkBarViewTest14::Step2)); } private: - void Step2() { // Menu should NOT be showing. views::MenuItemView* menu = bb_view_->GetMenu(); @@ -1175,8 +1098,6 @@ class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase { void Step3() { Done(); } - - ContextMenuNotificationObserver observer_; }; VIEW_TEST(BookmarkBarViewTest14, ContextMenus2) @@ -1184,11 +1105,7 @@ VIEW_TEST(BookmarkBarViewTest14, ContextMenus2) // Makes sure deleting from the context menu keeps the bookmark menu showing. class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase { public: - BookmarkBarViewTest15() - : deleted_menu_id_(0), - ALLOW_THIS_IN_INITIALIZER_LIST( - observer_(CreateEventTask(this, &BookmarkBarViewTest15::Step3))) { - } + BookmarkBarViewTest15() : deleted_menu_id_(0) {} protected: virtual void DoTestOnMessageLoop() { @@ -1214,8 +1131,8 @@ class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase { // Right click on the second child to get its context menu. ui_controls::MoveMouseToCenterAndPress(child_menu, ui_controls::RIGHT, - ui_controls::DOWN | ui_controls::UP, NULL); - // Step3 will be invoked by ContextMenuNotificationObserver. + ui_controls::DOWN | ui_controls::UP, + CreateEventTask(this, &BookmarkBarViewTest15::Step3)); } void Step3() { @@ -1254,7 +1171,6 @@ class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase { } int deleted_menu_id_; - ContextMenuNotificationObserver observer_; }; VIEW_TEST(BookmarkBarViewTest15, MenuStaysVisibleAfterDelete) diff --git a/chrome/browser/views/bookmark_context_menu.cc b/chrome/browser/views/bookmark_context_menu.cc index 9ef9506..aef8070 100644 --- a/chrome/browser/views/bookmark_context_menu.cc +++ b/chrome/browser/views/bookmark_context_menu.cc @@ -7,7 +7,6 @@ #include "app/l10n_util.h" #include "base/i18n/rtl.h" #include "chrome/browser/profile.h" -#include "chrome/common/notification_service.h" #include "grit/generated_resources.h" #include "views/controls/menu/menu_item_view.h" @@ -36,10 +35,6 @@ BookmarkContextMenu::~BookmarkContextMenu() { } void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) { - NotificationService::current()->Notify( - NotificationType::BOOKMARK_CONTEXT_MENU_SHOWN, - Source<BookmarkContextMenu>(this), - NotificationService::NoDetails()); // width/height don't matter here. views::MenuItemView::AnchorPosition anchor = base::i18n::IsRTL() ? views::MenuItemView::TOPRIGHT : views::MenuItemView::TOPLEFT; diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index 6bb7efb..d00a33d 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -932,12 +932,6 @@ class NotificationType { // The source is a NavigationController. RELOADING, -#if defined(TOOLKIT_VIEWS) - // Sent when a bookmark's context menu is shown. Used to notify - // tests that the context menu has been created and shown. - BOOKMARK_CONTEXT_MENU_SHOWN, -#endif - // Count (must be last) ---------------------------------------------------- // Used to determine the number of notification types. Not valid as // a type parameter when registering for or posting notifications. |