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

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

Issue 1888163003: Articulate the cancel behavior in the WebTouchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and non-const ref passed back Created 4 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 kEvents[3].MovePoint(0, 35, 35); 101 kEvents[3].MovePoint(0, 35, 35);
102 102
103 ASSERT_EQ(WebInputEventQueueState::ITEM_NOT_PENDING, 103 ASSERT_EQ(WebInputEventQueueState::ITEM_NOT_PENDING,
104 touch_event_queue().state()); 104 touch_event_queue().state());
105 queue_.HandleEvent(&kEvents[0], ui::LatencyInfo(), DISPATCH_TYPE_BLOCKING, 105 queue_.HandleEvent(&kEvents[0], ui::LatencyInfo(), DISPATCH_TYPE_BLOCKING,
106 INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING); 106 INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING);
107 ASSERT_EQ(WebInputEventQueueState::ITEM_PENDING, touch_event_queue().state()); 107 ASSERT_EQ(WebInputEventQueueState::ITEM_PENDING, touch_event_queue().state());
108 queue_.HandleEvent(&kEvents[1], ui::LatencyInfo(), DISPATCH_TYPE_BLOCKING, 108 queue_.HandleEvent(&kEvents[1], ui::LatencyInfo(), DISPATCH_TYPE_BLOCKING,
109 INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING); 109 INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING);
110 ASSERT_EQ(kEvents[0].size, last_event_.size()); 110 ASSERT_EQ(kEvents[0].size, last_event_.size());
111 kEvents[0].dispatchType =
112 WebInputEvent::DispatchType::ListenersNonBlockingPassive;
111 ASSERT_TRUE(memcmp(&last_event_[0], &kEvents[0], kEvents[0].size) == 0); 113 ASSERT_TRUE(memcmp(&last_event_[0], &kEvents[0], kEvents[0].size) == 0);
112 queue_.EventHandled(blink::WebInputEvent::TouchStart); 114 queue_.EventHandled(blink::WebInputEvent::TouchStart);
113 ASSERT_EQ(kEvents[1].size, last_event_.size()); 115 ASSERT_EQ(kEvents[1].size, last_event_.size());
116 kEvents[1].dispatchType =
117 WebInputEvent::DispatchType::ListenersNonBlockingPassive;
114 ASSERT_TRUE(memcmp(&last_event_[0], &kEvents[1], kEvents[1].size) == 0); 118 ASSERT_TRUE(memcmp(&last_event_[0], &kEvents[1], kEvents[1].size) == 0);
115 ASSERT_EQ(WebInputEventQueueState::ITEM_PENDING, touch_event_queue().state()); 119 ASSERT_EQ(WebInputEventQueueState::ITEM_PENDING, touch_event_queue().state());
116 queue_.EventHandled(blink::WebInputEvent::TouchMove); 120 queue_.EventHandled(blink::WebInputEvent::TouchMove);
117 ASSERT_EQ(WebInputEventQueueState::ITEM_NOT_PENDING, 121 ASSERT_EQ(WebInputEventQueueState::ITEM_NOT_PENDING,
118 touch_event_queue().state()); 122 touch_event_queue().state());
119 123
120 // Ensure that coalescing takes place. 124 // Ensure that coalescing takes place.
121 queue_.HandleEvent(&kEvents[0], ui::LatencyInfo(), DISPATCH_TYPE_BLOCKING, 125 queue_.HandleEvent(&kEvents[0], ui::LatencyInfo(), DISPATCH_TYPE_BLOCKING,
122 INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING); 126 INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING);
123 queue_.HandleEvent(&kEvents[2], ui::LatencyInfo(), DISPATCH_TYPE_BLOCKING, 127 queue_.HandleEvent(&kEvents[2], ui::LatencyInfo(), DISPATCH_TYPE_BLOCKING,
124 INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING); 128 INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING);
125 queue_.HandleEvent(&kEvents[3], ui::LatencyInfo(), DISPATCH_TYPE_BLOCKING, 129 queue_.HandleEvent(&kEvents[3], ui::LatencyInfo(), DISPATCH_TYPE_BLOCKING,
126 INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING); 130 INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING);
127 ASSERT_EQ(1u, touch_event_queue().size()); 131 ASSERT_EQ(1u, touch_event_queue().size());
128 ASSERT_EQ(WebInputEventQueueState::ITEM_PENDING, touch_event_queue().state()); 132 ASSERT_EQ(WebInputEventQueueState::ITEM_PENDING, touch_event_queue().state());
129 } 133 }
130 134
131 } // namespace content 135 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/input/main_thread_event_queue.cc ('k') | content/renderer/input/render_widget_input_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698