| Index: chrome/browser/views/bookmark_bar_view_test.cc
|
| ===================================================================
|
| --- chrome/browser/views/bookmark_bar_view_test.cc (revision 22055)
|
| +++ chrome/browser/views/bookmark_bar_view_test.cc (working copy)
|
| @@ -975,3 +975,80 @@
|
| };
|
|
|
| VIEW_TEST(BookmarkBarViewTest12, CloseWithModalDialog)
|
| +
|
| +// Tests clicking on the separator of a context menu (this is for coverage of
|
| +// bug 17862).
|
| +class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase {
|
| + protected:
|
| + virtual void DoTestOnMessageLoop() {
|
| + // Move the mouse to the first folder on the bookmark bar and press the
|
| + // mouse.
|
| + views::TextButton* button = bb_view_->other_bookmarked_button();
|
| + ui_controls::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
|
| + ui_controls::DOWN | ui_controls::UP,
|
| + CreateEventTask(this, &BookmarkBarViewTest13::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(0);
|
| + ASSERT_TRUE(child_menu != NULL);
|
| +
|
| + // 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,
|
| + CreateEventTask(this, &BookmarkBarViewTest13::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());
|
| +
|
| + // Find the first separator.
|
| + views::SubmenuView* submenu = menu->GetSubmenu();
|
| + views::View* separator_view = NULL;
|
| + for (int i = 0; i < submenu->GetChildViewCount(); ++i) {
|
| + if (submenu->GetChildViewAt(i)->GetID() !=
|
| + views::MenuItemView::kMenuItemViewID) {
|
| + separator_view = submenu->GetChildViewAt(i);
|
| + break;
|
| + }
|
| + }
|
| + ASSERT_TRUE(separator_view);
|
| +
|
| + // Click on the separator. Clicking on the separator shouldn't visually
|
| + // change anything.
|
| + ui_controls::MoveMouseToCenterAndPress(separator_view,
|
| + ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP,
|
| + CreateEventTask(this, &BookmarkBarViewTest13::Step4));
|
| + }
|
| +
|
| + void Step4() {
|
| + // The context menu should still be showing.
|
| + views::MenuItemView* menu = bb_view_->GetContextMenu();
|
| + ASSERT_TRUE(menu != NULL);
|
| + ASSERT_TRUE(menu->GetSubmenu());
|
| + ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
|
| +
|
| + // Select the first context menu item.
|
| + ui_controls::MoveMouseToCenterAndPress(menu->GetSubmenu()->GetMenuItemAt(0),
|
| + ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP,
|
| + CreateEventTask(this, &BookmarkBarViewTest13::Step5));
|
| + }
|
| +
|
| + void Step5() {
|
| + DLOG(WARNING) << " DONE";
|
| + Done();
|
| + }
|
| +};
|
| +
|
| +VIEW_TEST(BookmarkBarViewTest13, ClickOnContextMenuSeparator)
|
|
|