summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/bookmark_bar_view_test.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-28 19:36:46 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-28 19:36:46 +0000
commitd1ba5b511c94fb02b79ceae67a172d6bdb716e98 (patch)
tree23288e2b27f8513e76e5f22750f3166c92edaae5 /chrome/browser/views/bookmark_bar_view_test.cc
parentd3038bf0175f75df75385a17298134a2ee39b8a1 (diff)
downloadchromium_src-d1ba5b511c94fb02b79ceae67a172d6bdb716e98.zip
chromium_src-d1ba5b511c94fb02b79ceae67a172d6bdb716e98.tar.gz
chromium_src-d1ba5b511c94fb02b79ceae67a172d6bdb716e98.tar.bz2
Makes it so deleting a bookmark from the context menu doesn't close
the bookmark menu. BUG=2469 TEST=click on a bookmark folder on the bookmark bar, right click on an item and chose delete. Make sure the folder stays up and still works correctly (and the item you deleted isn't there). Review URL: http://codereview.chromium.org/551178 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37424 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/bookmark_bar_view_test.cc')
-rw-r--r--chrome/browser/views/bookmark_bar_view_test.cc78
1 files changed, 76 insertions, 2 deletions
diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/views/bookmark_bar_view_test.cc
index 8e24366..3d84ff8 100644
--- a/chrome/browser/views/bookmark_bar_view_test.cc
+++ b/chrome/browser/views/bookmark_bar_view_test.cc
@@ -14,6 +14,7 @@
#include "chrome/common/pref_service.h"
#include "chrome/test/testing_profile.h"
#include "chrome/test/interactive_ui/view_event_test_base.h"
+#include "grit/generated_resources.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/button/text_button.h"
#include "views/controls/menu/menu_controller.h"
@@ -38,8 +39,8 @@ class TestingPageNavigator : public PageNavigator {
} // namespace
// Base class for event generating bookmark view tests. These test are intended
-// to exercise ChromeMenus, but that's easier done with BookmarkBarView rather
-// than ChromeMenu itself.
+// to exercise View's menus, but that's easier done with BookmarkBarView rather
+// than View's menu itself.
//
// SetUp creates a bookmark model with the following structure.
// All folders are in upper case, all URLs in lower case.
@@ -1101,3 +1102,76 @@ class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase {
};
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) {}
+
+ protected:
+ virtual void DoTestOnMessageLoop() {
+ // Show the other bookmarks.
+ views::TextButton* button = bb_view_->other_bookmarked_button();
+ ui_controls::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
+ ui_controls::DOWN | ui_controls::UP,
+ CreateEventTask(this, &BookmarkBarViewTest15::Step2));
+ }
+
+ private:
+ void Step2() {
+ // Menu should be showing.
+ views::MenuItemView* menu = bb_view_->GetMenu();
+ ASSERT_TRUE(menu != NULL);
+ ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
+
+ views::MenuItemView* child_menu =
+ menu->GetSubmenu()->GetMenuItemAt(1);
+ ASSERT_TRUE(child_menu != NULL);
+
+ deleted_menu_id_ = child_menu->GetCommand();
+
+ // 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,
+ CreateEventTask(this, &BookmarkBarViewTest15::Step3));
+ }
+
+ void Step3() {
+ // Make sure the context menu is showing.
+ views::MenuItemView* menu = bb_view_->GetContextMenu();
+ ASSERT_TRUE(menu != NULL);
+ ASSERT_TRUE(menu->GetSubmenu());
+ ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
+
+ views::MenuItemView* delete_menu =
+ menu->GetMenuItemByID(IDS_BOOKMARK_BAR_REMOVE);
+ ASSERT_TRUE(delete_menu);
+
+ // Click on the delete button.
+ ui_controls::MoveMouseToCenterAndPress(delete_menu,
+ ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP,
+ CreateEventTask(this, &BookmarkBarViewTest15::Step4));
+ }
+
+ void Step4() {
+ // The context menu should not be showing.
+ views::MenuItemView* context_menu = bb_view_->GetContextMenu();
+ ASSERT_TRUE(context_menu == NULL);
+
+ // But the menu should be showing.
+ views::MenuItemView* menu = bb_view_->GetMenu();
+ ASSERT_TRUE(menu != NULL);
+ ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
+
+ // And the deleted_menu_id_ should have been removed.
+ ASSERT_TRUE(menu->GetMenuItemByID(deleted_menu_id_) == NULL);
+
+ bb_view_->GetMenu()->GetMenuController()->Cancel(true);
+
+ Done();
+ }
+
+ int deleted_menu_id_;
+};
+
+VIEW_TEST(BookmarkBarViewTest15, MenuStaysVisibleAfterDelete)