blob: cec9cba7d7cb84215272684125ebdf32e7849bb4 [file] [log] [blame]
Jeff Brown5912f952013-07-01 19:10:31 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "TestHelpers.h"
18
19#include <unistd.h>
20#include <sys/mman.h>
21#include <time.h>
22
23#include <cutils/ashmem.h>
24#include <gtest/gtest.h>
25#include <input/InputTransport.h>
26#include <utils/Timers.h>
27#include <utils/StopWatch.h>
28
29namespace android {
30
31class InputPublisherAndConsumerTest : public testing::Test {
32protected:
33 sp<InputChannel> serverChannel, clientChannel;
34 InputPublisher* mPublisher;
35 InputConsumer* mConsumer;
36 PreallocatedInputEventFactory mEventFactory;
37
38 virtual void SetUp() {
Siarhei Vishniakouf93fcf42017-11-22 16:00:14 -080039 status_t result = InputChannel::openInputChannelPair("channel name",
Jeff Brown5912f952013-07-01 19:10:31 -070040 serverChannel, clientChannel);
41
42 mPublisher = new InputPublisher(serverChannel);
43 mConsumer = new InputConsumer(clientChannel);
44 }
45
46 virtual void TearDown() {
47 if (mPublisher) {
48 delete mPublisher;
Yi Kong5bed83b2018-07-17 12:53:47 -070049 mPublisher = nullptr;
Jeff Brown5912f952013-07-01 19:10:31 -070050 }
51
52 if (mConsumer) {
53 delete mConsumer;
Yi Kong5bed83b2018-07-17 12:53:47 -070054 mConsumer = nullptr;
Jeff Brown5912f952013-07-01 19:10:31 -070055 }
56
57 serverChannel.clear();
58 clientChannel.clear();
59 }
60
61 void PublishAndConsumeKeyEvent();
62 void PublishAndConsumeMotionEvent();
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -080063 void PublishAndConsumeFocusEvent();
Jeff Brown5912f952013-07-01 19:10:31 -070064};
65
66TEST_F(InputPublisherAndConsumerTest, GetChannel_ReturnsTheChannel) {
67 EXPECT_EQ(serverChannel.get(), mPublisher->getChannel().get());
68 EXPECT_EQ(clientChannel.get(), mConsumer->getChannel().get());
69}
70
71void InputPublisherAndConsumerTest::PublishAndConsumeKeyEvent() {
72 status_t status;
73
Siarhei Vishniakoua62a8dd2018-06-08 21:17:33 +010074 constexpr uint32_t seq = 15;
75 constexpr int32_t deviceId = 1;
76 constexpr int32_t source = AINPUT_SOURCE_KEYBOARD;
77 constexpr int32_t displayId = ADISPLAY_ID_DEFAULT;
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -060078 constexpr std::array<uint8_t, 32> hmac = {31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21,
79 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10,
80 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
Siarhei Vishniakoua62a8dd2018-06-08 21:17:33 +010081 constexpr int32_t action = AKEY_EVENT_ACTION_DOWN;
82 constexpr int32_t flags = AKEY_EVENT_FLAG_FROM_SYSTEM;
83 constexpr int32_t keyCode = AKEYCODE_ENTER;
84 constexpr int32_t scanCode = 13;
85 constexpr int32_t metaState = AMETA_ALT_LEFT_ON | AMETA_ALT_ON;
86 constexpr int32_t repeatCount = 1;
87 constexpr nsecs_t downTime = 3;
88 constexpr nsecs_t eventTime = 4;
Jeff Brown5912f952013-07-01 19:10:31 -070089
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -060090 status = mPublisher->publishKeyEvent(seq, deviceId, source, displayId, hmac, action, flags,
91 keyCode, scanCode, metaState, repeatCount, downTime,
92 eventTime);
Jeff Brown5912f952013-07-01 19:10:31 -070093 ASSERT_EQ(OK, status)
94 << "publisher publishKeyEvent should return OK";
95
96 uint32_t consumeSeq;
97 InputEvent* event;
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -080098 status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event);
Jeff Brown5912f952013-07-01 19:10:31 -070099 ASSERT_EQ(OK, status)
100 << "consumer consume should return OK";
101
Yi Kong5bed83b2018-07-17 12:53:47 -0700102 ASSERT_TRUE(event != nullptr)
Jeff Brown5912f952013-07-01 19:10:31 -0700103 << "consumer should have returned non-NULL event";
104 ASSERT_EQ(AINPUT_EVENT_TYPE_KEY, event->getType())
105 << "consumer should have returned a key event";
106
107 KeyEvent* keyEvent = static_cast<KeyEvent*>(event);
108 EXPECT_EQ(seq, consumeSeq);
109 EXPECT_EQ(deviceId, keyEvent->getDeviceId());
110 EXPECT_EQ(source, keyEvent->getSource());
Siarhei Vishniakoua62a8dd2018-06-08 21:17:33 +0100111 EXPECT_EQ(displayId, keyEvent->getDisplayId());
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600112 EXPECT_EQ(hmac, keyEvent->getHmac());
Jeff Brown5912f952013-07-01 19:10:31 -0700113 EXPECT_EQ(action, keyEvent->getAction());
114 EXPECT_EQ(flags, keyEvent->getFlags());
115 EXPECT_EQ(keyCode, keyEvent->getKeyCode());
116 EXPECT_EQ(scanCode, keyEvent->getScanCode());
117 EXPECT_EQ(metaState, keyEvent->getMetaState());
118 EXPECT_EQ(repeatCount, keyEvent->getRepeatCount());
119 EXPECT_EQ(downTime, keyEvent->getDownTime());
120 EXPECT_EQ(eventTime, keyEvent->getEventTime());
121
122 status = mConsumer->sendFinishedSignal(seq, true);
123 ASSERT_EQ(OK, status)
124 << "consumer sendFinishedSignal should return OK";
125
126 uint32_t finishedSeq = 0;
127 bool handled = false;
128 status = mPublisher->receiveFinishedSignal(&finishedSeq, &handled);
129 ASSERT_EQ(OK, status)
130 << "publisher receiveFinishedSignal should return OK";
131 ASSERT_EQ(seq, finishedSeq)
132 << "publisher receiveFinishedSignal should have returned the original sequence number";
133 ASSERT_TRUE(handled)
134 << "publisher receiveFinishedSignal should have set handled to consumer's reply";
135}
136
137void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() {
138 status_t status;
139
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -0800140 constexpr uint32_t seq = 15;
141 constexpr int32_t deviceId = 1;
142 constexpr int32_t source = AINPUT_SOURCE_TOUCHSCREEN;
Siarhei Vishniakoua62a8dd2018-06-08 21:17:33 +0100143 constexpr int32_t displayId = ADISPLAY_ID_DEFAULT;
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600144 constexpr std::array<uint8_t, 32> hmac = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
145 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
146 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -0800147 constexpr int32_t action = AMOTION_EVENT_ACTION_MOVE;
148 constexpr int32_t actionButton = 0;
149 constexpr int32_t flags = AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED;
150 constexpr int32_t edgeFlags = AMOTION_EVENT_EDGE_FLAG_TOP;
151 constexpr int32_t metaState = AMETA_ALT_LEFT_ON | AMETA_ALT_ON;
152 constexpr int32_t buttonState = AMOTION_EVENT_BUTTON_PRIMARY;
Siarhei Vishniakou16a2e302019-01-14 19:21:45 -0800153 constexpr MotionClassification classification = MotionClassification::AMBIGUOUS_GESTURE;
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600154 constexpr float xScale = 2;
155 constexpr float yScale = 3;
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -0800156 constexpr float xOffset = -10;
157 constexpr float yOffset = -20;
158 constexpr float xPrecision = 0.25;
159 constexpr float yPrecision = 0.5;
Garfield Tan00f511d2019-06-12 16:55:40 -0700160 constexpr float xCursorPosition = 1.3;
161 constexpr float yCursorPosition = 50.6;
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -0800162 constexpr nsecs_t downTime = 3;
163 constexpr size_t pointerCount = 3;
164 constexpr nsecs_t eventTime = 4;
Jeff Brown5912f952013-07-01 19:10:31 -0700165 PointerProperties pointerProperties[pointerCount];
166 PointerCoords pointerCoords[pointerCount];
167 for (size_t i = 0; i < pointerCount; i++) {
168 pointerProperties[i].clear();
169 pointerProperties[i].id = (i + 2) % pointerCount;
170 pointerProperties[i].toolType = AMOTION_EVENT_TOOL_TYPE_FINGER;
171
172 pointerCoords[i].clear();
173 pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_X, 100 * i);
174 pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_Y, 200 * i);
175 pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 0.5 * i);
176 pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 0.7 * i);
177 pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 1.5 * i);
178 pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 1.7 * i);
179 pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 2.5 * i);
180 pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 2.7 * i);
181 pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 3.5 * i);
182 }
183
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600184 status = mPublisher->publishMotionEvent(seq, deviceId, source, displayId, hmac, action,
185 actionButton, flags, edgeFlags, metaState, buttonState,
186 classification, xScale, yScale, xOffset, yOffset,
187 xPrecision, yPrecision, xCursorPosition,
188 yCursorPosition, downTime, eventTime, pointerCount,
189 pointerProperties, pointerCoords);
Jeff Brown5912f952013-07-01 19:10:31 -0700190 ASSERT_EQ(OK, status)
191 << "publisher publishMotionEvent should return OK";
192
193 uint32_t consumeSeq;
194 InputEvent* event;
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -0800195 status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event);
Jeff Brown5912f952013-07-01 19:10:31 -0700196 ASSERT_EQ(OK, status)
197 << "consumer consume should return OK";
198
Yi Kong5bed83b2018-07-17 12:53:47 -0700199 ASSERT_TRUE(event != nullptr)
Jeff Brown5912f952013-07-01 19:10:31 -0700200 << "consumer should have returned non-NULL event";
201 ASSERT_EQ(AINPUT_EVENT_TYPE_MOTION, event->getType())
202 << "consumer should have returned a motion event";
203
204 MotionEvent* motionEvent = static_cast<MotionEvent*>(event);
205 EXPECT_EQ(seq, consumeSeq);
206 EXPECT_EQ(deviceId, motionEvent->getDeviceId());
207 EXPECT_EQ(source, motionEvent->getSource());
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -0800208 EXPECT_EQ(displayId, motionEvent->getDisplayId());
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600209 EXPECT_EQ(hmac, motionEvent->getHmac());
Jeff Brown5912f952013-07-01 19:10:31 -0700210 EXPECT_EQ(action, motionEvent->getAction());
211 EXPECT_EQ(flags, motionEvent->getFlags());
212 EXPECT_EQ(edgeFlags, motionEvent->getEdgeFlags());
213 EXPECT_EQ(metaState, motionEvent->getMetaState());
214 EXPECT_EQ(buttonState, motionEvent->getButtonState());
Siarhei Vishniakou16a2e302019-01-14 19:21:45 -0800215 EXPECT_EQ(classification, motionEvent->getClassification());
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600216 EXPECT_EQ(xScale, motionEvent->getXScale());
217 EXPECT_EQ(yScale, motionEvent->getYScale());
218 EXPECT_EQ(xOffset, motionEvent->getXOffset());
219 EXPECT_EQ(yOffset, motionEvent->getYOffset());
Jeff Brown5912f952013-07-01 19:10:31 -0700220 EXPECT_EQ(xPrecision, motionEvent->getXPrecision());
221 EXPECT_EQ(yPrecision, motionEvent->getYPrecision());
Garfield Tan00f511d2019-06-12 16:55:40 -0700222 EXPECT_EQ(xCursorPosition, motionEvent->getRawXCursorPosition());
223 EXPECT_EQ(yCursorPosition, motionEvent->getRawYCursorPosition());
chaviw82357092020-01-28 13:13:06 -0800224 EXPECT_EQ(xCursorPosition * xScale + xOffset, motionEvent->getXCursorPosition());
225 EXPECT_EQ(yCursorPosition * yScale + yOffset, motionEvent->getYCursorPosition());
Jeff Brown5912f952013-07-01 19:10:31 -0700226 EXPECT_EQ(downTime, motionEvent->getDownTime());
227 EXPECT_EQ(eventTime, motionEvent->getEventTime());
228 EXPECT_EQ(pointerCount, motionEvent->getPointerCount());
229 EXPECT_EQ(0U, motionEvent->getHistorySize());
230
231 for (size_t i = 0; i < pointerCount; i++) {
232 SCOPED_TRACE(i);
233 EXPECT_EQ(pointerProperties[i].id, motionEvent->getPointerId(i));
234 EXPECT_EQ(pointerProperties[i].toolType, motionEvent->getToolType(i));
235
236 EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X),
237 motionEvent->getRawX(i));
238 EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_Y),
239 motionEvent->getRawY(i));
chaviw82357092020-01-28 13:13:06 -0800240 EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X) * xScale + xOffset,
241 motionEvent->getX(i));
242 EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_Y) * yScale + yOffset,
243 motionEvent->getY(i));
Jeff Brown5912f952013-07-01 19:10:31 -0700244 EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_PRESSURE),
245 motionEvent->getPressure(i));
246 EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_SIZE),
247 motionEvent->getSize(i));
248 EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR),
249 motionEvent->getTouchMajor(i));
250 EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR),
251 motionEvent->getTouchMinor(i));
252 EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR),
253 motionEvent->getToolMajor(i));
254 EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR),
255 motionEvent->getToolMinor(i));
256 EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION),
257 motionEvent->getOrientation(i));
258 }
259
260 status = mConsumer->sendFinishedSignal(seq, false);
261 ASSERT_EQ(OK, status)
262 << "consumer sendFinishedSignal should return OK";
263
264 uint32_t finishedSeq = 0;
265 bool handled = true;
266 status = mPublisher->receiveFinishedSignal(&finishedSeq, &handled);
267 ASSERT_EQ(OK, status)
268 << "publisher receiveFinishedSignal should return OK";
269 ASSERT_EQ(seq, finishedSeq)
270 << "publisher receiveFinishedSignal should have returned the original sequence number";
271 ASSERT_FALSE(handled)
272 << "publisher receiveFinishedSignal should have set handled to consumer's reply";
273}
274
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800275void InputPublisherAndConsumerTest::PublishAndConsumeFocusEvent() {
276 status_t status;
277
278 constexpr uint32_t seq = 15;
279 constexpr bool hasFocus = true;
280 constexpr bool inTouchMode = true;
281
282 status = mPublisher->publishFocusEvent(seq, hasFocus, inTouchMode);
283 ASSERT_EQ(OK, status) << "publisher publishKeyEvent should return OK";
284
285 uint32_t consumeSeq;
286 InputEvent* event;
287 status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event);
288 ASSERT_EQ(OK, status) << "consumer consume should return OK";
289
290 ASSERT_TRUE(event != nullptr) << "consumer should have returned non-NULL event";
291 ASSERT_EQ(AINPUT_EVENT_TYPE_FOCUS, event->getType())
292 << "consumer should have returned a focus event";
293
294 FocusEvent* focusEvent = static_cast<FocusEvent*>(event);
295 EXPECT_EQ(seq, consumeSeq);
296 EXPECT_EQ(hasFocus, focusEvent->getHasFocus());
297 EXPECT_EQ(inTouchMode, focusEvent->getInTouchMode());
298
299 status = mConsumer->sendFinishedSignal(seq, true);
300 ASSERT_EQ(OK, status) << "consumer sendFinishedSignal should return OK";
301
302 uint32_t finishedSeq = 0;
303 bool handled = false;
304 status = mPublisher->receiveFinishedSignal(&finishedSeq, &handled);
305 ASSERT_EQ(OK, status) << "publisher receiveFinishedSignal should return OK";
306 ASSERT_EQ(seq, finishedSeq)
307 << "publisher receiveFinishedSignal should have returned the original sequence number";
308 ASSERT_TRUE(handled)
309 << "publisher receiveFinishedSignal should have set handled to consumer's reply";
310}
311
Jeff Brown5912f952013-07-01 19:10:31 -0700312TEST_F(InputPublisherAndConsumerTest, PublishKeyEvent_EndToEnd) {
313 ASSERT_NO_FATAL_FAILURE(PublishAndConsumeKeyEvent());
314}
315
316TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_EndToEnd) {
317 ASSERT_NO_FATAL_FAILURE(PublishAndConsumeMotionEvent());
318}
319
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800320TEST_F(InputPublisherAndConsumerTest, PublishFocusEvent_EndToEnd) {
321 ASSERT_NO_FATAL_FAILURE(PublishAndConsumeFocusEvent());
322}
323
Siarhei Vishniakoub0fffdd2017-11-10 20:16:56 -0800324TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenSequenceNumberIsZero_ReturnsError) {
Jeff Brown5912f952013-07-01 19:10:31 -0700325 status_t status;
Siarhei Vishniakoub0fffdd2017-11-10 20:16:56 -0800326 const size_t pointerCount = 1;
Jeff Brown5912f952013-07-01 19:10:31 -0700327 PointerProperties pointerProperties[pointerCount];
328 PointerCoords pointerCoords[pointerCount];
Siarhei Vishniakoub0fffdd2017-11-10 20:16:56 -0800329 for (size_t i = 0; i < pointerCount; i++) {
330 pointerProperties[i].clear();
331 pointerCoords[i].clear();
332 }
Jeff Brown5912f952013-07-01 19:10:31 -0700333
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600334 status = mPublisher->publishMotionEvent(0, 0, 0, 0, INVALID_HMAC, 0, 0, 0, 0, 0, 0,
335 MotionClassification::NONE, 1 /* xScale */,
336 1 /* yScale */, 0, 0, 0, 0,
337 AMOTION_EVENT_INVALID_CURSOR_POSITION,
338 AMOTION_EVENT_INVALID_CURSOR_POSITION, 0, 0,
339 pointerCount, pointerProperties, pointerCoords);
Jeff Brown5912f952013-07-01 19:10:31 -0700340 ASSERT_EQ(BAD_VALUE, status)
341 << "publisher publishMotionEvent should return BAD_VALUE";
342}
343
Siarhei Vishniakoub0fffdd2017-11-10 20:16:56 -0800344TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountLessThan1_ReturnsError) {
345 status_t status;
346 const size_t pointerCount = 0;
347 PointerProperties pointerProperties[pointerCount];
348 PointerCoords pointerCoords[pointerCount];
349
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600350 status = mPublisher->publishMotionEvent(1, 0, 0, 0, INVALID_HMAC, 0, 0, 0, 0, 0, 0,
351 MotionClassification::NONE, 1 /* xScale */,
352 1 /* yScale */, 0, 0, 0, 0,
353 AMOTION_EVENT_INVALID_CURSOR_POSITION,
354 AMOTION_EVENT_INVALID_CURSOR_POSITION, 0, 0,
355 pointerCount, pointerProperties, pointerCoords);
Siarhei Vishniakoub0fffdd2017-11-10 20:16:56 -0800356 ASSERT_EQ(BAD_VALUE, status)
357 << "publisher publishMotionEvent should return BAD_VALUE";
358}
359
360TEST_F(InputPublisherAndConsumerTest,
361 PublishMotionEvent_WhenPointerCountGreaterThanMax_ReturnsError) {
Jeff Brown5912f952013-07-01 19:10:31 -0700362 status_t status;
363 const size_t pointerCount = MAX_POINTERS + 1;
364 PointerProperties pointerProperties[pointerCount];
365 PointerCoords pointerCoords[pointerCount];
366 for (size_t i = 0; i < pointerCount; i++) {
367 pointerProperties[i].clear();
368 pointerCoords[i].clear();
369 }
370
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600371 status = mPublisher->publishMotionEvent(1, 0, 0, 0, INVALID_HMAC, 0, 0, 0, 0, 0, 0,
372 MotionClassification::NONE, 1 /* xScale */,
373 1 /* yScale */, 0, 0, 0, 0,
374 AMOTION_EVENT_INVALID_CURSOR_POSITION,
375 AMOTION_EVENT_INVALID_CURSOR_POSITION, 0, 0,
376 pointerCount, pointerProperties, pointerCoords);
Jeff Brown5912f952013-07-01 19:10:31 -0700377 ASSERT_EQ(BAD_VALUE, status)
378 << "publisher publishMotionEvent should return BAD_VALUE";
379}
380
381TEST_F(InputPublisherAndConsumerTest, PublishMultipleEvents_EndToEnd) {
382 ASSERT_NO_FATAL_FAILURE(PublishAndConsumeMotionEvent());
383 ASSERT_NO_FATAL_FAILURE(PublishAndConsumeKeyEvent());
384 ASSERT_NO_FATAL_FAILURE(PublishAndConsumeMotionEvent());
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800385 ASSERT_NO_FATAL_FAILURE(PublishAndConsumeFocusEvent());
Jeff Brown5912f952013-07-01 19:10:31 -0700386 ASSERT_NO_FATAL_FAILURE(PublishAndConsumeMotionEvent());
387 ASSERT_NO_FATAL_FAILURE(PublishAndConsumeKeyEvent());
388}
389
390} // namespace android