diff options
author | horo <horo@chromium.org> | 2014-09-16 20:49:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-17 03:49:31 +0000 |
commit | f0003ece045e6e30ff3d70be4ea818c365b08cf6 (patch) | |
tree | 400db20744e6a5eb06c3feae74e6211606e00170 | |
parent | 366f7a7500ef5951b17bb8aeb087fcd90559e347 (diff) | |
download | chromium_src-f0003ece045e6e30ff3d70be4ea818c365b08cf6.zip chromium_src-f0003ece045e6e30ff3d70be4ea818c365b08cf6.tar.gz chromium_src-f0003ece045e6e30ff3d70be4ea818c365b08cf6.tar.bz2 |
Revert of Clean up GestureEventDetails constructors and fix unit tests (patchset #1 id:20001 of https://codereview.chromium.org/573963005/)
Reason for revert:
This broke TouchEditableImplAuraTest.TouchSelectionOnLongPressTest.
[24874:24874:0916/151803:584385367:FATAL:gesture_event_details.cc(54)] Check failed: false. Invalid event type for constructor: 32
http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=undefined&tests=TouchEditableImplAuraTest.TouchSelectionOnLongPressTest&testType=content_browsertests
http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=undefined&tests=TouchEditableImplAuraTest.TouchSelectionOnLongPressTest&testType=content_browsertests
Original issue's description:
> Clean up GestureEventDetails constructors and fix unit tests.
>
> A new version of Issue 565583005: Clean up GestureEventDetails
> constructors
> https://codereview.chromium.org/565583005/
>
> BUG=350942
>
> TBR=tdresser@chromium.org, jdduke@chromium.org, sadrul@chromium.org
>
> Committed: https://crrev.com/874611d5ab5b879648682c1ea41062bebc9c95e5
> Cr-Commit-Position: refs/heads/master@{#295144}
TBR=sky@chromium.org,lanwei@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=350942
Review URL: https://codereview.chromium.org/577833003
Cr-Commit-Position: refs/heads/master@{#295223}
31 files changed, 218 insertions, 178 deletions
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 21510e7..004298c 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc @@ -64,11 +64,12 @@ gfx::Rect AdjustDragImageBoundsForScaleAndOffset( void DispatchGestureEndToWindow(aura::Window* window) { if (window && window->delegate()) { - ui::GestureEvent gesture_end(0, - 0, - 0, - ui::EventTimeForNow(), - ui::GestureEventDetails(ui::ET_GESTURE_END)); + ui::GestureEvent gesture_end( + 0, + 0, + 0, + ui::EventTimeForNow(), + ui::GestureEventDetails(ui::ET_GESTURE_END, 0, 0)); window->delegate()->OnGestureEvent(&gesture_end); } } diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index 252b567..48ff847 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -273,7 +273,7 @@ void AddViewToWidgetAndResize(views::Widget* widget, views::View* view) { } void DispatchGesture(ui::EventType gesture_type, gfx::Point location) { - ui::GestureEventDetails event_details(gesture_type); + ui::GestureEventDetails event_details(gesture_type, 0, 0); event_details.set_oldest_touch_id(1); ui::GestureEvent gesture_event( location.x(), location.y(), 0, ui::EventTimeForNow(), event_details); diff --git a/ash/shelf/shelf_tooltip_manager_unittest.cc b/ash/shelf/shelf_tooltip_manager_unittest.cc index bafe29c..295c7e9 100644 --- a/ash/shelf/shelf_tooltip_manager_unittest.cc +++ b/ash/shelf/shelf_tooltip_manager_unittest.cc @@ -207,11 +207,9 @@ TEST_F(ShelfTooltipManagerTest, ShouldHideForEvents) { // Should hide for gesture events. ui::GestureEvent gesture_event( - 0, - 0, - ui::EF_NONE, + 0, 0, ui::EF_NONE, base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), - ui::GestureEventDetails(ui::ET_GESTURE_BEGIN)); + ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f)); SetEventTarget(tooltip_widget->GetNativeWindow(), &gesture_event); event_handler->OnGestureEvent(&gesture_event); EXPECT_FALSE(gesture_event.handled()); diff --git a/ash/system/chromeos/rotation/tray_rotation_lock_unittest.cc b/ash/system/chromeos/rotation/tray_rotation_lock_unittest.cc index 7a53f9d..dd6eb40 100644 --- a/ash/system/chromeos/rotation/tray_rotation_lock_unittest.cc +++ b/ash/system/chromeos/rotation/tray_rotation_lock_unittest.cc @@ -209,8 +209,8 @@ TEST_F(TrayRotationLockTest, PerformActionOnDefaultView) { EnableMaximizeModeWindowManager(true); ASSERT_FALSE(tray_view()->visible()); - ui::GestureEvent tap( - 0, 0, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_TAP)); + ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0.0f, 0.0f)); default_view()->OnGestureEvent(&tap); EXPECT_TRUE(maximize_mode_controller->rotation_locked()); EXPECT_TRUE(tray_view()->visible()); diff --git a/ash/system/overview/overview_button_tray_unittest.cc b/ash/system/overview/overview_button_tray_unittest.cc index 27ff367..2471533 100644 --- a/ash/system/overview/overview_button_tray_unittest.cc +++ b/ash/system/overview/overview_button_tray_unittest.cc @@ -78,8 +78,8 @@ TEST_F(OverviewButtonTrayTest, PerformAction) { // Overview Mode only works when there is a window scoped_ptr<aura::Window> window( CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); - ui::GestureEvent tap( - 0, 0, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_TAP)); + ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0.0f, 0.0f)); GetTray()->PerformAction(tap); EXPECT_TRUE(Shell::GetInstance()->window_selector_controller()-> IsSelecting()); diff --git a/athena/home/home_card_gesture_manager_unittest.cc b/athena/home/home_card_gesture_manager_unittest.cc index 19fc17c..aea59b8 100644 --- a/athena/home/home_card_gesture_manager_unittest.cc +++ b/athena/home/home_card_gesture_manager_unittest.cc @@ -46,13 +46,8 @@ class HomeCardGestureManagerTest : public test::AthenaTestBase, // Process a gesture event for our use case. bool ProcessGestureEvent(ui::EventType type, int y) { - ui::GestureEventDetails details; - if (type == ui::ET_GESTURE_SCROLL_BEGIN || - type == ui::ET_GESTURE_SCROLL_UPDATE) - details = ui::GestureEventDetails(type, 0, (y - last_y_)); - else - details = ui::GestureEventDetails(type); - ui::GestureEvent event(0, y, ui::EF_NONE, base::TimeDelta(), details); + ui::GestureEvent event(0, y, ui::EF_NONE, base::TimeDelta(), + ui::GestureEventDetails(type, 0, (y - last_y_))); if (type == ui::ET_GESTURE_SCROLL_BEGIN) { // Compute the position that the home card would have wrt to the top of // the screen if the screen had screen_bounds(). diff --git a/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc b/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc index 01f5288..b767efe 100644 --- a/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc +++ b/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc @@ -63,7 +63,7 @@ class AutofillPopupBaseViewTest : public InProcessBrowserTest { point.y(), 0, ui::EventTimeForNow(), - ui::GestureEventDetails(type)); + ui::GestureEventDetails(type, 0, 0)); } void SimulateGesture(ui::GestureEvent* event) { diff --git a/chrome/browser/ui/views/desktop_media_picker_views_unittest.cc b/chrome/browser/ui/views/desktop_media_picker_views_unittest.cc index 4fb7576..511493d 100644 --- a/chrome/browser/ui/views/desktop_media_picker_views_unittest.cc +++ b/chrome/browser/ui/views/desktop_media_picker_views_unittest.cc @@ -126,9 +126,13 @@ TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnDoubleTap) { content::DesktopMediaID::TYPE_WINDOW, kFakeId))); media_list_->AddSource(kFakeId); - ui::GestureEventDetails details(ui::ET_GESTURE_TAP); - details.set_tap_count(2); - ui::GestureEvent double_tap(10, 10, 0, base::TimeDelta(), details); + + ui::GestureEvent double_tap( + 10, + 10, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP, 2, 0)); GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnGestureEvent( &double_tap); diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc index 9ac23b4..4b6b5e8 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc @@ -335,16 +335,17 @@ IN_PROC_BROWSER_TEST_F(TabDragControllerTest, GestureEndShouldEndDragTest) { tab_1_center.x(), 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); + ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN, 0.0f, 0.0f)); tab_strip->MaybeStartDrag(tab1, gesture_tap_down, tab_strip->GetSelectionModel()); EXPECT_TRUE(TabDragController::IsActive()); - ui::GestureEvent gesture_end(tab_1_center.x(), - tab_1_center.x(), - 0, - base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_END)); + ui::GestureEvent gesture_end( + tab_1_center.x(), + tab_1_center.x(), + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_END, 0.0f, 0.0f)); tab_strip->OnGestureEvent(&gesture_end); EXPECT_FALSE(TabDragController::IsActive()); EXPECT_FALSE(tab_strip->IsDragSessionActive()); diff --git a/content/browser/renderer_host/input/gesture_text_selector_unittest.cc b/content/browser/renderer_host/input/gesture_text_selector_unittest.cc index 5304244..762ef62 100644 --- a/content/browser/renderer_host/input/gesture_text_selector_unittest.cc +++ b/content/browser/renderer_host/input/gesture_text_selector_unittest.cc @@ -61,7 +61,7 @@ class GestureTextSelectorTest : public testing::Test, base::TimeTicks event_time, float x, float y) { - return GestureEventData(GestureEventDetails(type), + return GestureEventData(GestureEventDetails(type, 0, 0), 0, MotionEvent::TOOL_TYPE_FINGER, event_time, diff --git a/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc b/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc index f97f6df..370e4c7 100644 --- a/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc +++ b/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc @@ -229,7 +229,7 @@ IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest, 10, 0, ui::EventTimeForNow(), - ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS, 0, 0)); touch_editable->Reset(); rwhva->OnGestureEvent(&long_press); touch_editable->WaitForSelectionChangeCallback(); @@ -249,7 +249,7 @@ IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest, 10, 0, ui::EventTimeForNow(), - ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN)); + ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN, 0, 0)); rwhva->OnGestureEvent(&scroll_begin); EXPECT_FALSE(GetTouchSelectionController(touch_editable)); @@ -259,7 +259,7 @@ IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest, 10, 0, ui::EventTimeForNow(), - ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END)); + ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END, 0, 0)); rwhva->OnGestureEvent(&scroll_end); EXPECT_TRUE(GetTouchSelectionController(touch_editable)); } @@ -284,7 +284,7 @@ IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest, 10, 0, ui::EventTimeForNow(), - ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS, 0, 0)); touch_editable->Reset(); rwhva->OnGestureEvent(&long_press); touch_editable->WaitForSelectionChangeCallback(); @@ -370,9 +370,12 @@ IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest, EXPECT_EQ(GetRenderWidgetHostViewAura(touch_editable), rwhva); // Double-tap to select word. - ui::GestureEventDetails details(ui::ET_GESTURE_TAP); - details.set_tap_count(2); - ui::GestureEvent double_tap(10, 10, 0, ui::EventTimeForNow(), details); + ui::GestureEvent double_tap( + 10, + 10, + 0, + ui::EventTimeForNow(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP, 2, 0)); touch_editable->Reset(); rwhva->OnGestureEvent(&double_tap); touch_editable->WaitForSelectionChangeCallback(); diff --git a/ui/aura/remote_window_tree_host_win.cc b/ui/aura/remote_window_tree_host_win.cc index 80ffc99..f939ccb 100644 --- a/ui/aura/remote_window_tree_host_win.cc +++ b/ui/aura/remote_window_tree_host_win.cc @@ -389,7 +389,7 @@ void RemoteWindowTreeHostWin::OnEdgeGesture() { 0, 0, ui::EventTimeForNow(), - ui::GestureEventDetails(ui::ET_GESTURE_WIN8_EDGE_SWIPE)); + ui::GestureEventDetails(ui::ET_GESTURE_WIN8_EDGE_SWIPE, 0, 0)); SendEventToProcessor(&event); } diff --git a/ui/aura/window_event_dispatcher_unittest.cc b/ui/aura/window_event_dispatcher_unittest.cc index 6d84645..d00c4e2 100644 --- a/ui/aura/window_event_dispatcher_unittest.cc +++ b/ui/aura/window_event_dispatcher_unittest.cc @@ -1322,7 +1322,7 @@ TEST_F(WindowEventDispatcherTest, RepostTapdownGestureTest) { scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); - ui::GestureEventDetails details(ui::ET_GESTURE_TAP_DOWN); + ui::GestureEventDetails details(ui::ET_GESTURE_TAP_DOWN, 0.0f, 0.0f); gfx::Point point(10, 10); ui::GestureEvent event(point.x(), point.y(), diff --git a/ui/events/gesture_detection/gesture_event_data.cc b/ui/events/gesture_detection/gesture_event_data.cc index 2102f23..41824e8 100644 --- a/ui/events/gesture_detection/gesture_event_data.cc +++ b/ui/events/gesture_detection/gesture_event_data.cc @@ -36,7 +36,7 @@ GestureEventData::GestureEventData(const GestureEventDetails& details, GestureEventData::GestureEventData(EventType type, const GestureEventData& other) - : details(type), + : details(type, 0, 0), motion_event_id(other.motion_event_id), primary_tool_type(other.primary_tool_type), time(other.time), diff --git a/ui/events/gesture_detection/gesture_event_data_packet_unittest.cc b/ui/events/gesture_detection/gesture_event_data_packet_unittest.cc index f8af11e..01330b3 100644 --- a/ui/events/gesture_detection/gesture_event_data_packet_unittest.cc +++ b/ui/events/gesture_detection/gesture_event_data_packet_unittest.cc @@ -16,7 +16,7 @@ const float kTouchX = 13.7f; const float kTouchY = 14.2f; GestureEventData CreateGesture(EventType type) { - return GestureEventData(GestureEventDetails(type), + return GestureEventData(GestureEventDetails(type, 0, 0), 0, MotionEvent::TOOL_TYPE_FINGER, base::TimeTicks(), diff --git a/ui/events/gesture_detection/gesture_provider.cc b/ui/events/gesture_detection/gesture_provider.cc index 981eb0a..b31ec59 100644 --- a/ui/events/gesture_detection/gesture_provider.cc +++ b/ui/events/gesture_detection/gesture_provider.cc @@ -246,8 +246,7 @@ class GestureProvider::GestureListenerImpl : 1.0f - kDoubleTapDragZoomSpeed, std::abs(dy)); } - GestureEventDetails pinch_details(ET_GESTURE_PINCH_UPDATE); - pinch_details.set_scale(scale); + GestureEventDetails pinch_details(ET_GESTURE_PINCH_UPDATE, scale, 0); Send(CreateGesture(pinch_details, e.GetId(), e.GetToolType(), @@ -264,7 +263,7 @@ class GestureProvider::GestureListenerImpl // GestureDetector::GestureListener implementation. virtual bool OnDown(const MotionEvent& e) OVERRIDE { - GestureEventDetails tap_details(ET_GESTURE_TAP_DOWN); + GestureEventDetails tap_details(ET_GESTURE_TAP_DOWN, 0, 0); Send(CreateGesture(tap_details, e)); // Return true to indicate that we want to handle touch. @@ -404,7 +403,7 @@ class GestureProvider::GestureListenerImpl } virtual void OnShowPress(const MotionEvent& e) OVERRIDE { - GestureEventDetails show_press_details(ET_GESTURE_SHOW_PRESS); + GestureEventDetails show_press_details(ET_GESTURE_SHOW_PRESS, 0, 0); show_press_event_sent_ = true; Send(CreateGesture(show_press_details, e)); } @@ -434,7 +433,7 @@ class GestureProvider::GestureListenerImpl if (e.GetAction() == MotionEvent::ACTION_UP && !current_longpress_time_.is_null() && !IsScaleGestureDetectionInProgress()) { - GestureEventDetails long_tap_details(ET_GESTURE_LONG_TAP); + GestureEventDetails long_tap_details(ET_GESTURE_LONG_TAP, 0, 0); Send(CreateGesture(long_tap_details, e)); return true; } @@ -483,7 +482,7 @@ class GestureProvider::GestureListenerImpl virtual void OnLongPress(const MotionEvent& e) OVERRIDE { DCHECK(!IsDoubleTapInProgress()); SetIgnoreSingleTap(true); - GestureEventDetails long_press_details(ET_GESTURE_LONG_PRESS); + GestureEventDetails long_press_details(ET_GESTURE_LONG_PRESS, 0, 0); Send(CreateGesture(long_press_details, e)); } @@ -522,7 +521,7 @@ class GestureProvider::GestureListenerImpl size_t touch_point_count, const gfx::RectF& bounding_box, int flags) { - return GestureEventData(GestureEventDetails(type), + return GestureEventData(GestureEventDetails(type, 0, 0), motion_event_id, primary_tool_type, time, @@ -551,16 +550,14 @@ class GestureProvider::GestureListenerImpl } GestureEventData CreateGesture(EventType type, const MotionEvent& event) { - return CreateGesture(GestureEventDetails(type), event); + return CreateGesture(GestureEventDetails(type, 0, 0), event); } GestureEventData CreateTapGesture(EventType type, const MotionEvent& event) { // Set the tap count to 1 even for ET_GESTURE_DOUBLE_TAP, in order to be // consistent with double tap behavior on a mobile viewport. See // crbug.com/234986 for context. - GestureEventDetails details(type); - details.set_tap_count(1); - return CreateGesture(details, event); + return CreateGesture(GestureEventDetails(type, 1, 0), event); } gfx::RectF GetBoundingBox(const MotionEvent& event, EventType type) { diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter.cc b/ui/events/gesture_detection/touch_disposition_gesture_filter.cc index fcb92d4..a72390c 100644 --- a/ui/events/gesture_detection/touch_disposition_gesture_filter.cc +++ b/ui/events/gesture_detection/touch_disposition_gesture_filter.cc @@ -21,7 +21,7 @@ GestureEventData CreateGesture(EventType type, const GestureEventDataPacket& packet) { // As the event is purely synthetic, we needn't be strict with event flags. int flags = EF_NONE; - return GestureEventData(GestureEventDetails(type), + return GestureEventData(GestureEventDetails(type, 0, 0), motion_event_id, primary_tool_type, packet.timestamp(), diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc index 7e99c94..2e37efb 100644 --- a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc +++ b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc @@ -230,7 +230,7 @@ class TouchDispositionGestureFilterTest float y, float diameter) { return GestureEventData( - GestureEventDetails(type), + GestureEventDetails(type, 0, 0), 0, MotionEvent::TOOL_TYPE_FINGER, base::TimeTicks(), diff --git a/ui/events/gesture_event_details.cc b/ui/events/gesture_event_details.cc index 7807131..3f478e5 100644 --- a/ui/events/gesture_event_details.cc +++ b/ui/events/gesture_event_details.cc @@ -10,16 +10,10 @@ GestureEventDetails::GestureEventDetails() : type_(ET_UNKNOWN), touch_points_(0), oldest_touch_id_(-1) { } -GestureEventDetails::GestureEventDetails(ui::EventType type) - : type_(type), touch_points_(1), oldest_touch_id_(-1) { - DCHECK_GE(type, ET_GESTURE_TYPE_START); - DCHECK_LE(type, ET_GESTURE_TYPE_END); -} - GestureEventDetails::GestureEventDetails(ui::EventType type, float delta_x, float delta_y) - : type_(type), touch_points_(1), oldest_touch_id_(-1) { + : type_(type), touch_points_(1), oldest_touch_id_(0) { DCHECK_GE(type, ET_GESTURE_TYPE_START); DCHECK_LE(type, ET_GESTURE_TYPE_END); switch (type_) { @@ -43,6 +37,11 @@ GestureEventDetails::GestureEventDetails(ui::EventType type, data.first_finger_enclosing_rectangle.height = delta_y; break; + case ui::ET_GESTURE_PINCH_UPDATE: + data.scale = delta_x; + CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for pinch"; + break; + case ui::ET_GESTURE_SWIPE: data.swipe.left = delta_x < 0; data.swipe.right = delta_x > 0; @@ -50,8 +49,19 @@ GestureEventDetails::GestureEventDetails(ui::EventType type, data.swipe.down = delta_y > 0; break; + case ui::ET_GESTURE_TAP: + case ui::ET_GESTURE_DOUBLE_TAP: + case ui::ET_GESTURE_TAP_UNCONFIRMED: + data.tap_count = static_cast<int>(delta_x); + CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for tap."; + break; + default: - NOTREACHED() << "Invalid event type for constructor: " << type; + if (delta_x != 0.f || delta_y != 0.f) { + DLOG(WARNING) << "A gesture event (" << type << ") had unknown data: (" + << delta_x << "," << delta_y; + } + break; } } diff --git a/ui/events/gesture_event_details.h b/ui/events/gesture_event_details.h index da7a60b..58d28fa 100644 --- a/ui/events/gesture_event_details.h +++ b/ui/events/gesture_event_details.h @@ -16,7 +16,6 @@ namespace ui { struct EVENTS_BASE_EXPORT GestureEventDetails { public: GestureEventDetails(); - explicit GestureEventDetails(EventType type); GestureEventDetails(EventType type, float delta_x, float delta_y); EventType type() const { return type_; } @@ -124,12 +123,6 @@ struct EVENTS_BASE_EXPORT GestureEventDetails { data.tap_count = tap_count; } - void set_scale(float scale) { - DCHECK_GE(scale, 0.0f); - DCHECK_EQ(type_, ET_GESTURE_PINCH_UPDATE); - data.scale = scale; - } - private: EventType type_; union Details { diff --git a/ui/events/test/event_generator.cc b/ui/events/test/event_generator.cc index ad9d597..05dd286 100644 --- a/ui/events/test/event_generator.cc +++ b/ui/events/test/event_generator.cc @@ -248,7 +248,11 @@ void EventGenerator::PressMoveAndReleaseTouchToCenterOf(EventTarget* window) { void EventGenerator::GestureEdgeSwipe() { ui::GestureEvent gesture( - 0, 0, 0, Now(), ui::GestureEventDetails(ui::ET_GESTURE_WIN8_EDGE_SWIPE)); + 0, + 0, + 0, + Now(), + ui::GestureEventDetails(ui::ET_GESTURE_WIN8_EDGE_SWIPE, 0, 0)); Dispatch(&gesture); } diff --git a/ui/views/controls/button/custom_button_unittest.cc b/ui/views/controls/button/custom_button_unittest.cc index a5d97c9..49d9987 100644 --- a/ui/views/controls/button/custom_button_unittest.cc +++ b/ui/views/controls/button/custom_button_unittest.cc @@ -36,7 +36,7 @@ class TestCustomButton : public CustomButton { }; void PerformGesture(CustomButton* button, ui::EventType event_type) { - ui::GestureEventDetails gesture_details(event_type); + ui::GestureEventDetails gesture_details(event_type, 0, 0); base::TimeDelta time_stamp = base::TimeDelta::FromMicroseconds(0); ui::GestureEvent gesture_event(0, 0, 0, time_stamp, gesture_details); button->OnGestureEvent(&gesture_event); diff --git a/ui/views/controls/table/table_view_unittest.cc b/ui/views/controls/table/table_view_unittest.cc index 6ce06c8..e592f2e 100644 --- a/ui/views/controls/table/table_view_unittest.cc +++ b/ui/views/controls/table/table_view_unittest.cc @@ -198,7 +198,8 @@ class TableViewTest : public testing::Test { void TapOnRow(int row) { const int y = row * table_->row_height(); - const ui::GestureEventDetails event_details(ui::ET_GESTURE_TAP); + const ui::GestureEventDetails event_details(ui::ET_GESTURE_TAP, + .0f, .0f); ui::GestureEvent tap(0, y, 0, base::TimeDelta(), event_details); table_->OnGestureEvent(&tap); } @@ -311,14 +312,14 @@ TEST_F(TableViewTest, ResizeViaGesture) { 0, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN)); + ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN, .0f, .0f)); helper_->header()->OnGestureEvent(&scroll_begin); ui::GestureEvent scroll_update( x - 1, 0, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_UPDATE)); + ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_UPDATE, .0f, .0f)); helper_->header()->OnGestureEvent(&scroll_update); // This should shrink the first column and pull the second column in. diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc index b7a6117..2cd92c0 100644 --- a/ui/views/controls/textfield/textfield_unittest.cc +++ b/ui/views/controls/textfield/textfield_unittest.cc @@ -103,8 +103,16 @@ class TestTextfield : public views::Textfield { // Convenience to make constructing a GestureEvent simpler. class GestureEventForTest : public ui::GestureEvent { public: - GestureEventForTest(int x, int y, ui::GestureEventDetails details) - : GestureEvent(x, y, 0, base::TimeDelta(), details) {} + GestureEventForTest(ui::EventType type, + int x, + int y, + float delta_x, + float delta_y) + : GestureEvent(x, + y, + 0, + base::TimeDelta(), + ui::GestureEventDetails(type, delta_x, delta_y)) {} private: DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); @@ -322,26 +330,23 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController { // Simulates a complete tap. void Tap(const gfx::Point& point) { GestureEventForTest begin( - point.x(), point.y(), ui::GestureEventDetails(ui::ET_GESTURE_BEGIN)); + ui::ET_GESTURE_BEGIN, point.x(), point.y(), 0.0f, 0.0f); textfield_->OnGestureEvent(&begin); GestureEventForTest tap_down( - point.x(), point.y(), ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); + ui::ET_GESTURE_TAP_DOWN, point.x(), point.y(), 0.0f, 0.0f); textfield_->OnGestureEvent(&tap_down); GestureEventForTest show_press( - point.x(), - point.y(), - ui::GestureEventDetails(ui::ET_GESTURE_SHOW_PRESS)); + ui::ET_GESTURE_SHOW_PRESS, point.x(), point.y(), 0.0f, 0.0f); textfield_->OnGestureEvent(&show_press); - ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP); - tap_details.set_tap_count(1); - GestureEventForTest tap(point.x(), point.y(), tap_details); + GestureEventForTest tap( + ui::ET_GESTURE_TAP, point.x(), point.y(), 1.0f, 0.0f); textfield_->OnGestureEvent(&tap); GestureEventForTest end( - point.x(), point.y(), ui::GestureEventDetails(ui::ET_GESTURE_END)); + ui::ET_GESTURE_END, point.x(), point.y(), 0.0f, 0.0f); textfield_->OnGestureEvent(&end); } @@ -1952,9 +1957,7 @@ TEST_F(TextfieldTest, TouchSelectionAndDraggingTest) { CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableTouchEditing); // Tapping on the textfield should turn on the TouchSelectionController. - ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP); - tap_details.set_tap_count(1); - GestureEventForTest tap(x, 0, tap_details); + GestureEventForTest tap(ui::ET_GESTURE_TAP, x, 0, 1.0f, 0.0f); textfield_->OnGestureEvent(&tap); EXPECT_TRUE(test_api_->touch_selection_controller()); @@ -1965,8 +1968,7 @@ TEST_F(TextfieldTest, TouchSelectionAndDraggingTest) { // With touch editing enabled, long press should not show context menu. // Instead, select word and invoke TouchSelectionController. - GestureEventForTest long_press_1( - x, 0, ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + GestureEventForTest long_press_1(ui::ET_GESTURE_LONG_PRESS, x, 0, 0.0f, 0.0f); textfield_->OnGestureEvent(&long_press_1); EXPECT_STR_EQ("hello", textfield_->GetSelectedText()); EXPECT_TRUE(test_api_->touch_selection_controller()); @@ -1975,8 +1977,7 @@ TEST_F(TextfieldTest, TouchSelectionAndDraggingTest) { // With touch drag drop enabled, long pressing in the selected region should // start a drag and remove TouchSelectionController. ASSERT_TRUE(switches::IsTouchDragDropEnabled()); - GestureEventForTest long_press_2( - x, 0, ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + GestureEventForTest long_press_2(ui::ET_GESTURE_LONG_PRESS, x, 0, 0.0f, 0.0f); textfield_->OnGestureEvent(&long_press_2); EXPECT_STR_EQ("hello", textfield_->GetSelectedText()); EXPECT_FALSE(test_api_->touch_selection_controller()); @@ -1987,8 +1988,7 @@ TEST_F(TextfieldTest, TouchSelectionAndDraggingTest) { CommandLine::ForCurrentProcess()->AppendSwitch( switches::kDisableTouchDragDrop); ASSERT_FALSE(switches::IsTouchDragDropEnabled()); - GestureEventForTest long_press_3( - x, 0, ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + GestureEventForTest long_press_3(ui::ET_GESTURE_LONG_PRESS, x, 0, 0.0f, 0.0f); textfield_->OnGestureEvent(&long_press_3); EXPECT_STR_EQ("hello", textfield_->GetSelectedText()); EXPECT_FALSE(test_api_->touch_selection_controller()); @@ -2033,10 +2033,8 @@ TEST_F(TextfieldTest, TestLongPressInitiatesDragDrop) { switches::kEnableTouchDragDrop); // Create a long press event in the selected region should start a drag. - GestureEventForTest long_press( - kStringPoint.x(), - kStringPoint.y(), - ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + GestureEventForTest long_press(ui::ET_GESTURE_LONG_PRESS, kStringPoint.x(), + kStringPoint.y(), 0.0f, 0.0f); textfield_->OnGestureEvent(&long_press); EXPECT_TRUE(textfield_->CanStartDragForView(NULL, kStringPoint, kStringPoint)); diff --git a/ui/views/corewm/desktop_capture_controller_unittest.cc b/ui/views/corewm/desktop_capture_controller_unittest.cc index 3baf0f4..a7628a6 100644 --- a/ui/views/corewm/desktop_capture_controller_unittest.cc +++ b/ui/views/corewm/desktop_capture_controller_unittest.cc @@ -167,11 +167,12 @@ TEST_F(DesktopCaptureControllerTest, CaptureWindowInputEventTest) { EXPECT_FALSE(widget2->GetNativeView()->HasCapture()); EXPECT_EQ(capture_client->GetCaptureWindow(), widget1->GetNativeView()); - ui::GestureEvent g1(80, - 80, - 0, - base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + ui::GestureEvent g1( + 80, + 80, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS, 0.0f, 0.0f)); details = root1->OnEventFromSource(&g1); EXPECT_FALSE(details.dispatcher_destroyed); EXPECT_FALSE(details.target_destroyed); diff --git a/ui/views/touchui/touch_selection_controller_impl_unittest.cc b/ui/views/touchui/touch_selection_controller_impl_unittest.cc index b268d2c..acd62ff 100644 --- a/ui/views/touchui/touch_selection_controller_impl_unittest.cc +++ b/ui/views/touchui/touch_selection_controller_impl_unittest.cc @@ -252,9 +252,11 @@ TEST_F(TouchSelectionControllerImplTest, SelectionInTextfieldTest) { CreateTextfield(); textfield_->SetText(ASCIIToUTF16("some text")); // Tap the textfield to invoke touch selection. - ui::GestureEventDetails details(ui::ET_GESTURE_TAP); - details.set_tap_count(1); - ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details); + ui::GestureEvent tap(0, + 0, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP, 1.0f, 0.0f)); textfield_->OnGestureEvent(&tap); // Test selecting a range. @@ -285,9 +287,11 @@ TEST_F(TouchSelectionControllerImplTest, SelectionInBidiTextfieldTest) { CreateTextfield(); textfield_->SetText(WideToUTF16(L"abc\x05d0\x05d1\x05d2")); // Tap the textfield to invoke touch selection. - ui::GestureEventDetails details(ui::ET_GESTURE_TAP); - details.set_tap_count(1); - ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details); + ui::GestureEvent tap(0, + 0, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP, 1.0f, 0.0f)); textfield_->OnGestureEvent(&tap); // Test cursor at run boundary and with empty selection. @@ -334,9 +338,11 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectCallbackTest) { CreateTextfield(); textfield_->SetText(ASCIIToUTF16("textfield with selected text")); // Tap the textfield to invoke touch selection. - ui::GestureEventDetails details(ui::ET_GESTURE_TAP); - details.set_tap_count(1); - ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details); + ui::GestureEvent tap(0, + 0, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP, 1.0f, 0.0f)); textfield_->OnGestureEvent(&tap); textfield_->SelectRange(gfx::Range(3, 7)); @@ -373,9 +379,11 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) { CreateTextfield(); textfield_->SetText(WideToUTF16(L"abc\x05e1\x05e2\x05e3" L"def")); // Tap the textfield to invoke touch selection. - ui::GestureEventDetails details(ui::ET_GESTURE_TAP); - details.set_tap_count(1); - ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details); + ui::GestureEvent tap(0, + 0, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP, 1.0f, 0.0f)); textfield_->OnGestureEvent(&tap); // Select [c] from left to right. @@ -503,9 +511,11 @@ TEST_F(TouchSelectionControllerImplTest, textfield_->SetText(ASCIIToUTF16(textfield_text)); // Tap the textfield to invoke selection. - ui::GestureEventDetails details(ui::ET_GESTURE_TAP); - details.set_tap_count(1); - ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details); + ui::GestureEvent tap(0, + 0, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP, 1.0f, 0.0f)); textfield_->OnGestureEvent(&tap); // Select some text such that one handle is hidden. diff --git a/ui/views/view_targeter_unittest.cc b/ui/views/view_targeter_unittest.cc index b855161..92d0fd6 100644 --- a/ui/views/view_targeter_unittest.cc +++ b/ui/views/view_targeter_unittest.cc @@ -231,7 +231,7 @@ class GestureEventForTest : public ui::GestureEvent { y, 0, base::TimeDelta(), - ui::GestureEventDetails(type)) {} + ui::GestureEventDetails(type, 0.0f, 0.0f)) {} GestureEventForTest(ui::GestureEventDetails details, int x, int y) : GestureEvent(x, y, 0, base::TimeDelta(), details) {} @@ -266,13 +266,13 @@ TEST_F(ViewTargeterTest, ViewTargeterForGestureEvents) { // Define some gesture events for testing. gfx::Rect bounding_box(gfx::Point(46, 46), gfx::Size(8, 8)); gfx::Point center_point(bounding_box.CenterPoint()); - ui::GestureEventDetails details(ui::ET_GESTURE_TAP); + ui::GestureEventDetails details(ui::ET_GESTURE_TAP, 0.0f, 0.0f); details.set_bounding_box(bounding_box); GestureEventForTest tap(details, center_point.x(), center_point.y()); - details = ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN); + details = ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN, 0.0f, 0.0f); details.set_bounding_box(bounding_box); GestureEventForTest scroll_begin(details, center_point.x(), center_point.y()); - details = ui::GestureEventDetails(ui::ET_GESTURE_END); + details = ui::GestureEventDetails(ui::ET_GESTURE_END, 0.0f, 0.0f); details.set_bounding_box(bounding_box); GestureEventForTest end(details, center_point.x(), center_point.y()); @@ -324,14 +324,14 @@ TEST_F(ViewTargeterTest, ViewTargeterForGestureEvents) { // again (calls to FindTargetForEvent() and FindNextBestTarget() // mutate the location of the gesture events to be in the coordinate // space of the returned view). - details = ui::GestureEventDetails(ui::ET_GESTURE_TAP); + details = ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0.0f, 0.0f); details.set_bounding_box(bounding_box); tap = GestureEventForTest(details, center_point.x(), center_point.y()); - details = ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN); + details = ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN, 0.0f, 0.0f); details.set_bounding_box(bounding_box); scroll_begin = GestureEventForTest(details, center_point.x(), center_point.y()); - details = ui::GestureEventDetails(ui::ET_GESTURE_END); + details = ui::GestureEventDetails(ui::ET_GESTURE_END, 0.0f, 0.0f); details.set_bounding_box(bounding_box); end = GestureEventForTest(details, center_point.x(), center_point.y()); @@ -381,7 +381,7 @@ TEST_F(ViewTargeterTest, GestureEventCoordinateConversion) { // in root view coordinates with width and height of 4. gfx::Rect bounding_box(gfx::Point(58, 58), gfx::Size(4, 4)); gfx::Point center_point(bounding_box.CenterPoint()); - ui::GestureEventDetails details(ui::ET_GESTURE_TAP); + ui::GestureEventDetails details(ui::ET_GESTURE_TAP, 0.0f, 0.0f); details.set_bounding_box(bounding_box); GestureEventForTest tap(details, center_point.x(), center_point.y()); diff --git a/ui/views/widget/root_view_unittest.cc b/ui/views/widget/root_view_unittest.cc index f4836cd..d13e6c99 100644 --- a/ui/views/widget/root_view_unittest.cc +++ b/ui/views/widget/root_view_unittest.cc @@ -206,11 +206,14 @@ TEST_F(RootViewTest, ContextMenuFromLongPress) { 5, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS, 0, 0)); ui::EventDispatchDetails details = root_view->OnEventFromSource(&long_press1); - ui::GestureEvent end1( - 5, 5, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_END)); + ui::GestureEvent end1(5, + 5, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_END, 0, 0)); details = root_view->OnEventFromSource(&end1); EXPECT_FALSE(details.target_destroyed); @@ -225,11 +228,14 @@ TEST_F(RootViewTest, ContextMenuFromLongPress) { 5, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS, 0, 0)); details = root_view->OnEventFromSource(&long_press2); - ui::GestureEvent end2( - 25, 5, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_END)); + ui::GestureEvent end2(25, + 5, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_END, 0, 0)); details = root_view->OnEventFromSource(&end2); EXPECT_FALSE(details.target_destroyed); @@ -244,11 +250,14 @@ TEST_F(RootViewTest, ContextMenuFromLongPress) { 50, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS, 0, 0)); details = root_view->OnEventFromSource(&long_press3); - ui::GestureEvent end3( - 25, 5, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_END)); + ui::GestureEvent end3(25, + 5, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_END, 0, 0)); details = root_view->OnEventFromSource(&end3); EXPECT_FALSE(details.target_destroyed); @@ -291,11 +300,14 @@ TEST_F(RootViewTest, ContextMenuFromLongPressOnDisabledView) { 5, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS, 0, 0)); ui::EventDispatchDetails details = root_view->OnEventFromSource(&long_press1); - ui::GestureEvent end1( - 5, 5, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_END)); + ui::GestureEvent end1(5, + 5, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_END, 0, 0)); details = root_view->OnEventFromSource(&end1); EXPECT_FALSE(details.target_destroyed); @@ -310,11 +322,14 @@ TEST_F(RootViewTest, ContextMenuFromLongPressOnDisabledView) { 5, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS, 0, 0)); details = root_view->OnEventFromSource(&long_press2); - ui::GestureEvent end2( - 25, 5, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_END)); + ui::GestureEvent end2(25, + 5, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_END, 0, 0)); details = root_view->OnEventFromSource(&end2); EXPECT_FALSE(details.target_destroyed); @@ -329,11 +344,14 @@ TEST_F(RootViewTest, ContextMenuFromLongPressOnDisabledView) { 50, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS, 0, 0)); details = root_view->OnEventFromSource(&long_press3); - ui::GestureEvent end3( - 25, 5, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_END)); + ui::GestureEvent end3(25, + 5, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_END, 0, 0)); details = root_view->OnEventFromSource(&end3); EXPECT_FALSE(details.target_destroyed); diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc index 68d646c..d3827df 100644 --- a/ui/views/widget/widget_interactive_uitest.cc +++ b/ui/views/widget/widget_interactive_uitest.cc @@ -301,12 +301,14 @@ TEST_F(WidgetTestInteractive, ResetCaptureOnGestureEnd) { 15, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); + ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN, + 0, + 0)); ui::GestureEvent end(15, 15, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_END)); + ui::GestureEventDetails(ui::ET_GESTURE_END, 0, 0)); toplevel->OnGestureEvent(&tap_down); // Now try to click on |mouse|. Since |gesture| will have capture, |mouse| diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index e006e06..2dc6b24 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc @@ -1339,7 +1339,7 @@ TEST_F(WidgetTest, GestureScrollEventDispatching) { 5, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN)); + ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN, 0, 0)); widget->OnGestureEvent(&begin); ui::GestureEvent update( 25, @@ -1348,11 +1348,12 @@ TEST_F(WidgetTest, GestureScrollEventDispatching) { base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_UPDATE, 20, 10)); widget->OnGestureEvent(&update); - ui::GestureEvent end(25, - 15, - 0, - base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END)); + ui::GestureEvent end( + 25, + 15, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END, 0, 0)); widget->OnGestureEvent(&end); EXPECT_EQ(1, noscroll_view->GetEventCount(ui::ET_GESTURE_SCROLL_BEGIN)); @@ -1366,7 +1367,7 @@ TEST_F(WidgetTest, GestureScrollEventDispatching) { 5, 0, base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN)); + ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN, 0, 0)); widget->OnGestureEvent(&begin); ui::GestureEvent update( 85, @@ -1375,11 +1376,12 @@ TEST_F(WidgetTest, GestureScrollEventDispatching) { base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_UPDATE, 20, 10)); widget->OnGestureEvent(&update); - ui::GestureEvent end(85, - 15, - 0, - base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END)); + ui::GestureEvent end( + 85, + 15, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END, 0, 0)); widget->OnGestureEvent(&end); EXPECT_EQ(1, scroll_view->GetEventCount(ui::ET_GESTURE_SCROLL_BEGIN)); @@ -1468,18 +1470,21 @@ TEST_F(WidgetTest, EventHandlersOnRootView) { 5, 0, ui::EventTimeForNow(), - ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); + ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN, + 0, + 0)); widget->OnGestureEvent(&tap_down); EXPECT_EQ(1, h1.GetEventCount(ui::ET_GESTURE_TAP_DOWN)); EXPECT_EQ(1, view->GetEventCount(ui::ET_GESTURE_TAP_DOWN)); EXPECT_EQ(0, h2.GetEventCount(ui::ET_GESTURE_TAP_DOWN)); - ui::GestureEvent tap_cancel( - 5, - 5, - 0, - ui::EventTimeForNow(), - ui::GestureEventDetails(ui::ET_GESTURE_TAP_CANCEL)); + ui::GestureEvent tap_cancel(5, + 5, + 0, + ui::EventTimeForNow(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP_CANCEL, + 0, + 0)); widget->OnGestureEvent(&tap_cancel); EXPECT_EQ(1, h1.GetEventCount(ui::ET_GESTURE_TAP_CANCEL)); EXPECT_EQ(1, view->GetEventCount(ui::ET_GESTURE_TAP_CANCEL)); @@ -1949,11 +1954,12 @@ TEST_F(WidgetTest, MAYBE_DisableTestRootViewHandlersWhenHidden) { // Check RootView::gesture_handler_. widget->Show(); EXPECT_EQ(NULL, GetGestureHandler(root_view)); - ui::GestureEvent tap_down(15, - 15, - 0, - base::TimeDelta(), - ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); + ui::GestureEvent tap_down( + 15, + 15, + 0, + base::TimeDelta(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN, 0, 0)); widget->OnGestureEvent(&tap_down); EXPECT_EQ(view, GetGestureHandler(root_view)); widget->Hide(); @@ -1970,7 +1976,7 @@ class GestureEventForTest : public ui::GestureEvent { y, 0, base::TimeDelta(), - ui::GestureEventDetails(type)) {} + ui::GestureEventDetails(type, 0.0f, 0.0f)) {} GestureEventForTest(ui::GestureEventDetails details, int x, int y) : GestureEvent(x, y, 0, base::TimeDelta(), details) {} @@ -2023,7 +2029,7 @@ TEST_F(WidgetTest, GestureBeginAndEndEvents) { // If no gesture handler is set, dispatching only a ui::ET_GESTURE_BEGIN // corresponding to a second touch point should not set the gesture handler // and should not be marked as handled because it is never dispatched. - ui::GestureEventDetails details(ui::ET_GESTURE_END); + ui::GestureEventDetails details(ui::ET_GESTURE_END, 15, 15); details.set_touch_points(2); GestureEventForTest end_second_touch_point(details, 15, 15); widget->OnGestureEvent(&end_second_touch_point); diff --git a/ui/wm/core/user_activity_detector_unittest.cc b/ui/wm/core/user_activity_detector_unittest.cc index 620ab0c..df669c7 100644 --- a/ui/wm/core/user_activity_detector_unittest.cc +++ b/ui/wm/core/user_activity_detector_unittest.cc @@ -139,11 +139,9 @@ TEST_F(UserActivityDetectorTest, Basic) { AdvanceTime(advance_delta); ui::GestureEvent gesture_event( - 0, - 0, - ui::EF_NONE, + 0, 0, ui::EF_NONE, base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), - ui::GestureEventDetails(ui::ET_GESTURE_TAP)); + ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0, 0)); detector_->OnGestureEvent(&gesture_event); EXPECT_FALSE(gesture_event.handled()); EXPECT_EQ(now_.ToInternalValue(), |