OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/string_number_conversions.h" | 5 #include "base/string_number_conversions.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/automation/ui_controls.h" | 8 #include "chrome/browser/automation/ui_controls.h" |
9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 | 1443 |
1444 bb_view_->GetMenu()->GetMenuController()->CancelAll(); | 1444 bb_view_->GetMenu()->GetMenuController()->CancelAll(); |
1445 | 1445 |
1446 Done(); | 1446 Done(); |
1447 } | 1447 } |
1448 | 1448 |
1449 ContextMenuNotificationObserver observer_; | 1449 ContextMenuNotificationObserver observer_; |
1450 }; | 1450 }; |
1451 | 1451 |
1452 VIEW_TEST(BookmarkBarViewTest17, ContextMenus3) | 1452 VIEW_TEST(BookmarkBarViewTest17, ContextMenus3) |
| 1453 |
| 1454 // Verifies sibling menus works. Clicks on the 'other bookmarks' folder, then |
| 1455 // moves the mouse over the first item on the bookmark bar and makes sure the |
| 1456 // menu appears. |
| 1457 class BookmarkBarViewTest18 : public BookmarkBarViewEventTestBase { |
| 1458 protected: |
| 1459 virtual void DoTestOnMessageLoop() { |
| 1460 // Move the mouse to the other folder on the bookmark bar and press the |
| 1461 // left mouse button. |
| 1462 views::TextButton* button = bb_view_->other_bookmarked_button(); |
| 1463 ui_controls::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 1464 ui_controls::DOWN | ui_controls::UP, |
| 1465 CreateEventTask(this, &BookmarkBarViewTest18::Step2)); |
| 1466 } |
| 1467 |
| 1468 private: |
| 1469 void Step2() { |
| 1470 // Menu should be showing. |
| 1471 views::MenuItemView* menu = bb_view_->GetMenu(); |
| 1472 ASSERT_TRUE(menu != NULL); |
| 1473 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); |
| 1474 |
| 1475 // Move the mouse to the first folder on the bookmark bar |
| 1476 views::TextButton* button = GetBookmarkButton(0); |
| 1477 gfx::Point button_center(button->width() / 2, button->height() / 2); |
| 1478 views::View::ConvertPointToScreen(button, &button_center); |
| 1479 ui_controls::SendMouseMoveNotifyWhenDone( |
| 1480 button_center.x(), button_center.y(), |
| 1481 CreateEventTask(this, &BookmarkBarViewTest18::Step3)); |
| 1482 } |
| 1483 |
| 1484 void Step3() { |
| 1485 // Make sure the menu is showing. |
| 1486 views::MenuItemView* menu = bb_view_->GetMenu(); |
| 1487 ASSERT_TRUE(menu != NULL); |
| 1488 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); |
| 1489 |
| 1490 menu->GetMenuController()->CancelAll(); |
| 1491 |
| 1492 Done(); |
| 1493 } |
| 1494 }; |
| 1495 |
| 1496 VIEW_TEST(BookmarkBarViewTest18, SiblingMenu) |
OLD | NEW |