Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: ui/views/controls/menu/menu_controller_unittest.cc

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/menu/menu_controller_unittest.cc
diff --git a/ui/views/controls/menu/menu_controller_unittest.cc b/ui/views/controls/menu/menu_controller_unittest.cc
index fcdb3303235dd6f597db7c21bbf99da9f1300a2f..eb3aa392f8e880a72492d75fefe2cc6526091bb6 100644
--- a/ui/views/controls/menu/menu_controller_unittest.cc
+++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -954,8 +954,9 @@ TEST_F(MenuControllerTest, SelectChildButtonView) {
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);
+ ui::MouseEvent event(
+ ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ProcessMouseMoved(sub_menu, event);
// Incrementing selection should move hot tracking to the second button (next
@@ -1251,8 +1252,10 @@ TEST_F(MenuControllerTest, HostReceivesInputBeforeDestruction) {
std::unique_ptr<MenuHostRootView> root_view(CreateMenuHostRootView(host));
DestroyMenuController();
- ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
+ ui::MouseEvent event(
+ ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
// This should not attempt to access the destroyed MenuController and should
// not crash.
@@ -1315,8 +1318,10 @@ TEST_F(MenuControllerTest, AsynchronousRepostEvent) {
sub_menu->ShowAt(owner(), item->bounds(), false);
gfx::Point location(sub_menu->bounds().bottom_right());
location.Offset(1, 1);
- ui::MouseEvent event(ui::ET_MOUSE_PRESSED, location, location,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
+ ui::MouseEvent event(
+ ui::ET_MOUSE_PRESSED, location, location, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
// When attempting to select outside of all menus this should lead to a
// shutdown. This should not crash while attempting to repost the event.
@@ -1415,8 +1420,10 @@ TEST_F(MenuControllerTest, AsynchronousRepostEventDeletesController) {
sub_menu->ShowAt(owner(), item->bounds(), true);
gfx::Point location(sub_menu->bounds().bottom_right());
location.Offset(1, 1);
- ui::MouseEvent event(ui::ET_MOUSE_PRESSED, location, location,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
+ ui::MouseEvent event(
+ ui::ET_MOUSE_PRESSED, location, location, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
// This will lead to MenuController being deleted during the event repost.
// The remainder of this test, and TearDown should not crash.
@@ -1652,9 +1659,10 @@ TEST_F(MenuControllerTest, RepostEventToEmptyMenuItem) {
// Press down outside of the context menu, and within the empty menu item.
// This should close the first context menu.
gfx::Point press_location(sub_menu_view->bounds().CenterPoint());
- ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, press_location,
- press_location, ui::EventTimeForNow(),
- ui::EF_RIGHT_MOUSE_BUTTON, 0);
+ ui::MouseEvent press_event(
+ ui::ET_MOUSE_PRESSED, press_location, press_location,
+ ui::EventTimeForNow(), ui::EF_RIGHT_MOUSE_BUTTON, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ProcessMousePressed(nested_menu_submenu, press_event);
EXPECT_EQ(nested_controller_delegate_1->on_menu_closed_called(), 1);
EXPECT_EQ(menu_controller_delegate(), GetCurrentDelegate());
@@ -1663,17 +1671,19 @@ TEST_F(MenuControllerTest, RepostEventToEmptyMenuItem) {
// a drag in the empty menu item. This should not hide the menu.
SetState(sub_menu_item.get());
press_location.Offset(-5, 0);
- ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, press_location,
- press_location, ui::EventTimeForNow(),
- ui::EF_RIGHT_MOUSE_BUTTON, 0);
+ ui::MouseEvent drag_event(
+ ui::ET_MOUSE_DRAGGED, press_location, press_location,
+ ui::EventTimeForNow(), ui::EF_RIGHT_MOUSE_BUTTON, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ProcessMouseDragged(sub_menu_view, drag_event);
EXPECT_EQ(menu_delegate()->will_hide_menu_count(), 0);
// Release the mouse in the empty menu item, triggering a context menu
// request.
- ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, press_location,
- press_location, ui::EventTimeForNow(),
- ui::EF_RIGHT_MOUSE_BUTTON, 0);
+ ui::MouseEvent release_event(
+ ui::ET_MOUSE_RELEASED, press_location, press_location,
+ ui::EventTimeForNow(), ui::EF_RIGHT_MOUSE_BUTTON, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ProcessMouseReleased(sub_menu_view, release_event);
EXPECT_EQ(sub_menu_item_delegate->show_context_menu_count(), 1);
EXPECT_EQ(sub_menu_item_delegate->show_context_menu_source(),

Powered by Google App Engine
This is Rietveld 408576698