OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 // Right click on the first menu item to trigger its context menu. | 1546 // Right click on the first menu item to trigger its context menu. |
1547 views::MenuItemView* menu = bb_view_->GetMenu(); | 1547 views::MenuItemView* menu = bb_view_->GetMenu(); |
1548 ASSERT_TRUE(menu != NULL); | 1548 ASSERT_TRUE(menu != NULL); |
1549 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); | 1549 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); |
1550 views::MenuItemView* child_menu = menu->GetSubmenu()->GetMenuItemAt(1); | 1550 views::MenuItemView* child_menu = menu->GetSubmenu()->GetMenuItemAt(1); |
1551 ASSERT_TRUE(child_menu != NULL); | 1551 ASSERT_TRUE(child_menu != NULL); |
1552 | 1552 |
1553 // The context menu and child_menu can be overlapped, calculate the | 1553 // The context menu and child_menu can be overlapped, calculate the |
1554 // non-intersected Rect of the child menu and click on its center to make | 1554 // non-intersected Rect of the child menu and click on its center to make |
1555 // sure the click is always on the child menu. | 1555 // sure the click is always on the child menu. |
1556 gfx::Rect context_rect = context_menu->GetSubmenu()->GetScreenBounds(); | 1556 gfx::Rect context_rect = context_menu->GetSubmenu()->GetBoundsInScreen(); |
1557 gfx::Rect child_menu_rect = child_menu->GetScreenBounds(); | 1557 gfx::Rect child_menu_rect = child_menu->GetBoundsInScreen(); |
1558 gfx::Rect clickable_rect = child_menu_rect.Subtract(context_rect); | 1558 gfx::Rect clickable_rect = child_menu_rect.Subtract(context_rect); |
1559 ASSERT_FALSE(clickable_rect.IsEmpty()); | 1559 ASSERT_FALSE(clickable_rect.IsEmpty()); |
1560 observer_.set_task(CreateEventTask(this, &BookmarkBarViewTest17::Step4)); | 1560 observer_.set_task(CreateEventTask(this, &BookmarkBarViewTest17::Step4)); |
1561 MoveMouseAndPress(clickable_rect.CenterPoint(), ui_controls::RIGHT, | 1561 MoveMouseAndPress(clickable_rect.CenterPoint(), ui_controls::RIGHT, |
1562 ui_controls::DOWN | ui_controls::UP, base::Closure()); | 1562 ui_controls::DOWN | ui_controls::UP, base::Closure()); |
1563 // Step4 will be invoked by ContextMenuNotificationObserver. | 1563 // Step4 will be invoked by ContextMenuNotificationObserver. |
1564 } | 1564 } |
1565 | 1565 |
1566 void Step4() { | 1566 void Step4() { |
1567 // The context menu should still be showing. | 1567 // The context menu should still be showing. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 Done(); | 1708 Done(); |
1709 } | 1709 } |
1710 }; | 1710 }; |
1711 | 1711 |
1712 #if defined(OS_WIN) | 1712 #if defined(OS_WIN) |
1713 #define MAYBE_BookmarkBarViewTest19_SiblingMenu DISABLED_SiblingMenu | 1713 #define MAYBE_BookmarkBarViewTest19_SiblingMenu DISABLED_SiblingMenu |
1714 #else | 1714 #else |
1715 #define MAYBE_BookmarkBarViewTest19_SiblingMenu SiblingMenu | 1715 #define MAYBE_BookmarkBarViewTest19_SiblingMenu SiblingMenu |
1716 #endif | 1716 #endif |
1717 VIEW_TEST(BookmarkBarViewTest19, MAYBE_BookmarkBarViewTest19_SiblingMenu) | 1717 VIEW_TEST(BookmarkBarViewTest19, MAYBE_BookmarkBarViewTest19_SiblingMenu) |
OLD | NEW |