summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortapted <tapted@chromium.org>2016-03-10 16:22:33 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-11 00:24:40 +0000
commitbb2a58ae2441fbfa4f5168baab1b1a5c0c047916 (patch)
tree0cf11a291637cc8a99866827ae6e5f32f62ae804
parent12219e2486572e53db494de348b09c5d7554a82c (diff)
downloadchromium_src-bb2a58ae2441fbfa4f5168baab1b1a5c0c047916.zip
chromium_src-bb2a58ae2441fbfa4f5168baab1b1a5c0c047916.tar.gz
chromium_src-bb2a58ae2441fbfa4f5168baab1b1a5c0c047916.tar.bz2
MacViews: Fix MenuControllerTest.SelectChildButtonView
Above the declaration for MenuController::OnMouseMoved(..) it says // NOTE: the coordinates of the events are in that of the // MenuScrollViewContainer. But the test wasn't doing that. I think on Mac the menu Widget is shifted down by the height of the main menu bar, so the test couldn't assume it's at the top left of the screen. BUG=592890 Review URL: https://codereview.chromium.org/1778243003 Cr-Commit-Position: refs/heads/master@{#380500}
-rw-r--r--ui/views/controls/menu/menu_controller_unittest.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/ui/views/controls/menu/menu_controller_unittest.cc b/ui/views/controls/menu/menu_controller_unittest.cc
index cdd53c2..90d58d9 100644
--- a/ui/views/controls/menu/menu_controller_unittest.cc
+++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -22,6 +22,7 @@
#include "ui/views/controls/menu/menu_delegate.h"
#include "ui/views/controls/menu/menu_item_view.h"
#include "ui/views/controls/menu/menu_message_loop.h"
+#include "ui/views/controls/menu/menu_scroll_view_container.h"
#include "ui/views/controls/menu/submenu_view.h"
#include "ui/views/test/views_test_base.h"
@@ -407,8 +408,9 @@ class MenuControllerTest : public ViewsTestBase {
menu_controller_->SetSelectionOnPointerDown(source, event);
}
- void ProcessMouseMoved(SubmenuView* source,
- const ui::MouseEvent& event) {
+ // Note that coordinates of events passed to MenuController must be in that of
+ // the MenuScrollViewContainer.
+ void ProcessMouseMoved(SubmenuView* source, const ui::MouseEvent& event) {
menu_controller_->OnMouseMoved(source, event);
}
@@ -764,10 +766,11 @@ TEST_F(MenuControllerTest, SelectChildButtonView) {
EXPECT_TRUE(button3->IsHotTracked());
// Move a mouse to hot track the |button1|.
+ SubmenuView* sub_menu = menu_item()->GetSubmenu();
gfx::Point location(button1->GetBoundsInScreen().CenterPoint());
+ View::ConvertPointFromScreen(sub_menu->GetScrollViewContainer(), &location);
ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location,
ui::EventTimeForNow(), 0, 0);
- SubmenuView* sub_menu = menu_item()->GetSubmenu();
ProcessMouseMoved(sub_menu, event);
// Incrementing selection should move hot tracking to the second button (next