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

Side by Side Diff: content/browser/renderer_host/input/legacy_input_router_impl_unittest.cc

Issue 2943133002: Async Wheel Event with only the first one cancellable behind a flag. (Closed)
Patch Set: failing tests fixed. Created 3 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 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 "content/browser/renderer_host/input/legacy_input_router_impl.h" 5 #include "content/browser/renderer_host/input/legacy_input_router_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 for (size_t i = 0; i < subset.size(); ++i) { 142 for (size_t i = 0; i < subset.size(); ++i) {
143 bool equivalent = TouchEventsAreEquivalent(*(subset[i]), *(set[i])); 143 bool equivalent = TouchEventsAreEquivalent(*(subset[i]), *(set[i]));
144 if (!equivalent) 144 if (!equivalent)
145 return false; 145 return false;
146 } 146 }
147 147
148 return true; 148 return true;
149 } 149 }
150 #endif // defined(USE_AURA) 150 #endif // defined(USE_AURA)
151 151
152 enum WheelScrollingMode {
153 kWheelScrollingModeNone,
154 kWheelScrollLatching,
155 kAsyncWheelEvents,
156 };
157
152 } // namespace 158 } // namespace
153 159
154 class LegacyInputRouterImplTest : public testing::Test { 160 class LegacyInputRouterImplTest : public testing::Test {
155 public: 161 public:
156 LegacyInputRouterImplTest(bool raf_aligned_touch = true, 162 LegacyInputRouterImplTest(
157 bool wheel_scroll_latching = true) 163 bool raf_aligned_touch = true,
158 : scoped_task_environment_( 164 WheelScrollingMode wheel_scrolling_mode = kWheelScrollLatching)
165 : wheel_scroll_latching_enabled_(wheel_scrolling_mode !=
166 kWheelScrollingModeNone),
167 scoped_task_environment_(
159 base::test::ScopedTaskEnvironment::MainThreadType::UI) { 168 base::test::ScopedTaskEnvironment::MainThreadType::UI) {
160 if (raf_aligned_touch && wheel_scroll_latching) { 169 if (raf_aligned_touch && wheel_scrolling_mode == kAsyncWheelEvents) {
170 feature_list_.InitWithFeatures({features::kRafAlignedTouchInputEvents,
171 features::kTouchpadAndWheelScrollLatching,
172 features::kAsyncWheelEvents},
173 {});
174 } else if (raf_aligned_touch &&
175 wheel_scrolling_mode == kWheelScrollLatching) {
161 feature_list_.InitWithFeatures( 176 feature_list_.InitWithFeatures(
162 {features::kRafAlignedTouchInputEvents, 177 {features::kRafAlignedTouchInputEvents,
163 features::kTouchpadAndWheelScrollLatching}, 178 features::kTouchpadAndWheelScrollLatching},
164 {}); 179 {features::kAsyncWheelEvents});
165 } else if (raf_aligned_touch && !wheel_scroll_latching) { 180 } else if (raf_aligned_touch &&
166 feature_list_.InitWithFeatures( 181 wheel_scrolling_mode == kWheelScrollingModeNone) {
167 {features::kRafAlignedTouchInputEvents}, 182 feature_list_.InitWithFeatures({features::kRafAlignedTouchInputEvents},
168 {features::kTouchpadAndWheelScrollLatching}); 183 {features::kTouchpadAndWheelScrollLatching,
169 } else if (!raf_aligned_touch && wheel_scroll_latching) { 184 features::kAsyncWheelEvents});
185 } else if (!raf_aligned_touch &&
186 wheel_scrolling_mode == kAsyncWheelEvents) {
187 feature_list_.InitWithFeatures({features::kTouchpadAndWheelScrollLatching,
188 features::kAsyncWheelEvents},
189 {features::kRafAlignedTouchInputEvents});
190 } else if (!raf_aligned_touch &&
191 wheel_scrolling_mode == kWheelScrollLatching) {
170 feature_list_.InitWithFeatures( 192 feature_list_.InitWithFeatures(
171 {features::kTouchpadAndWheelScrollLatching}, 193 {features::kTouchpadAndWheelScrollLatching},
172 {features::kRafAlignedTouchInputEvents}); 194 {features::kRafAlignedTouchInputEvents, features::kAsyncWheelEvents});
173 } else { // !raf_aligned_touch && !wheel_scroll_latching 195 } else { // !raf_aligned_touch && wheel_scroll_latching ==
174 feature_list_.InitWithFeatures( 196 // kWheelScrollingModeNone.
175 {}, {features::kRafAlignedTouchInputEvents, 197 feature_list_.InitWithFeatures({},
176 features::kTouchpadAndWheelScrollLatching}); 198 {features::kRafAlignedTouchInputEvents,
199 features::kTouchpadAndWheelScrollLatching,
200 features::kAsyncWheelEvents});
177 } 201 }
178 } 202 }
179 203
180 ~LegacyInputRouterImplTest() override {} 204 ~LegacyInputRouterImplTest() override {}
181 205
182 protected: 206 protected:
183 // testing::Test 207 // testing::Test
184 void SetUp() override { 208 void SetUp() override {
185 browser_context_.reset(new TestBrowserContext()); 209 browser_context_.reset(new TestBrowserContext());
186 process_.reset(new MockRenderProcessHost(browser_context_.get())); 210 process_.reset(new MockRenderProcessHost(browser_context_.get()));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 float dY, 265 float dY,
242 int modifiers, 266 int modifiers,
243 bool precise, 267 bool precise,
244 WebMouseWheelEvent::Phase phase) { 268 WebMouseWheelEvent::Phase phase) {
245 WebMouseWheelEvent wheel_event = SyntheticWebMouseWheelEventBuilder::Build( 269 WebMouseWheelEvent wheel_event = SyntheticWebMouseWheelEventBuilder::Build(
246 x, y, dX, dY, modifiers, precise); 270 x, y, dX, dY, modifiers, precise);
247 wheel_event.phase = phase; 271 wheel_event.phase = phase;
248 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event)); 272 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event));
249 } 273 }
250 274
275 void SimulateWheelEventPossiblyIncludingPhase(
276 bool ignore_phase,
277 float x,
278 float y,
279 float dX,
280 float dY,
281 int modifiers,
282 bool precise,
283 WebMouseWheelEvent::Phase phase) {
284 if (ignore_phase)
285 SimulateWheelEvent(x, y, dX, dY, modifiers, precise);
286 else
287 SimulateWheelEventWithPhase(x, y, dX, dY, modifiers, precise, phase);
288 }
289
251 void SimulateMouseEvent(WebInputEvent::Type type, int x, int y) { 290 void SimulateMouseEvent(WebInputEvent::Type type, int x, int y) {
252 input_router_->SendMouseEvent(MouseEventWithLatencyInfo( 291 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(
253 SyntheticWebMouseEventBuilder::Build(type, x, y, 0))); 292 SyntheticWebMouseEventBuilder::Build(type, x, y, 0)));
254 } 293 }
255 294
256 void SimulateWheelEventWithPhase(WebMouseWheelEvent::Phase phase) { 295 void SimulateWheelEventWithPhase(WebMouseWheelEvent::Phase phase) {
257 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo( 296 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(
258 SyntheticWebMouseWheelEventBuilder::Build(phase))); 297 SyntheticWebMouseWheelEventBuilder::Build(phase)));
259 } 298 }
260 299
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 process_->sink().ClearMessages(); 411 process_->sink().ClearMessages();
373 return count; 412 return count;
374 } 413 }
375 414
376 static void RunTasksAndWait(base::TimeDelta delay) { 415 static void RunTasksAndWait(base::TimeDelta delay) {
377 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 416 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
378 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), delay); 417 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), delay);
379 base::RunLoop().Run(); 418 base::RunLoop().Run();
380 } 419 }
381 420
382 void UnhandledWheelEvent(bool wheel_scroll_latching_enabled) { 421 void UnhandledWheelEvent();
383 // Simulate wheel events.
384 if (wheel_scroll_latching_enabled) {
385 SimulateWheelEventWithPhase(
386 0, 0, 0, -5, 0, false,
387 WebMouseWheelEvent::kPhaseBegan); // sent directly
388 SimulateWheelEventWithPhase(
389 0, 0, 0, -10, 0, false,
390 WebMouseWheelEvent::kPhaseChanged); // enqueued
391 } else {
392 SimulateWheelEvent(0, 0, 0, -5, 0, false); // sent directly
393 SimulateWheelEvent(0, 0, 0, -10, 0, false); // enqueued
394 }
395 422
396 // Check that only the first event was sent. 423 void OverscrollDispatch();
397 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(
398 InputMsg_HandleInputEvent::ID));
399 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
400
401 // Indicate that the wheel event was unhandled.
402 SendInputEventACK(WebInputEvent::kMouseWheel,
403 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
404
405 // Check that the ack for the MouseWheel and ScrollBegin
406 // were processed.
407 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
408
409 // There should be a ScrollBegin and ScrollUpdate, MouseWheel sent.
410 EXPECT_EQ(3U, GetSentMessageCountAndResetSink());
411
412 EXPECT_EQ(ack_handler_->acked_wheel_event().delta_y, -5);
413 SendInputEventACK(WebInputEvent::kGestureScrollUpdate,
414 INPUT_EVENT_ACK_STATE_CONSUMED);
415
416 if (wheel_scroll_latching_enabled) {
417 // Check that the ack for ScrollUpdate were processed.
418 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
419 } else {
420 // The GestureScrollUpdate ACK releases the GestureScrollEnd.
421 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
422
423 // Check that the ack for the ScrollUpdate and ScrollEnd
424 // were processed.
425 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
426 }
427
428 SendInputEventACK(WebInputEvent::kMouseWheel,
429 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
430
431 if (wheel_scroll_latching_enabled) {
432 // There should be a ScrollUpdate sent.
433 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
434 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
435 } else {
436 // There should be a ScrollBegin and ScrollUpdate sent.
437 EXPECT_EQ(2U, GetSentMessageCountAndResetSink());
438 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
439 }
440
441 // Check that the correct unhandled wheel event was received.
442 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED,
443 ack_handler_->acked_wheel_event_state());
444 EXPECT_EQ(ack_handler_->acked_wheel_event().delta_y, -10);
445
446 SendInputEventACK(WebInputEvent::kGestureScrollUpdate,
447 INPUT_EVENT_ACK_STATE_CONSUMED);
448
449 if (wheel_scroll_latching_enabled) {
450 // Check that the ack for ScrollUpdate were processed.
451 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
452 } else {
453 // The GestureScrollUpdate ACK releases the GestureScrollEnd.
454 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
455
456 // Check that the ack for the ScrollUpdate and ScrollEnd
457 // were processed.
458 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
459 }
460 }
461 424
462 InputRouter::Config config_; 425 InputRouter::Config config_;
463 std::unique_ptr<MockRenderProcessHost> process_; 426 std::unique_ptr<MockRenderProcessHost> process_;
464 std::unique_ptr<MockInputRouterClient> client_; 427 std::unique_ptr<MockInputRouterClient> client_;
465 std::unique_ptr<MockInputAckHandler> ack_handler_; 428 std::unique_ptr<MockInputAckHandler> ack_handler_;
466 std::unique_ptr<LegacyInputRouterImpl> input_router_; 429 std::unique_ptr<LegacyInputRouterImpl> input_router_;
430 bool wheel_scroll_latching_enabled_;
467 431
468 private: 432 private:
469 base::test::ScopedTaskEnvironment scoped_task_environment_; 433 base::test::ScopedTaskEnvironment scoped_task_environment_;
470 SyntheticWebTouchEvent touch_event_; 434 SyntheticWebTouchEvent touch_event_;
471 435
472 base::test::ScopedFeatureList feature_list_; 436 base::test::ScopedFeatureList feature_list_;
473 std::unique_ptr<TestBrowserContext> browser_context_; 437 std::unique_ptr<TestBrowserContext> browser_context_;
474 }; 438 };
475 439
476 class LegacyInputRouterImplRafAlignedTouchDisabledTest 440 class LegacyInputRouterImplRafAlignedTouchDisabledTest
477 : public LegacyInputRouterImplTest { 441 : public LegacyInputRouterImplTest {
478 public: 442 public:
479 LegacyInputRouterImplRafAlignedTouchDisabledTest() 443 LegacyInputRouterImplRafAlignedTouchDisabledTest()
480 : LegacyInputRouterImplTest(false, false) {} 444 : LegacyInputRouterImplTest(false, kWheelScrollingModeNone) {}
481 }; 445 };
482 446
483 class LegacyInputRouterImplWheelScrollLatchingDisabledTest 447 class LegacyInputRouterImplWheelScrollLatchingDisabledTest
484 : public LegacyInputRouterImplTest { 448 : public LegacyInputRouterImplTest {
485 public: 449 public:
486 LegacyInputRouterImplWheelScrollLatchingDisabledTest() 450 LegacyInputRouterImplWheelScrollLatchingDisabledTest()
487 : LegacyInputRouterImplTest(true, false) {} 451 : LegacyInputRouterImplTest(true, kWheelScrollingModeNone) {}
452 };
453
454 class LegacyInputRouterImplAsyncWheelEventEnabledTest
455 : public LegacyInputRouterImplTest {
456 public:
457 LegacyInputRouterImplAsyncWheelEventEnabledTest()
458 : LegacyInputRouterImplTest(true, kAsyncWheelEvents) {}
488 }; 459 };
489 460
490 TEST_F(LegacyInputRouterImplTest, CoalescesRangeSelection) { 461 TEST_F(LegacyInputRouterImplTest, CoalescesRangeSelection) {
491 input_router_->SendInput(std::unique_ptr<IPC::Message>( 462 input_router_->SendInput(std::unique_ptr<IPC::Message>(
492 new InputMsg_SelectRange(0, gfx::Point(1, 2), gfx::Point(3, 4)))); 463 new InputMsg_SelectRange(0, gfx::Point(1, 2), gfx::Point(3, 4))));
493 ExpectIPCMessageWithArg2<InputMsg_SelectRange>( 464 ExpectIPCMessageWithArg2<InputMsg_SelectRange>(
494 process_->sink().GetMessageAt(0), gfx::Point(1, 2), gfx::Point(3, 4)); 465 process_->sink().GetMessageAt(0), gfx::Point(1, 2), gfx::Point(3, 4));
495 EXPECT_EQ(1u, GetSentMessageCountAndResetSink()); 466 EXPECT_EQ(1u, GetSentMessageCountAndResetSink());
496 467
497 // Send two more messages without acking. 468 // Send two more messages without acking.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 // Send second message: MoveRangeSelectionExtent. 542 // Send second message: MoveRangeSelectionExtent.
572 input_router_->SendInput(std::unique_ptr<IPC::Message>( 543 input_router_->SendInput(std::unique_ptr<IPC::Message>(
573 new InputMsg_MoveRangeSelectionExtent(0, gfx::Point(5, 6)))); 544 new InputMsg_MoveRangeSelectionExtent(0, gfx::Point(5, 6))));
574 EXPECT_EQ(0u, GetSentMessageCountAndResetSink()); 545 EXPECT_EQ(0u, GetSentMessageCountAndResetSink());
575 546
576 // Send third message: SelectRange. 547 // Send third message: SelectRange.
577 input_router_->SendInput(std::unique_ptr<IPC::Message>( 548 input_router_->SendInput(std::unique_ptr<IPC::Message>(
578 new InputMsg_SelectRange(0, gfx::Point(7, 8), gfx::Point(9, 10)))); 549 new InputMsg_SelectRange(0, gfx::Point(7, 8), gfx::Point(9, 10))));
579 EXPECT_EQ(0u, GetSentMessageCountAndResetSink()); 550 EXPECT_EQ(0u, GetSentMessageCountAndResetSink());
580 551
581 // Ack the messages and verify that they're not coalesced and that they're in 552 // Ack the messages and verify that they're not coalesced and that they're
582 // correct order. 553 // in correct order.
583 554
584 // Ack the first message. 555 // Ack the first message.
585 { 556 {
586 std::unique_ptr<IPC::Message> response(new InputHostMsg_SelectRange_ACK(0)); 557 std::unique_ptr<IPC::Message> response(new InputHostMsg_SelectRange_ACK(0));
587 input_router_->OnMessageReceived(*response); 558 input_router_->OnMessageReceived(*response);
588 } 559 }
589 560
590 ExpectIPCMessageWithArg1<InputMsg_MoveRangeSelectionExtent>( 561 ExpectIPCMessageWithArg1<InputMsg_MoveRangeSelectionExtent>(
591 process_->sink().GetMessageAt(0), gfx::Point(5, 6)); 562 process_->sink().GetMessageAt(0), gfx::Point(5, 6));
592 EXPECT_EQ(1u, GetSentMessageCountAndResetSink()); 563 EXPECT_EQ(1u, GetSentMessageCountAndResetSink());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 input_router_->SendInput(std::unique_ptr<IPC::Message>( 622 input_router_->SendInput(std::unique_ptr<IPC::Message>(
652 new InputMsg_MoveRangeSelectionExtent(0, gfx::Point(19, 20)))); 623 new InputMsg_MoveRangeSelectionExtent(0, gfx::Point(19, 20))));
653 EXPECT_EQ(0u, GetSentMessageCountAndResetSink()); 624 EXPECT_EQ(0u, GetSentMessageCountAndResetSink());
654 625
655 // Ack the first message. 626 // Ack the first message.
656 { 627 {
657 std::unique_ptr<IPC::Message> response(new InputHostMsg_SelectRange_ACK(0)); 628 std::unique_ptr<IPC::Message> response(new InputHostMsg_SelectRange_ACK(0));
658 input_router_->OnMessageReceived(*response); 629 input_router_->OnMessageReceived(*response);
659 } 630 }
660 631
661 // Verify that the three MoveRangeSelectionExtent messages are coalesced into 632 // Verify that the three MoveRangeSelectionExtent messages are coalesced
662 // one message. 633 // into one message.
663 ExpectIPCMessageWithArg1<InputMsg_MoveRangeSelectionExtent>( 634 ExpectIPCMessageWithArg1<InputMsg_MoveRangeSelectionExtent>(
664 process_->sink().GetMessageAt(0), gfx::Point(9, 10)); 635 process_->sink().GetMessageAt(0), gfx::Point(9, 10));
665 EXPECT_EQ(1u, GetSentMessageCountAndResetSink()); 636 EXPECT_EQ(1u, GetSentMessageCountAndResetSink());
666 637
667 // Ack the second message. 638 // Ack the second message.
668 { 639 {
669 std::unique_ptr<IPC::Message> response( 640 std::unique_ptr<IPC::Message> response(
670 new InputHostMsg_MoveRangeSelectionExtent_ACK(0)); 641 new InputHostMsg_MoveRangeSelectionExtent_ACK(0));
671 input_router_->OnMessageReceived(*response); 642 input_router_->OnMessageReceived(*response);
672 } 643 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); 738 EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount());
768 } 739 }
769 740
770 TEST_F(LegacyInputRouterImplTest, NoncorrespondingKeyEvents) { 741 TEST_F(LegacyInputRouterImplTest, NoncorrespondingKeyEvents) {
771 SimulateKeyboardEvent(WebInputEvent::kRawKeyDown); 742 SimulateKeyboardEvent(WebInputEvent::kRawKeyDown);
772 743
773 SendInputEventACK(WebInputEvent::kKeyUp, INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 744 SendInputEventACK(WebInputEvent::kKeyUp, INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
774 EXPECT_TRUE(ack_handler_->unexpected_event_ack_called()); 745 EXPECT_TRUE(ack_handler_->unexpected_event_ack_called());
775 } 746 }
776 747
777 // Tests ported from RenderWidgetHostTest -------------------------------------- 748 // Tests ported from RenderWidgetHostTest -------------------------------------
778 749
779 TEST_F(LegacyInputRouterImplTest, HandleKeyEventsWeSent) { 750 TEST_F(LegacyInputRouterImplTest, HandleKeyEventsWeSent) {
780 // Simulate a keyboard event. 751 // Simulate a keyboard event.
781 SimulateKeyboardEvent(WebInputEvent::kRawKeyDown); 752 SimulateKeyboardEvent(WebInputEvent::kRawKeyDown);
782 ASSERT_TRUE(input_router_->GetLastKeyboardEvent()); 753 ASSERT_TRUE(input_router_->GetLastKeyboardEvent());
783 EXPECT_EQ(WebInputEvent::kRawKeyDown, 754 EXPECT_EQ(WebInputEvent::kRawKeyDown,
784 input_router_->GetLastKeyboardEvent()->GetType()); 755 input_router_->GetLastKeyboardEvent()->GetType());
785 756
786 // Make sure we sent the input event to the renderer. 757 // Make sure we sent the input event to the renderer.
787 EXPECT_TRUE( 758 EXPECT_TRUE(
(...skipping 11 matching lines...) Expand all
799 TEST_F(LegacyInputRouterImplTest, IgnoreKeyEventsWeDidntSend) { 770 TEST_F(LegacyInputRouterImplTest, IgnoreKeyEventsWeDidntSend) {
800 // Send a simulated, unrequested key response. We should ignore this. 771 // Send a simulated, unrequested key response. We should ignore this.
801 SendInputEventACK(WebInputEvent::kRawKeyDown, 772 SendInputEventACK(WebInputEvent::kRawKeyDown,
802 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 773 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
803 774
804 EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); 775 EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount());
805 } 776 }
806 777
807 TEST_F(LegacyInputRouterImplTest, CoalescesWheelEvents) { 778 TEST_F(LegacyInputRouterImplTest, CoalescesWheelEvents) {
808 // Simulate wheel events. 779 // Simulate wheel events.
809 SimulateWheelEvent(0, 0, 0, -5, 0, false); // sent directly 780 SimulateWheelEventPossiblyIncludingPhase(
810 SimulateWheelEvent(0, 0, 0, -10, 0, false); // enqueued 781 !wheel_scroll_latching_enabled_, 0, 0, 0, -5, 0, false,
811 SimulateWheelEvent(0, 0, 8, -6, 0, false); // coalesced into previous event 782 WebMouseWheelEvent::kPhaseBegan); // sent directly
812 SimulateWheelEvent(0, 0, 9, -7, 1, false); // enqueued, different modifiers 783 SimulateWheelEventPossiblyIncludingPhase(
813 SimulateWheelEvent(0, 0, 0, -10, 0, false); // enqueued, different modifiers 784 !wheel_scroll_latching_enabled_, 0, 0, 0, -10, 0, false,
785 WebMouseWheelEvent::kPhaseChanged); // enqueued
786 SimulateWheelEventPossiblyIncludingPhase(
787 !wheel_scroll_latching_enabled_, 0, 0, 8, -6, 0, false,
788 WebMouseWheelEvent::kPhaseChanged); // coalesced into previous event
789 SimulateWheelEventPossiblyIncludingPhase(
790 !wheel_scroll_latching_enabled_, 0, 0, 9, -7, 1, false,
791 WebMouseWheelEvent::kPhaseChanged); // enqueued, different modifiers
792 SimulateWheelEventPossiblyIncludingPhase(
793 !wheel_scroll_latching_enabled_, 0, 0, 0, -10, 0, false,
794 WebMouseWheelEvent::kPhaseChanged); // enqueued, different modifiers
814 // Explicitly verify that PhaseEnd isn't coalesced to avoid bugs like 795 // Explicitly verify that PhaseEnd isn't coalesced to avoid bugs like
815 // https://crbug.com/154740. 796 // https://crbug.com/154740.
816 SimulateWheelEventWithPhase(WebMouseWheelEvent::kPhaseEnded); // enqueued 797 SimulateWheelEventWithPhase(WebMouseWheelEvent::kPhaseEnded); // enqueued
817 798
818 // Check that only the first event was sent. 799 // Check that only the first event was sent.
819 EXPECT_TRUE( 800 EXPECT_TRUE(
820 process_->sink().GetUniqueMessageMatching(InputMsg_HandleInputEvent::ID)); 801 process_->sink().GetUniqueMessageMatching(InputMsg_HandleInputEvent::ID));
821 const WebInputEvent* input_event = 802 const WebInputEvent* input_event =
822 GetInputEventFromMessage(*process_->sink().GetMessageAt(0)); 803 GetInputEventFromMessage(*process_->sink().GetMessageAt(0));
823 ASSERT_EQ(WebInputEvent::kMouseWheel, input_event->GetType()); 804 ASSERT_EQ(WebInputEvent::kMouseWheel, input_event->GetType());
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 934
954 SendTouchEventACK(WebInputEvent::kTouchMove, INPUT_EVENT_ACK_STATE_CONSUMED, 935 SendTouchEventACK(WebInputEvent::kTouchMove, INPUT_EVENT_ACK_STATE_CONSUMED,
955 touch_move_event_id); 936 touch_move_event_id);
956 EXPECT_TRUE(TouchEventQueueEmpty()); 937 EXPECT_TRUE(TouchEventQueueEmpty());
957 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); 938 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
958 EXPECT_EQ(WebInputEvent::kTouchMove, 939 EXPECT_EQ(WebInputEvent::kTouchMove,
959 ack_handler_->acked_touch_event().event.GetType()); 940 ack_handler_->acked_touch_event().event.GetType());
960 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); 941 EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
961 } 942 }
962 943
963 // Tests that the touch-queue is emptied after a page stops listening for touch 944 // Tests that the touch-queue is emptied after a page stops listening for
964 // events and the outstanding ack is received. 945 // touch events and the outstanding ack is received.
965 TEST_F(LegacyInputRouterImplTest, TouchEventQueueFlush) { 946 TEST_F(LegacyInputRouterImplTest, TouchEventQueueFlush) {
966 OnHasTouchEventHandlers(true); 947 OnHasTouchEventHandlers(true);
967 EXPECT_TRUE(client_->has_touch_handler()); 948 EXPECT_TRUE(client_->has_touch_handler());
968 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); 949 EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
969 EXPECT_TRUE(TouchEventQueueEmpty()); 950 EXPECT_TRUE(TouchEventQueueEmpty());
970 951
971 // Send a touch-press event. 952 // Send a touch-press event.
972 PressTouchPoint(1, 1); 953 PressTouchPoint(1, 1);
973 uint32_t touch_press_event_id = SendTouchEvent(); 954 uint32_t touch_press_event_id = SendTouchEvent();
974 MoveTouchPoint(0, 2, 2); 955 MoveTouchPoint(0, 2, 2);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 break; 1063 break;
1083 expected_events.erase(expected_events.begin(), 1064 expected_events.erase(expected_events.begin(),
1084 expected_events.begin() + acked.size()); 1065 expected_events.begin() + acked.size());
1085 } 1066 }
1086 1067
1087 EXPECT_TRUE(TouchEventQueueEmpty()); 1068 EXPECT_TRUE(TouchEventQueueEmpty());
1088 EXPECT_EQ(0U, expected_events.size()); 1069 EXPECT_EQ(0U, expected_events.size());
1089 } 1070 }
1090 #endif // defined(USE_AURA) 1071 #endif // defined(USE_AURA)
1091 1072
1073 void LegacyInputRouterImplTest::UnhandledWheelEvent() {
dtapuska 2017/06/20 20:53:14 Moving code around like this makes it *really* har
sahel 2017/06/21 18:09:59 I am sorry for the inconvenience, so I should appl
1074 // Simulate wheel events.
1075 SimulateWheelEventPossiblyIncludingPhase(!wheel_scroll_latching_enabled_, 0,
1076 0, 0, -5, 0, false,
1077 WebMouseWheelEvent::kPhaseBegan);
1078 SimulateWheelEventPossiblyIncludingPhase(!wheel_scroll_latching_enabled_, 0,
1079 0, 0, -10, 0, false,
1080 WebMouseWheelEvent::kPhaseChanged);
1081
1082 // Check that only the first event was sent.
1083 EXPECT_TRUE(
1084 process_->sink().GetUniqueMessageMatching(InputMsg_HandleInputEvent::ID));
1085 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1086
1087 // Indicate that the wheel event was unhandled.
1088 SendInputEventACK(WebInputEvent::kMouseWheel,
1089 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
1090
1091 // Check that the ack for the MouseWheel and ScrollBegin
1092 // were processed.
1093 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
1094
1095 // There should be a ScrollBegin and ScrollUpdate, MouseWheel sent.
1096 EXPECT_EQ(3U, GetSentMessageCountAndResetSink());
1097
1098 EXPECT_EQ(ack_handler_->acked_wheel_event().delta_y, -5);
1099 SendInputEventACK(WebInputEvent::kGestureScrollUpdate,
1100 INPUT_EVENT_ACK_STATE_CONSUMED);
1101
1102 if (wheel_scroll_latching_enabled_) {
1103 // Check that the ack for ScrollUpdate were processed.
1104 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
1105 } else {
1106 // The GestureScrollUpdate ACK releases the GestureScrollEnd.
1107 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1108
1109 // Check that the ack for the ScrollUpdate and ScrollEnd
1110 // were processed.
1111 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
1112 }
1113
1114 SendInputEventACK(WebInputEvent::kMouseWheel,
1115 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
1116
1117 if (wheel_scroll_latching_enabled_) {
1118 // There should be a ScrollUpdate sent.
1119 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1120 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
1121 } else {
1122 // There should be a ScrollBegin and ScrollUpdate sent.
1123 EXPECT_EQ(2U, GetSentMessageCountAndResetSink());
1124 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
1125 }
1126
1127 // Check that the correct unhandled wheel event was received.
1128 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED,
1129 ack_handler_->acked_wheel_event_state());
1130 EXPECT_EQ(ack_handler_->acked_wheel_event().delta_y, -10);
1131
1132 SendInputEventACK(WebInputEvent::kGestureScrollUpdate,
1133 INPUT_EVENT_ACK_STATE_CONSUMED);
1134
1135 if (wheel_scroll_latching_enabled_) {
1136 // Check that the ack for ScrollUpdate were processed.
1137 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
1138 } else {
1139 // The GestureScrollUpdate ACK releases the GestureScrollEnd.
1140 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1141
1142 // Check that the ack for the ScrollUpdate and ScrollEnd
1143 // were processed.
1144 EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
1145 }
1146 }
1147
1092 TEST_F(LegacyInputRouterImplTest, UnhandledWheelEvent) { 1148 TEST_F(LegacyInputRouterImplTest, UnhandledWheelEvent) {
1093 UnhandledWheelEvent(true); 1149 UnhandledWheelEvent();
1094 } 1150 }
1095 TEST_F(LegacyInputRouterImplWheelScrollLatchingDisabledTest, 1151 TEST_F(LegacyInputRouterImplWheelScrollLatchingDisabledTest,
1096 UnhandledWheelEvent) { 1152 UnhandledWheelEvent) {
1097 UnhandledWheelEvent(false); 1153 UnhandledWheelEvent();
1154 }
1155 TEST_F(LegacyInputRouterImplAsyncWheelEventEnabledTest, UnhandledWheelEvent) {
1156 // Simulate wheel events.
1157 SimulateWheelEventWithPhase(0, 0, 0, -5, 0, false,
1158 WebMouseWheelEvent::kPhaseBegan);
1159 SimulateWheelEventWithPhase(0, 0, 0, -10, 0, false,
1160 WebMouseWheelEvent::kPhaseChanged);
1161
1162 // Check that only the first event was sent.
1163 EXPECT_TRUE(
1164 process_->sink().GetUniqueMessageMatching(InputMsg_HandleInputEvent::ID));
1165 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1166
1167 // Indicate that the wheel event was unhandled.
1168 SendInputEventACK(WebInputEvent::kMouseWheel,
1169 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
1170
1171 // Check that the ack for the first MouseWheel, ScrollBegin, and the second
1172 // MouseWheel were processed.
1173 EXPECT_EQ(3U, ack_handler_->GetAndResetAckCount());
1174
1175 // There should be a ScrollBegin and ScrollUpdate, MouseWheel sent.
1176 EXPECT_EQ(3U, GetSentMessageCountAndResetSink());
1177
1178 // The last acked wheel event should be the second one since the input router
1179 // has alread sent the immediate ack for the second wheel event.
1180 EXPECT_EQ(ack_handler_->acked_wheel_event().delta_y, -10);
1181 EXPECT_EQ(INPUT_EVENT_ACK_STATE_IGNORED,
1182 ack_handler_->acked_wheel_event_state());
1183
1184 SendInputEventACK(WebInputEvent::kGestureScrollUpdate,
1185 INPUT_EVENT_ACK_STATE_CONSUMED);
1186
1187 // Check that the ack for the first ScrollUpdate were processed.
1188 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
1189
1190 // There should be a second ScrollUpdate sent.
1191 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1192
1193 SendInputEventACK(WebInputEvent::kGestureScrollUpdate,
1194 INPUT_EVENT_ACK_STATE_CONSUMED);
1195
1196 // Check that the ack for ScrollUpdate were processed.
1197 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
1098 } 1198 }
1099 1199
1100 TEST_F(LegacyInputRouterImplTest, TouchTypesIgnoringAck) { 1200 TEST_F(LegacyInputRouterImplTest, TouchTypesIgnoringAck) {
1101 OnHasTouchEventHandlers(true); 1201 OnHasTouchEventHandlers(true);
1102 // Only acks for TouchCancel should always be ignored. 1202 // Only acks for TouchCancel should always be ignored.
1103 ASSERT_TRUE( 1203 ASSERT_TRUE(
1104 ShouldBlockEventStream(GetEventWithType(WebInputEvent::kTouchStart))); 1204 ShouldBlockEventStream(GetEventWithType(WebInputEvent::kTouchStart)));
1105 ASSERT_TRUE( 1205 ASSERT_TRUE(
1106 ShouldBlockEventStream(GetEventWithType(WebInputEvent::kTouchMove))); 1206 ShouldBlockEventStream(GetEventWithType(WebInputEvent::kTouchMove)));
1107 ASSERT_TRUE( 1207 ASSERT_TRUE(
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 // Ack the wheel event. 1985 // Ack the wheel event.
1886 SendInputEventACK(WebInputEvent::kGesturePinchUpdate, 1986 SendInputEventACK(WebInputEvent::kGesturePinchUpdate,
1887 INPUT_EVENT_ACK_STATE_CONSUMED); 1987 INPUT_EVENT_ACK_STATE_CONSUMED);
1888 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); 1988 EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
1889 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); 1989 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
1890 EXPECT_EQ(0, client_->in_flight_event_count()); 1990 EXPECT_EQ(0, client_->in_flight_event_count());
1891 } 1991 }
1892 1992
1893 // Test proper routing of overscroll notifications received either from 1993 // Test proper routing of overscroll notifications received either from
1894 // event acks or from |DidOverscroll| IPC messages. 1994 // event acks or from |DidOverscroll| IPC messages.
1895 TEST_F(LegacyInputRouterImplTest, OverscrollDispatch) { 1995 void LegacyInputRouterImplTest::OverscrollDispatch() {
1896 DidOverscrollParams overscroll; 1996 DidOverscrollParams overscroll;
1897 overscroll.accumulated_overscroll = gfx::Vector2dF(-14, 14); 1997 overscroll.accumulated_overscroll = gfx::Vector2dF(-14, 14);
1898 overscroll.latest_overscroll_delta = gfx::Vector2dF(-7, 0); 1998 overscroll.latest_overscroll_delta = gfx::Vector2dF(-7, 0);
1899 overscroll.current_fling_velocity = gfx::Vector2dF(-1, 0); 1999 overscroll.current_fling_velocity = gfx::Vector2dF(-1, 0);
1900 2000
1901 input_router_->OnMessageReceived(InputHostMsg_DidOverscroll(0, overscroll)); 2001 input_router_->OnMessageReceived(InputHostMsg_DidOverscroll(0, overscroll));
1902 DidOverscrollParams client_overscroll = client_->GetAndResetOverscroll(); 2002 DidOverscrollParams client_overscroll = client_->GetAndResetOverscroll();
1903 EXPECT_EQ(overscroll.accumulated_overscroll, 2003 EXPECT_EQ(overscroll.accumulated_overscroll,
1904 client_overscroll.accumulated_overscroll); 2004 client_overscroll.accumulated_overscroll);
1905 EXPECT_EQ(overscroll.latest_overscroll_delta, 2005 EXPECT_EQ(overscroll.latest_overscroll_delta,
1906 client_overscroll.latest_overscroll_delta); 2006 client_overscroll.latest_overscroll_delta);
1907 EXPECT_EQ(overscroll.current_fling_velocity, 2007 EXPECT_EQ(overscroll.current_fling_velocity,
1908 client_overscroll.current_fling_velocity); 2008 client_overscroll.current_fling_velocity);
1909 2009
1910 DidOverscrollParams wheel_overscroll; 2010 DidOverscrollParams wheel_overscroll;
1911 wheel_overscroll.accumulated_overscroll = gfx::Vector2dF(7, -7); 2011 wheel_overscroll.accumulated_overscroll = gfx::Vector2dF(7, -7);
1912 wheel_overscroll.latest_overscroll_delta = gfx::Vector2dF(3, 0); 2012 wheel_overscroll.latest_overscroll_delta = gfx::Vector2dF(3, 0);
1913 wheel_overscroll.current_fling_velocity = gfx::Vector2dF(1, 0); 2013 wheel_overscroll.current_fling_velocity = gfx::Vector2dF(1, 0);
1914 2014
1915 SimulateWheelEvent(0, 0, 3, 0, 0, false); 2015 SimulateWheelEventPossiblyIncludingPhase(!wheel_scroll_latching_enabled_, 0,
2016 0, 3, 0, 0, false,
2017 WebMouseWheelEvent::kPhaseBegan);
1916 InputEventAck ack(InputEventAckSource::COMPOSITOR_THREAD, 2018 InputEventAck ack(InputEventAckSource::COMPOSITOR_THREAD,
1917 WebInputEvent::kMouseWheel, 2019 WebInputEvent::kMouseWheel,
1918 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 2020 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
1919 ack.overscroll.reset(new DidOverscrollParams(wheel_overscroll)); 2021 ack.overscroll.reset(new DidOverscrollParams(wheel_overscroll));
1920 input_router_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); 2022 input_router_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack));
1921 2023
1922 client_overscroll = client_->GetAndResetOverscroll(); 2024 client_overscroll = client_->GetAndResetOverscroll();
1923 EXPECT_EQ(wheel_overscroll.accumulated_overscroll, 2025 EXPECT_EQ(wheel_overscroll.accumulated_overscroll,
1924 client_overscroll.accumulated_overscroll); 2026 client_overscroll.accumulated_overscroll);
1925 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta, 2027 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta,
1926 client_overscroll.latest_overscroll_delta); 2028 client_overscroll.latest_overscroll_delta);
1927 EXPECT_EQ(wheel_overscroll.current_fling_velocity, 2029 EXPECT_EQ(wheel_overscroll.current_fling_velocity,
1928 client_overscroll.current_fling_velocity); 2030 client_overscroll.current_fling_velocity);
1929 } 2031 }
2032 TEST_F(LegacyInputRouterImplTest, OverscrollDispatch) {
2033 OverscrollDispatch();
2034 }
2035 TEST_F(LegacyInputRouterImplWheelScrollLatchingDisabledTest,
2036 OverscrollDispatch) {
2037 OverscrollDispatch();
2038 }
2039 TEST_F(LegacyInputRouterImplAsyncWheelEventEnabledTest, OverscrollDispatch) {
2040 OverscrollDispatch();
2041 }
1930 2042
1931 // Tests that touch event stream validation passes when events are filtered 2043 // Tests that touch event stream validation passes when events are filtered
1932 // out. See crbug.com/581231 for details. 2044 // out. See crbug.com/581231 for details.
1933 TEST_F(LegacyInputRouterImplTest, 2045 TEST_F(LegacyInputRouterImplTest,
1934 TouchValidationPassesWithFilteredInputEvents) { 2046 TouchValidationPassesWithFilteredInputEvents) {
1935 // Touch sequence with touch handler. 2047 // Touch sequence with touch handler.
1936 OnHasTouchEventHandlers(true); 2048 OnHasTouchEventHandlers(true);
1937 PressTouchPoint(1, 1); 2049 PressTouchPoint(1, 1);
1938 uint32_t touch_press_event_id = SendTouchEvent(); 2050 uint32_t touch_press_event_id = SendTouchEvent();
1939 SendTouchEventACK(WebInputEvent::kTouchStart, 2051 SendTouchEventACK(WebInputEvent::kTouchStart,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 2129
2018 TEST_F(LegacyInputRouterImplScaleMouseEventTest, ScaleMouseEventTest) { 2130 TEST_F(LegacyInputRouterImplScaleMouseEventTest, ScaleMouseEventTest) {
2019 RunMouseEventTest("Enter", WebInputEvent::kMouseEnter); 2131 RunMouseEventTest("Enter", WebInputEvent::kMouseEnter);
2020 RunMouseEventTest("Down", WebInputEvent::kMouseDown); 2132 RunMouseEventTest("Down", WebInputEvent::kMouseDown);
2021 RunMouseEventTest("Move", WebInputEvent::kMouseMove); 2133 RunMouseEventTest("Move", WebInputEvent::kMouseMove);
2022 RunMouseEventTest("Up", WebInputEvent::kMouseUp); 2134 RunMouseEventTest("Up", WebInputEvent::kMouseUp);
2023 } 2135 }
2024 2136
2025 TEST_F(LegacyInputRouterImplScaleEventTest, ScaleMouseWheelEventTest) { 2137 TEST_F(LegacyInputRouterImplScaleEventTest, ScaleMouseWheelEventTest) {
2026 ASSERT_EQ(0u, process_->sink().message_count()); 2138 ASSERT_EQ(0u, process_->sink().message_count());
2027 SimulateWheelEvent(5, 5, 10, 10, 0, false); 2139 SimulateWheelEventWithPhase(5, 5, 10, 10, 0, false,
2140 WebMouseWheelEvent::kPhaseBegan);
2028 ASSERT_EQ(1u, process_->sink().message_count()); 2141 ASSERT_EQ(1u, process_->sink().message_count());
2029 2142
2030 const WebMouseWheelEvent* sent_event = 2143 const WebMouseWheelEvent* sent_event =
2031 GetSentWebInputEvent<WebMouseWheelEvent>(); 2144 GetSentWebInputEvent<WebMouseWheelEvent>();
2032 EXPECT_EQ(10, sent_event->PositionInWidget().x); 2145 EXPECT_EQ(10, sent_event->PositionInWidget().x);
2033 EXPECT_EQ(10, sent_event->PositionInWidget().y); 2146 EXPECT_EQ(10, sent_event->PositionInWidget().y);
2034 EXPECT_EQ(20, sent_event->delta_x); 2147 EXPECT_EQ(20, sent_event->delta_x);
2035 EXPECT_EQ(20, sent_event->delta_y); 2148 EXPECT_EQ(20, sent_event->delta_y);
2036 EXPECT_EQ(2, sent_event->wheel_ticks_x); 2149 EXPECT_EQ(2, sent_event->wheel_ticks_x);
2037 EXPECT_EQ(2, sent_event->wheel_ticks_y); 2150 EXPECT_EQ(2, sent_event->wheel_ticks_y);
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 EXPECT_EQ(80, sent_event->data.fling_start.velocity_y); 2494 EXPECT_EQ(80, sent_event->data.fling_start.velocity_y);
2382 2495
2383 const WebGestureEvent* filter_event = 2496 const WebGestureEvent* filter_event =
2384 GetFilterWebInputEvent<WebGestureEvent>(); 2497 GetFilterWebInputEvent<WebGestureEvent>();
2385 TestLocationInFilterEvent(filter_event, orig); 2498 TestLocationInFilterEvent(filter_event, orig);
2386 EXPECT_EQ(30, filter_event->data.fling_start.velocity_x); 2499 EXPECT_EQ(30, filter_event->data.fling_start.velocity_x);
2387 EXPECT_EQ(40, filter_event->data.fling_start.velocity_y); 2500 EXPECT_EQ(40, filter_event->data.fling_start.velocity_y);
2388 } 2501 }
2389 2502
2390 } // namespace content 2503 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698