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

Side by Side Diff: content/browser/renderer_host/input/input_router_impl_unittest.cc

Issue 2782733002: MouseWheelEventQueue sends scrollEnd right away when latching is disabled. (Closed)
Patch Set: nit fixed Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/renderer_host/input/input_router_impl.h" 5 #include "content/browser/renderer_host/input/input_router_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); 1019 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1020 1020
1021 // Indicate that the wheel event was unhandled. 1021 // Indicate that the wheel event was unhandled.
1022 SendInputEventACK(WebInputEvent::MouseWheel, 1022 SendInputEventACK(WebInputEvent::MouseWheel,
1023 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 1023 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
1024 1024
1025 // Check that the ack for the MouseWheel and ScrollBegin 1025 // Check that the ack for the MouseWheel and ScrollBegin
1026 // were processed. 1026 // were processed.
1027 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount()); 1027 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
1028 1028
1029 // There should be a ScrollBegin and ScrollUpdate, MouseWheel sent 1029 // There should be a ScrollBegin and ScrollUpdate, MouseWheel sent.
1030 EXPECT_EQ(3U, GetSentMessageCountAndResetSink()); 1030 EXPECT_EQ(3U, GetSentMessageCountAndResetSink());
1031 1031
1032 EXPECT_EQ(ack_handler_->acked_wheel_event().deltaY, -5); 1032 EXPECT_EQ(ack_handler_->acked_wheel_event().deltaY, -5);
1033 SendInputEventACK(WebInputEvent::GestureScrollUpdate, 1033 SendInputEventACK(WebInputEvent::GestureScrollUpdate,
1034 INPUT_EVENT_ACK_STATE_CONSUMED); 1034 INPUT_EVENT_ACK_STATE_CONSUMED);
1035
1036 // There should be a ScrollEnd sent.
dtapuska 2017/03/29 17:49:03 Can we adjust this comment so it indicates the Ges
sahel 2017/03/29 20:10:43 Done.
1037 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1038
1039 // Check that the ack for the ScrollUpdate and ScrollEnd
1040 // were processed.
1041 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
1042
1035 SendInputEventACK(WebInputEvent::MouseWheel, 1043 SendInputEventACK(WebInputEvent::MouseWheel,
1036 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 1044 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
1037 1045
1046 // There should be a ScrollBegin and ScrollUpdate sent.
1047 EXPECT_EQ(2U, GetSentMessageCountAndResetSink());
1048
1038 // Check that the correct unhandled wheel event was received. 1049 // Check that the correct unhandled wheel event was received.
1039 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount()); 1050 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
1040 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, ack_handler_->ack_state()); 1051 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED,
1052 ack_handler_->acked_wheel_event_state());
1041 EXPECT_EQ(ack_handler_->acked_wheel_event().deltaY, -10); 1053 EXPECT_EQ(ack_handler_->acked_wheel_event().deltaY, -10);
1054
1055 SendInputEventACK(WebInputEvent::GestureScrollUpdate,
1056 INPUT_EVENT_ACK_STATE_CONSUMED);
1057
1058 // There should be a ScrollEnd sent.
dtapuska 2017/03/29 17:49:03 Same.. the event is already "sent" from the mouse_
sahel 2017/03/29 20:10:43 Done.
1059 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1060
1061 // Check that the ack for the ScrollUpdate and ScrollEnd
1062 // were processed.
1063 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
1042 } 1064 }
1043 1065
1044 TEST_F(InputRouterImplTest, TouchTypesIgnoringAck) { 1066 TEST_F(InputRouterImplTest, TouchTypesIgnoringAck) {
1045 OnHasTouchEventHandlers(true); 1067 OnHasTouchEventHandlers(true);
1046 // Only acks for TouchCancel should always be ignored. 1068 // Only acks for TouchCancel should always be ignored.
1047 ASSERT_TRUE( 1069 ASSERT_TRUE(
1048 ShouldBlockEventStream(GetEventWithType(WebInputEvent::TouchStart))); 1070 ShouldBlockEventStream(GetEventWithType(WebInputEvent::TouchStart)));
1049 ASSERT_TRUE( 1071 ASSERT_TRUE(
1050 ShouldBlockEventStream(GetEventWithType(WebInputEvent::TouchMove))); 1072 ShouldBlockEventStream(GetEventWithType(WebInputEvent::TouchMove)));
1051 ASSERT_TRUE( 1073 ASSERT_TRUE(
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 EXPECT_EQ(80, sent_event->data.flingStart.velocityY); 2472 EXPECT_EQ(80, sent_event->data.flingStart.velocityY);
2451 2473
2452 const WebGestureEvent* filter_event = 2474 const WebGestureEvent* filter_event =
2453 GetFilterWebInputEvent<WebGestureEvent>(); 2475 GetFilterWebInputEvent<WebGestureEvent>();
2454 TestLocationInFilterEvent(filter_event, orig); 2476 TestLocationInFilterEvent(filter_event, orig);
2455 EXPECT_EQ(30, filter_event->data.flingStart.velocityX); 2477 EXPECT_EQ(30, filter_event->data.flingStart.velocityX);
2456 EXPECT_EQ(40, filter_event->data.flingStart.velocityY); 2478 EXPECT_EQ(40, filter_event->data.flingStart.velocityY);
2457 } 2479 }
2458 2480
2459 } // namespace content 2481 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698