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

Side by Side Diff: content/renderer/input/main_thread_event_queue_unittest.cc

Issue 2788203002: Adjust cancelabilty of touchmoves that are queued when scroll start occurs (Closed)
Patch Set: Adjust cancelabilty of touchmoves that are pending queued when a scroll start occurs. 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <new> 7 #include <new>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 EXPECT_FALSE(needs_main_frame_); 1026 EXPECT_FALSE(needs_main_frame_);
1027 1027
1028 EXPECT_EQ(kEvents[0].type(), 1028 EXPECT_EQ(kEvents[0].type(),
1029 handled_tasks_.at(0)->taskAsEvent()->event().type()); 1029 handled_tasks_.at(0)->taskAsEvent()->event().type());
1030 EXPECT_EQ(1u, handled_tasks_.at(1)->taskAsClosure()); 1030 EXPECT_EQ(1u, handled_tasks_.at(1)->taskAsClosure());
1031 EXPECT_EQ(2u, handled_tasks_.at(2)->taskAsClosure()); 1031 EXPECT_EQ(2u, handled_tasks_.at(2)->taskAsClosure());
1032 EXPECT_EQ(kEvents[1].type(), 1032 EXPECT_EQ(kEvents[1].type(),
1033 handled_tasks_.at(3)->taskAsEvent()->event().type()); 1033 handled_tasks_.at(3)->taskAsEvent()->event().type());
1034 } 1034 }
1035 1035
1036 TEST_P(MainThreadEventQueueTest, BlockingTouchMoveBecomesNonBlocking) {
1037 SyntheticWebTouchEvent kEvents[2];
1038 kEvents[0].PressPoint(10, 10);
1039 kEvents[0].MovePoint(0, 20, 20);
1040 kEvents[1].setModifiers(1);
1041 kEvents[1].PressPoint(10, 10);
1042 kEvents[1].MovePoint(0, 20, 30);
1043 kEvents[1].dispatchType = WebInputEvent::EventNonBlocking;
1044 WebTouchEvent scroll_start(WebInputEvent::TouchScrollStarted,
1045 WebInputEvent::NoModifiers,
1046 WebInputEvent::TimeStampForTesting);
1047
1048 EXPECT_FALSE(main_task_runner_->HasPendingTask());
1049 EXPECT_EQ(0u, event_queue().size());
1050
1051 EXPECT_EQ(WebInputEvent::Blocking, kEvents[0].dispatchType);
1052 EXPECT_EQ(WebInputEvent::EventNonBlocking, kEvents[1].dispatchType);
1053 EXPECT_FALSE(HandleEvent(kEvents[0], INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
1054 EXPECT_TRUE(HandleEvent(kEvents[1], INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
1055 EXPECT_FALSE(HandleEvent(scroll_start, INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
1056 EXPECT_EQ(3u, event_queue().size());
1057 RunPendingTasksWithSimulatedRaf();
1058 EXPECT_EQ(0u, event_queue().size());
1059 EXPECT_FALSE(main_task_runner_->HasPendingTask());
1060 EXPECT_FALSE(needs_main_frame_);
1061
1062 EXPECT_EQ(WebInputEvent::EventNonBlocking,
1063 static_cast<const WebTouchEvent&>(
1064 handled_tasks_.at(0)->taskAsEvent()->event())
1065 .dispatchType);
1066 EXPECT_EQ(WebInputEvent::EventNonBlocking,
1067 static_cast<const WebTouchEvent&>(
1068 handled_tasks_.at(1)->taskAsEvent()->event())
1069 .dispatchType);
1070 }
1071
1072 TEST_P(MainThreadEventQueueTest, BlockingTouchMoveWithTouchEnd) {
tdresser 2017/03/31 20:50:20 There is no extra touch end here. The name seems w
dtapuska 2017/03/31 21:06:10 Yes there is kEvents[1].ReleasePoint(0) turns kEve
1073 SyntheticWebTouchEvent kEvents[2];
1074 kEvents[0].PressPoint(10, 10);
1075 kEvents[0].MovePoint(0, 20, 20);
1076 kEvents[1].PressPoint(10, 10);
1077 kEvents[1].ReleasePoint(0);
1078 WebTouchEvent scroll_start(WebInputEvent::TouchScrollStarted,
1079 WebInputEvent::NoModifiers,
1080 WebInputEvent::TimeStampForTesting);
1081
1082 EXPECT_FALSE(main_task_runner_->HasPendingTask());
1083 EXPECT_EQ(0u, event_queue().size());
1084
1085 EXPECT_EQ(WebInputEvent::Blocking, kEvents[0].dispatchType);
1086 EXPECT_EQ(WebInputEvent::Blocking, kEvents[1].dispatchType);
1087 EXPECT_FALSE(HandleEvent(kEvents[0], INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
1088 EXPECT_FALSE(HandleEvent(kEvents[1], INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
1089 EXPECT_FALSE(HandleEvent(scroll_start, INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
1090 EXPECT_EQ(3u, event_queue().size());
1091 RunPendingTasksWithSimulatedRaf();
1092 EXPECT_EQ(0u, event_queue().size());
1093 EXPECT_FALSE(main_task_runner_->HasPendingTask());
1094 EXPECT_FALSE(needs_main_frame_);
1095
1096 EXPECT_EQ(WebInputEvent::Blocking,
1097 static_cast<const WebTouchEvent&>(
1098 handled_tasks_.at(0)->taskAsEvent()->event())
1099 .dispatchType);
1100 EXPECT_EQ(WebInputEvent::Blocking,
1101 static_cast<const WebTouchEvent&>(
1102 handled_tasks_.at(1)->taskAsEvent()->event())
1103 .dispatchType);
1104 }
1105
1036 } // namespace content 1106 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698