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

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

Issue 2233543002: Make first TouchStart and first TouchMove events on a flinging layer non-blocking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set non_blocking to true Created 4 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 397
398 ASSERT_EQ(InputMsg_HandleInputEvent::ID, message.type()); 398 ASSERT_EQ(InputMsg_HandleInputEvent::ID, message.type());
399 InputMsg_HandleInputEvent::Param params; 399 InputMsg_HandleInputEvent::Param params;
400 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(&message, &params)); 400 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(&message, &params));
401 const WebInputEvent* event = std::get<0>(params); 401 const WebInputEvent* event = std::get<0>(params);
402 InputEventDispatchType dispatch_type = std::get<2>(params); 402 InputEventDispatchType dispatch_type = std::get<2>(params);
403 403
404 EXPECT_EQ(kEvents[i].size, event->size); 404 EXPECT_EQ(kEvents[i].size, event->size);
405 kEvents[i].dispatchType = 405 kEvents[i].dispatchType =
406 WebInputEvent::DispatchType::ListenersNonBlockingPassive; 406 WebInputEvent::DispatchType::ListenersNonBlockingPassive;
407 kEvents[i].touchStartOrFirstTouchMove = true;
407 EXPECT_TRUE(memcmp(&kEvents[i], event, event->size) == 0); 408 EXPECT_TRUE(memcmp(&kEvents[i], event, event->size) == 0);
408 EXPECT_EQ(InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING, 409 EXPECT_EQ(InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING,
409 dispatch_type); 410 dispatch_type);
410 } 411 }
411 412
412 // Third message is coalesced. 413 // Third message is coalesced.
413 { 414 {
414 const IPC::Message& message = message_recorder_.message_at(2); 415 const IPC::Message& message = message_recorder_.message_at(2);
415 416
416 ASSERT_EQ(InputMsg_HandleInputEvent::ID, message.type()); 417 ASSERT_EQ(InputMsg_HandleInputEvent::ID, message.type());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 const IPC::Message& message = message_recorder_.message_at(0); 455 const IPC::Message& message = message_recorder_.message_at(0);
455 ASSERT_EQ(InputMsg_HandleInputEvent::ID, message.type()); 456 ASSERT_EQ(InputMsg_HandleInputEvent::ID, message.type());
456 InputMsg_HandleInputEvent::Param params; 457 InputMsg_HandleInputEvent::Param params;
457 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(&message, &params)); 458 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(&message, &params));
458 const WebInputEvent* event = std::get<0>(params); 459 const WebInputEvent* event = std::get<0>(params);
459 InputEventDispatchType dispatch_type = std::get<2>(params); 460 InputEventDispatchType dispatch_type = std::get<2>(params);
460 461
461 EXPECT_EQ(kEvents[0].size, event->size); 462 EXPECT_EQ(kEvents[0].size, event->size);
462 kEvents[0].dispatchType = 463 kEvents[0].dispatchType =
463 WebInputEvent::DispatchType::ListenersNonBlockingPassive; 464 WebInputEvent::DispatchType::ListenersNonBlockingPassive;
465 kEvents[0].touchStartOrFirstTouchMove = true;
464 EXPECT_TRUE(memcmp(&kEvents[0], event, event->size) == 0); 466 EXPECT_TRUE(memcmp(&kEvents[0], event, event->size) == 0);
465 EXPECT_EQ(InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING, 467 EXPECT_EQ(InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING,
466 dispatch_type); 468 dispatch_type);
467 } 469 }
468 470
469 { 471 {
470 const IPC::Message& message = message_recorder_.message_at(1); 472 const IPC::Message& message = message_recorder_.message_at(1);
471 ASSERT_EQ(InputMsg_HandleInputEvent::ID, message.type()); 473 ASSERT_EQ(InputMsg_HandleInputEvent::ID, message.type());
472 InputMsg_HandleInputEvent::Param params; 474 InputMsg_HandleInputEvent::Param params;
473 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(&message, &params)); 475 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(&message, &params));
474 const WebInputEvent* event = std::get<0>(params); 476 const WebInputEvent* event = std::get<0>(params);
475 InputEventDispatchType dispatch_type = std::get<2>(params); 477 InputEventDispatchType dispatch_type = std::get<2>(params);
476 478
477 EXPECT_EQ(kEvents[1].size, event->size); 479 EXPECT_EQ(kEvents[1].size, event->size);
478 kEvents[1].dispatchType = 480 kEvents[1].dispatchType =
479 WebInputEvent::DispatchType::ListenersNonBlockingPassive; 481 WebInputEvent::DispatchType::ListenersNonBlockingPassive;
482 kEvents[1].touchStartOrFirstTouchMove = false;
480 EXPECT_TRUE(memcmp(&kEvents[1], event, event->size) == 0); 483 EXPECT_TRUE(memcmp(&kEvents[1], event, event->size) == 0);
481 EXPECT_EQ(InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING, 484 EXPECT_EQ(InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING,
482 dispatch_type); 485 dispatch_type);
483 } 486 }
484 487
485 { 488 {
486 const IPC::Message& message = message_recorder_.message_at(2); 489 const IPC::Message& message = message_recorder_.message_at(2);
487 ASSERT_EQ(InputMsg_HandleInputEvent::ID, message.type()); 490 ASSERT_EQ(InputMsg_HandleInputEvent::ID, message.type());
488 InputMsg_HandleInputEvent::Param params; 491 InputMsg_HandleInputEvent::Param params;
489 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(&message, &params)); 492 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(&message, &params));
490 const WebInputEvent* event = std::get<0>(params); 493 const WebInputEvent* event = std::get<0>(params);
491 InputEventDispatchType dispatch_type = std::get<2>(params); 494 InputEventDispatchType dispatch_type = std::get<2>(params);
492 495 kBlockingEvents[0].touchStartOrFirstTouchMove = true;
493 EXPECT_EQ(kBlockingEvents[0].size, event->size); 496 EXPECT_EQ(kBlockingEvents[0].size, event->size);
494 EXPECT_TRUE(memcmp(&kBlockingEvents[0], event, event->size) == 0); 497 EXPECT_TRUE(memcmp(&kBlockingEvents[0], event, event->size) == 0);
495 EXPECT_EQ(InputEventDispatchType::DISPATCH_TYPE_BLOCKING, dispatch_type); 498 EXPECT_EQ(InputEventDispatchType::DISPATCH_TYPE_BLOCKING, dispatch_type);
496 } 499 }
497 } 500 }
498 501
499 } // namespace content 502 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698