| 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 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 ASSERT_TRUE(menu != NULL); | 1490 ASSERT_TRUE(menu != NULL); |
| 1491 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); | 1491 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); |
| 1492 views::MenuItemView* child_menu = menu->GetSubmenu()->GetMenuItemAt(1); | 1492 views::MenuItemView* child_menu = menu->GetSubmenu()->GetMenuItemAt(1); |
| 1493 ASSERT_TRUE(child_menu != NULL); | 1493 ASSERT_TRUE(child_menu != NULL); |
| 1494 | 1494 |
| 1495 // The context menu and child_menu can be overlapped, calculate the | 1495 // The context menu and child_menu can be overlapped, calculate the |
| 1496 // non-intersected Rect of the child menu and click on its center to make | 1496 // non-intersected Rect of the child menu and click on its center to make |
| 1497 // sure the click is always on the child menu. | 1497 // sure the click is always on the child menu. |
| 1498 gfx::Rect context_rect = context_menu->GetSubmenu()->GetBoundsInScreen(); | 1498 gfx::Rect context_rect = context_menu->GetSubmenu()->GetBoundsInScreen(); |
| 1499 gfx::Rect child_menu_rect = child_menu->GetBoundsInScreen(); | 1499 gfx::Rect child_menu_rect = child_menu->GetBoundsInScreen(); |
| 1500 gfx::Rect clickable_rect = child_menu_rect.Subtract(context_rect); | 1500 gfx::Rect clickable_rect = child_menu_rect; |
| 1501 clickable_rect.Subtract(context_rect); |
| 1501 ASSERT_FALSE(clickable_rect.IsEmpty()); | 1502 ASSERT_FALSE(clickable_rect.IsEmpty()); |
| 1502 observer_.set_task(CreateEventTask(this, &BookmarkBarViewTest17::Step4)); | 1503 observer_.set_task(CreateEventTask(this, &BookmarkBarViewTest17::Step4)); |
| 1503 MoveMouseAndPress(clickable_rect.CenterPoint(), ui_controls::RIGHT, | 1504 MoveMouseAndPress(clickable_rect.CenterPoint(), ui_controls::RIGHT, |
| 1504 ui_controls::DOWN | ui_controls::UP, base::Closure()); | 1505 ui_controls::DOWN | ui_controls::UP, base::Closure()); |
| 1505 // Step4 will be invoked by ContextMenuNotificationObserver. | 1506 // Step4 will be invoked by ContextMenuNotificationObserver. |
| 1506 } | 1507 } |
| 1507 | 1508 |
| 1508 void Step4() { | 1509 void Step4() { |
| 1509 // The context menu should still be showing. | 1510 // The context menu should still be showing. |
| 1510 views::MenuItemView* context_menu = bb_view_->GetContextMenu(); | 1511 views::MenuItemView* context_menu = bb_view_->GetContextMenu(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 Done(); | 1651 Done(); |
| 1651 } | 1652 } |
| 1652 }; | 1653 }; |
| 1653 | 1654 |
| 1654 #if defined(OS_WIN) | 1655 #if defined(OS_WIN) |
| 1655 #define MAYBE_BookmarkBarViewTest19_SiblingMenu DISABLED_SiblingMenu | 1656 #define MAYBE_BookmarkBarViewTest19_SiblingMenu DISABLED_SiblingMenu |
| 1656 #else | 1657 #else |
| 1657 #define MAYBE_BookmarkBarViewTest19_SiblingMenu SiblingMenu | 1658 #define MAYBE_BookmarkBarViewTest19_SiblingMenu SiblingMenu |
| 1658 #endif | 1659 #endif |
| 1659 VIEW_TEST(BookmarkBarViewTest19, MAYBE_BookmarkBarViewTest19_SiblingMenu) | 1660 VIEW_TEST(BookmarkBarViewTest19, MAYBE_BookmarkBarViewTest19_SiblingMenu) |
| OLD | NEW |