OLD | NEW |
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 Loading... |
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].PressPoint(10, 10); |
| 1041 kEvents[1].ReleasePoint(0); |
| 1042 WebTouchEvent scroll_start(WebInputEvent::TouchScrollStarted, |
| 1043 WebInputEvent::NoModifiers, |
| 1044 WebInputEvent::TimeStampForTesting); |
| 1045 |
| 1046 EXPECT_FALSE(main_task_runner_->HasPendingTask()); |
| 1047 EXPECT_EQ(0u, event_queue().size()); |
| 1048 |
| 1049 EXPECT_EQ(WebInputEvent::Blocking, kEvents[0].dispatchType); |
| 1050 EXPECT_EQ(WebInputEvent::Blocking, kEvents[1].dispatchType); |
| 1051 EXPECT_FALSE(HandleEvent(kEvents[0], INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 1052 EXPECT_FALSE(HandleEvent(kEvents[1], INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 1053 EXPECT_FALSE(HandleEvent(scroll_start, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 1054 EXPECT_EQ(3u, event_queue().size()); |
| 1055 RunPendingTasksWithSimulatedRaf(); |
| 1056 EXPECT_EQ(0u, event_queue().size()); |
| 1057 EXPECT_FALSE(main_task_runner_->HasPendingTask()); |
| 1058 EXPECT_FALSE(needs_main_frame_); |
| 1059 |
| 1060 EXPECT_EQ(WebInputEvent::EventNonBlocking, |
| 1061 static_cast<const WebTouchEvent&>( |
| 1062 handled_tasks_.at(0)->taskAsEvent()->event()) |
| 1063 .dispatchType); |
| 1064 EXPECT_EQ(WebInputEvent::Blocking, |
| 1065 static_cast<const WebTouchEvent&>( |
| 1066 handled_tasks_.at(1)->taskAsEvent()->event()) |
| 1067 .dispatchType); |
| 1068 } |
| 1069 |
1036 } // namespace content | 1070 } // namespace content |
OLD | NEW |