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

Side by Side Diff: ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/events/ozone/evdev/touch_event_converter_evdev.h" 5 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <linux/input.h> 8 #include <linux/input.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 {time, EV_SYN, SYN_REPORT, 0}, 266 {time, EV_SYN, SYN_REPORT, 0},
267 }; 267 };
268 268
269 // Press. 269 // Press.
270 dev->ConfigureReadMock(mock_kernel_queue_press, 270 dev->ConfigureReadMock(mock_kernel_queue_press,
271 arraysize(mock_kernel_queue_press), 0); 271 arraysize(mock_kernel_queue_press), 0);
272 dev->ReadNow(); 272 dev->ReadNow();
273 EXPECT_EQ(1u, size()); 273 EXPECT_EQ(1u, size());
274 ui::TouchEventParams event = dispatched_event(0); 274 ui::TouchEventParams event = dispatched_event(0);
275 EXPECT_EQ(ui::ET_TOUCH_PRESSED, event.type); 275 EXPECT_EQ(ui::ET_TOUCH_PRESSED, event.type);
276 EXPECT_EQ(base::TimeDelta::FromMicroseconds(1427323282019203), 276 EXPECT_EQ(base::TimeTicks::FromInternalValue(1427323282019203),
277 event.timestamp); 277 event.timestamp);
278 EXPECT_EQ(295, event.location.x()); 278 EXPECT_EQ(295, event.location.x());
279 EXPECT_EQ(421, event.location.y()); 279 EXPECT_EQ(421, event.location.y());
280 EXPECT_EQ(0, event.slot); 280 EXPECT_EQ(0, event.slot);
281 EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH, 281 EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
282 event.pointer_details.pointer_type); 282 event.pointer_details.pointer_type);
283 EXPECT_FLOAT_EQ(58.f, event.pointer_details.radius_x); 283 EXPECT_FLOAT_EQ(58.f, event.pointer_details.radius_x);
284 EXPECT_FLOAT_EQ(0.13333334f, event.pointer_details.force); 284 EXPECT_FLOAT_EQ(0.13333334f, event.pointer_details.force);
285 285
286 // Move. 286 // Move.
287 dev->ConfigureReadMock(mock_kernel_queue_move, 287 dev->ConfigureReadMock(mock_kernel_queue_move,
288 arraysize(mock_kernel_queue_move), 0); 288 arraysize(mock_kernel_queue_move), 0);
289 dev->ReadNow(); 289 dev->ReadNow();
290 EXPECT_EQ(2u, size()); 290 EXPECT_EQ(2u, size());
291 event = dispatched_event(1); 291 event = dispatched_event(1);
292 EXPECT_EQ(ui::ET_TOUCH_MOVED, event.type); 292 EXPECT_EQ(ui::ET_TOUCH_MOVED, event.type);
293 EXPECT_EQ(base::TimeDelta::FromMicroseconds(1427323282034693), 293 EXPECT_EQ(base::TimeTicks::FromInternalValue(1427323282034693),
294 event.timestamp); 294 event.timestamp);
295 EXPECT_EQ(312, event.location.x()); 295 EXPECT_EQ(312, event.location.x());
296 EXPECT_EQ(432, event.location.y()); 296 EXPECT_EQ(432, event.location.y());
297 EXPECT_EQ(0, event.slot); 297 EXPECT_EQ(0, event.slot);
298 EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH, 298 EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
299 event.pointer_details.pointer_type); 299 event.pointer_details.pointer_type);
300 EXPECT_FLOAT_EQ(50.f, event.pointer_details.radius_x); 300 EXPECT_FLOAT_EQ(50.f, event.pointer_details.radius_x);
301 EXPECT_FLOAT_EQ(0.16862745f, event.pointer_details.force); 301 EXPECT_FLOAT_EQ(0.16862745f, event.pointer_details.force);
302 302
303 // Release. 303 // Release.
304 dev->ConfigureReadMock(mock_kernel_queue_release, 304 dev->ConfigureReadMock(mock_kernel_queue_release,
305 arraysize(mock_kernel_queue_release), 0); 305 arraysize(mock_kernel_queue_release), 0);
306 dev->ReadNow(); 306 dev->ReadNow();
307 EXPECT_EQ(3u, size()); 307 EXPECT_EQ(3u, size());
308 event = dispatched_event(2); 308 event = dispatched_event(2);
309 EXPECT_EQ(ui::ET_TOUCH_RELEASED, event.type); 309 EXPECT_EQ(ui::ET_TOUCH_RELEASED, event.type);
310 EXPECT_EQ(base::TimeDelta::FromMicroseconds(1427323282144540), 310 EXPECT_EQ(base::TimeTicks::FromInternalValue(1427323282144540),
311 event.timestamp); 311 event.timestamp);
312 EXPECT_EQ(312, event.location.x()); 312 EXPECT_EQ(312, event.location.x());
313 EXPECT_EQ(432, event.location.y()); 313 EXPECT_EQ(432, event.location.y());
314 EXPECT_EQ(0, event.slot); 314 EXPECT_EQ(0, event.slot);
315 EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH, 315 EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
316 event.pointer_details.pointer_type); 316 event.pointer_details.pointer_type);
317 EXPECT_FLOAT_EQ(50.f, event.pointer_details.radius_x); 317 EXPECT_FLOAT_EQ(50.f, event.pointer_details.radius_x);
318 EXPECT_FLOAT_EQ(0.16862745f, event.pointer_details.force); 318 EXPECT_FLOAT_EQ(0.16862745f, event.pointer_details.force);
319 } 319 }
320 320
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 }; 353 };
354 // Move on 0, press on 1. 354 // Move on 0, press on 1.
355 dev->ConfigureReadMock(mock_kernel_queue_move0press1, 9, 0); 355 dev->ConfigureReadMock(mock_kernel_queue_move0press1, 9, 0);
356 dev->ReadNow(); 356 dev->ReadNow();
357 EXPECT_EQ(4u, size()); 357 EXPECT_EQ(4u, size());
358 ui::TouchEventParams ev0 = dispatched_event(2); 358 ui::TouchEventParams ev0 = dispatched_event(2);
359 ui::TouchEventParams ev1 = dispatched_event(3); 359 ui::TouchEventParams ev1 = dispatched_event(3);
360 360
361 // Move 361 // Move
362 EXPECT_EQ(ui::ET_TOUCH_MOVED, ev0.type); 362 EXPECT_EQ(ui::ET_TOUCH_MOVED, ev0.type);
363 EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev0.timestamp); 363 EXPECT_EQ(base::TimeTicks::FromInternalValue(0), ev0.timestamp);
364 EXPECT_EQ(40, ev0.location.x()); 364 EXPECT_EQ(40, ev0.location.x());
365 EXPECT_EQ(51, ev0.location.y()); 365 EXPECT_EQ(51, ev0.location.y());
366 EXPECT_EQ(0, ev0.slot); 366 EXPECT_EQ(0, ev0.slot);
367 EXPECT_FLOAT_EQ(0.17647059f, ev0.pointer_details.force); 367 EXPECT_FLOAT_EQ(0.17647059f, ev0.pointer_details.force);
368 368
369 // Press 369 // Press
370 EXPECT_EQ(ui::ET_TOUCH_PRESSED, ev1.type); 370 EXPECT_EQ(ui::ET_TOUCH_PRESSED, ev1.type);
371 EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev1.timestamp); 371 EXPECT_EQ(base::TimeTicks::FromInternalValue(0), ev1.timestamp);
372 EXPECT_EQ(101, ev1.location.x()); 372 EXPECT_EQ(101, ev1.location.x());
373 EXPECT_EQ(102, ev1.location.y()); 373 EXPECT_EQ(102, ev1.location.y());
374 EXPECT_EQ(1, ev1.slot); 374 EXPECT_EQ(1, ev1.slot);
375 EXPECT_FLOAT_EQ(0.17647059f, ev1.pointer_details.force); 375 EXPECT_FLOAT_EQ(0.17647059f, ev1.pointer_details.force);
376 376
377 // Stationary 0, Moves 1. 377 // Stationary 0, Moves 1.
378 struct input_event mock_kernel_queue_stationary0_move1[] = { 378 struct input_event mock_kernel_queue_stationary0_move1[] = {
379 {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 40}, {{0, 0}, EV_SYN, SYN_REPORT, 0} 379 {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 40}, {{0, 0}, EV_SYN, SYN_REPORT, 0}
380 }; 380 };
381 dev->ConfigureReadMock(mock_kernel_queue_stationary0_move1, 2, 0); 381 dev->ConfigureReadMock(mock_kernel_queue_stationary0_move1, 2, 0);
382 dev->ReadNow(); 382 dev->ReadNow();
383 EXPECT_EQ(5u, size()); 383 EXPECT_EQ(5u, size());
384 ev1 = dispatched_event(4); 384 ev1 = dispatched_event(4);
385 385
386 EXPECT_EQ(ui::ET_TOUCH_MOVED, ev1.type); 386 EXPECT_EQ(ui::ET_TOUCH_MOVED, ev1.type);
387 EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev1.timestamp); 387 EXPECT_EQ(base::TimeTicks::FromInternalValue(0), ev1.timestamp);
388 EXPECT_EQ(40, ev1.location.x()); 388 EXPECT_EQ(40, ev1.location.x());
389 EXPECT_EQ(102, ev1.location.y()); 389 EXPECT_EQ(102, ev1.location.y());
390 EXPECT_EQ(1, ev1.slot); 390 EXPECT_EQ(1, ev1.slot);
391 EXPECT_FLOAT_EQ(0.17647059f, ev1.pointer_details.force); 391 EXPECT_FLOAT_EQ(0.17647059f, ev1.pointer_details.force);
392 392
393 // Move 0, stationary 1. 393 // Move 0, stationary 1.
394 struct input_event mock_kernel_queue_move0_stationary1[] = { 394 struct input_event mock_kernel_queue_move0_stationary1[] = {
395 {{0, 0}, EV_ABS, ABS_MT_SLOT, 0}, {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 39}, 395 {{0, 0}, EV_ABS, ABS_MT_SLOT, 0}, {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 39},
396 {{0, 0}, EV_SYN, SYN_REPORT, 0} 396 {{0, 0}, EV_SYN, SYN_REPORT, 0}
397 }; 397 };
398 dev->ConfigureReadMock(mock_kernel_queue_move0_stationary1, 3, 0); 398 dev->ConfigureReadMock(mock_kernel_queue_move0_stationary1, 3, 0);
399 dev->ReadNow(); 399 dev->ReadNow();
400 EXPECT_EQ(6u, size()); 400 EXPECT_EQ(6u, size());
401 ev0 = dispatched_event(5); 401 ev0 = dispatched_event(5);
402 402
403 EXPECT_EQ(ui::ET_TOUCH_MOVED, ev0.type); 403 EXPECT_EQ(ui::ET_TOUCH_MOVED, ev0.type);
404 EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev0.timestamp); 404 EXPECT_EQ(base::TimeTicks::FromInternalValue(0), ev0.timestamp);
405 EXPECT_EQ(39, ev0.location.x()); 405 EXPECT_EQ(39, ev0.location.x());
406 EXPECT_EQ(51, ev0.location.y()); 406 EXPECT_EQ(51, ev0.location.y());
407 EXPECT_EQ(0, ev0.slot); 407 EXPECT_EQ(0, ev0.slot);
408 EXPECT_FLOAT_EQ(0.17647059f, ev0.pointer_details.force); 408 EXPECT_FLOAT_EQ(0.17647059f, ev0.pointer_details.force);
409 409
410 // Release 0, move 1. 410 // Release 0, move 1.
411 struct input_event mock_kernel_queue_release0_move1[] = { 411 struct input_event mock_kernel_queue_release0_move1[] = {
412 {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, -1}, {{0, 0}, EV_ABS, ABS_MT_SLOT, 1}, 412 {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, -1}, {{0, 0}, EV_ABS, ABS_MT_SLOT, 1},
413 {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 38}, {{0, 0}, EV_SYN, SYN_REPORT, 0} 413 {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 38}, {{0, 0}, EV_SYN, SYN_REPORT, 0}
414 }; 414 };
415 dev->ConfigureReadMock(mock_kernel_queue_release0_move1, 4, 0); 415 dev->ConfigureReadMock(mock_kernel_queue_release0_move1, 4, 0);
416 dev->ReadNow(); 416 dev->ReadNow();
417 EXPECT_EQ(8u, size()); 417 EXPECT_EQ(8u, size());
418 ev0 = dispatched_event(6); 418 ev0 = dispatched_event(6);
419 ev1 = dispatched_event(7); 419 ev1 = dispatched_event(7);
420 420
421 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ev0.type); 421 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ev0.type);
422 EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev0.timestamp); 422 EXPECT_EQ(base::TimeTicks::FromInternalValue(0), ev0.timestamp);
423 EXPECT_EQ(39, ev0.location.x()); 423 EXPECT_EQ(39, ev0.location.x());
424 EXPECT_EQ(51, ev0.location.y()); 424 EXPECT_EQ(51, ev0.location.y());
425 EXPECT_EQ(0, ev0.slot); 425 EXPECT_EQ(0, ev0.slot);
426 EXPECT_FLOAT_EQ(0.17647059f, ev0.pointer_details.force); 426 EXPECT_FLOAT_EQ(0.17647059f, ev0.pointer_details.force);
427 427
428 EXPECT_EQ(ui::ET_TOUCH_MOVED, ev1.type); 428 EXPECT_EQ(ui::ET_TOUCH_MOVED, ev1.type);
429 EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev1.timestamp); 429 EXPECT_EQ(base::TimeTicks::FromInternalValue(0), ev1.timestamp);
430 EXPECT_EQ(38, ev1.location.x()); 430 EXPECT_EQ(38, ev1.location.x());
431 EXPECT_EQ(102, ev1.location.y()); 431 EXPECT_EQ(102, ev1.location.y());
432 EXPECT_EQ(1, ev1.slot); 432 EXPECT_EQ(1, ev1.slot);
433 EXPECT_FLOAT_EQ(0.17647059f, ev1.pointer_details.force); 433 EXPECT_FLOAT_EQ(0.17647059f, ev1.pointer_details.force);
434 434
435 // Release 1. 435 // Release 1.
436 struct input_event mock_kernel_queue_release1[] = { 436 struct input_event mock_kernel_queue_release1[] = {
437 {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, -1}, {{0, 0}, EV_SYN, SYN_REPORT, 0}, 437 {{0, 0}, EV_ABS, ABS_MT_TRACKING_ID, -1}, {{0, 0}, EV_SYN, SYN_REPORT, 0},
438 }; 438 };
439 dev->ConfigureReadMock(mock_kernel_queue_release1, 2, 0); 439 dev->ConfigureReadMock(mock_kernel_queue_release1, 2, 0);
440 dev->ReadNow(); 440 dev->ReadNow();
441 EXPECT_EQ(9u, size()); 441 EXPECT_EQ(9u, size());
442 ev1 = dispatched_event(8); 442 ev1 = dispatched_event(8);
443 443
444 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ev1.type); 444 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ev1.type);
445 EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev1.timestamp); 445 EXPECT_EQ(base::TimeTicks::FromInternalValue(0), ev1.timestamp);
446 EXPECT_EQ(38, ev1.location.x()); 446 EXPECT_EQ(38, ev1.location.x());
447 EXPECT_EQ(102, ev1.location.y()); 447 EXPECT_EQ(102, ev1.location.y());
448 EXPECT_EQ(1, ev1.slot); 448 EXPECT_EQ(1, ev1.slot);
449 EXPECT_FLOAT_EQ(0.17647059f, ev1.pointer_details.force); 449 EXPECT_FLOAT_EQ(0.17647059f, ev1.pointer_details.force);
450 } 450 }
451 451
452 TEST_F(TouchEventConverterEvdevTest, Unsync) { 452 TEST_F(TouchEventConverterEvdevTest, Unsync) {
453 ui::MockTouchEventConverterEvdev* dev = device(); 453 ui::MockTouchEventConverterEvdev* dev = device();
454 454
455 InitPixelTouchscreen(dev); 455 InitPixelTouchscreen(dev);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 {time, EV_SYN, SYN_REPORT, 0}, 658 {time, EV_SYN, SYN_REPORT, 0},
659 }; 659 };
660 660
661 // Press. 661 // Press.
662 dev->ConfigureReadMock(mock_kernel_queue_press, 662 dev->ConfigureReadMock(mock_kernel_queue_press,
663 arraysize(mock_kernel_queue_press), 0); 663 arraysize(mock_kernel_queue_press), 0);
664 dev->ReadNow(); 664 dev->ReadNow();
665 EXPECT_EQ(1u, size()); 665 EXPECT_EQ(1u, size());
666 ui::TouchEventParams event = dispatched_event(0); 666 ui::TouchEventParams event = dispatched_event(0);
667 EXPECT_EQ(ui::ET_TOUCH_PRESSED, event.type); 667 EXPECT_EQ(ui::ET_TOUCH_PRESSED, event.type);
668 EXPECT_EQ(base::TimeDelta::FromMicroseconds(1433965490837958), 668 EXPECT_EQ(base::TimeTicks::FromInternalValue(1433965490837958),
669 event.timestamp); 669 event.timestamp);
670 EXPECT_EQ(3654, event.location.x()); 670 EXPECT_EQ(3654, event.location.x());
671 EXPECT_EQ(1055, event.location.y()); 671 EXPECT_EQ(1055, event.location.y());
672 EXPECT_EQ(0, event.slot); 672 EXPECT_EQ(0, event.slot);
673 EXPECT_FLOAT_EQ(0.f, event.pointer_details.radius_x); 673 EXPECT_FLOAT_EQ(0.f, event.pointer_details.radius_x);
674 EXPECT_FLOAT_EQ(0.f, event.pointer_details.force); 674 EXPECT_FLOAT_EQ(0.f, event.pointer_details.force);
675 675
676 // Move. 676 // Move.
677 dev->ConfigureReadMock(mock_kernel_queue_move, 677 dev->ConfigureReadMock(mock_kernel_queue_move,
678 arraysize(mock_kernel_queue_move), 0); 678 arraysize(mock_kernel_queue_move), 0);
679 dev->ReadNow(); 679 dev->ReadNow();
680 EXPECT_EQ(2u, size()); 680 EXPECT_EQ(2u, size());
681 event = dispatched_event(1); 681 event = dispatched_event(1);
682 EXPECT_EQ(ui::ET_TOUCH_MOVED, event.type); 682 EXPECT_EQ(ui::ET_TOUCH_MOVED, event.type);
683 EXPECT_EQ(base::TimeDelta::FromMicroseconds(1433965491001953), 683 EXPECT_EQ(base::TimeTicks::FromInternalValue(1433965491001953),
684 event.timestamp); 684 event.timestamp);
685 EXPECT_EQ(3644, event.location.x()); 685 EXPECT_EQ(3644, event.location.x());
686 EXPECT_EQ(1059, event.location.y()); 686 EXPECT_EQ(1059, event.location.y());
687 EXPECT_EQ(0, event.slot); 687 EXPECT_EQ(0, event.slot);
688 EXPECT_FLOAT_EQ(0.f, event.pointer_details.radius_x); 688 EXPECT_FLOAT_EQ(0.f, event.pointer_details.radius_x);
689 EXPECT_FLOAT_EQ(0.f, event.pointer_details.force); 689 EXPECT_FLOAT_EQ(0.f, event.pointer_details.force);
690 690
691 // Release. 691 // Release.
692 dev->ConfigureReadMock(mock_kernel_queue_release, 692 dev->ConfigureReadMock(mock_kernel_queue_release,
693 arraysize(mock_kernel_queue_release), 0); 693 arraysize(mock_kernel_queue_release), 0);
694 dev->ReadNow(); 694 dev->ReadNow();
695 EXPECT_EQ(3u, size()); 695 EXPECT_EQ(3u, size());
696 event = dispatched_event(2); 696 event = dispatched_event(2);
697 EXPECT_EQ(ui::ET_TOUCH_RELEASED, event.type); 697 EXPECT_EQ(ui::ET_TOUCH_RELEASED, event.type);
698 EXPECT_EQ(base::TimeDelta::FromMicroseconds(1433965491225959), 698 EXPECT_EQ(base::TimeTicks::FromInternalValue(1433965491225959),
699 event.timestamp); 699 event.timestamp);
700 EXPECT_EQ(3644, event.location.x()); 700 EXPECT_EQ(3644, event.location.x());
701 EXPECT_EQ(1059, event.location.y()); 701 EXPECT_EQ(1059, event.location.y());
702 EXPECT_EQ(0, event.slot); 702 EXPECT_EQ(0, event.slot);
703 EXPECT_FLOAT_EQ(0.f, event.pointer_details.radius_x); 703 EXPECT_FLOAT_EQ(0.f, event.pointer_details.radius_x);
704 EXPECT_FLOAT_EQ(0.f, event.pointer_details.force); 704 EXPECT_FLOAT_EQ(0.f, event.pointer_details.force);
705 705
706 // No dispatch on destruction. 706 // No dispatch on destruction.
707 DestroyDevice(); 707 DestroyDevice();
708 EXPECT_EQ(3u, size()); 708 EXPECT_EQ(3u, size());
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 // - Considers all events of type |noise_event_type| as noise. 783 // - Considers all events of type |noise_event_type| as noise.
784 // - Keeps track of the events that it receives. 784 // - Keeps track of the events that it receives.
785 class EventTypeTouchNoiseFilter : public TouchNoiseFilter { 785 class EventTypeTouchNoiseFilter : public TouchNoiseFilter {
786 public: 786 public:
787 explicit EventTypeTouchNoiseFilter(EventType noise_event_type) 787 explicit EventTypeTouchNoiseFilter(EventType noise_event_type)
788 : noise_event_type_(noise_event_type) {} 788 : noise_event_type_(noise_event_type) {}
789 ~EventTypeTouchNoiseFilter() override {} 789 ~EventTypeTouchNoiseFilter() override {}
790 790
791 // TouchNoiseFilter: 791 // TouchNoiseFilter:
792 void Filter(const std::vector<InProgressTouchEvdev>& touches, 792 void Filter(const std::vector<InProgressTouchEvdev>& touches,
793 base::TimeDelta time, 793 base::TimeTicks time,
794 std::bitset<kNumTouchEvdevSlots>* slots_with_noise) override { 794 std::bitset<kNumTouchEvdevSlots>* slots_with_noise) override {
795 for (const InProgressTouchEvdev& touch : touches) { 795 for (const InProgressTouchEvdev& touch : touches) {
796 EventType event_type = EventTypeFromTouch(touch); 796 EventType event_type = EventTypeFromTouch(touch);
797 ++counts_[event_type]; 797 ++counts_[event_type];
798 if (event_type == noise_event_type_) 798 if (event_type == noise_event_type_)
799 slots_with_noise->set(touch.slot); 799 slots_with_noise->set(touch.slot);
800 } 800 }
801 } 801 }
802 802
803 // Returns the number of received events of |type|. 803 // Returns the number of received events of |type|.
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 event = dispatched_event(3); 1042 event = dispatched_event(3);
1043 EXPECT_EQ(ui::ET_TOUCH_RELEASED, event.type); 1043 EXPECT_EQ(ui::ET_TOUCH_RELEASED, event.type);
1044 EXPECT_EQ(8930, event.location.x()); 1044 EXPECT_EQ(8930, event.location.x());
1045 EXPECT_EQ(980, event.location.y()); 1045 EXPECT_EQ(980, event.location.y());
1046 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN, 1046 EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
1047 event.pointer_details.pointer_type); 1047 event.pointer_details.pointer_type);
1048 EXPECT_EQ(0.f / 1024, event.pointer_details.force); 1048 EXPECT_EQ(0.f / 1024, event.pointer_details.force);
1049 } 1049 }
1050 1050
1051 } // namespace ui 1051 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698