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

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

Issue 44983003: Events ignoring ack disposition receive synthetic acks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/renderer_host/input/gesture_event_filter.h" 8 #include "content/browser/renderer_host/input/gesture_event_filter.h"
9 #include "content/browser/renderer_host/input/immediate_input_router.h" 9 #include "content/browser/renderer_host/input/immediate_input_router.h"
10 #include "content/browser/renderer_host/input/input_router_client.h" 10 #include "content/browser/renderer_host/input/input_router_client.h"
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 551
552 // Check that the second event was sent. 552 // Check that the second event was sent.
553 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( 553 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(
554 InputMsg_HandleInputEvent::ID)); 554 InputMsg_HandleInputEvent::ID));
555 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); 555 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
556 556
557 // Check that the correct unhandled wheel event was received. 557 // Check that the correct unhandled wheel event was received.
558 EXPECT_EQ(ack_handler_->acked_wheel_event().deltaY, -5); 558 EXPECT_EQ(ack_handler_->acked_wheel_event().deltaY, -5);
559 } 559 }
560 560
561 // Test that events ignoring ack disposition don't wait for ACKs.
562 TEST_F(ImmediateInputRouterTest, EventsIgnoringAckDispositionDontWaitForAcks) {
563 SimulateGestureEvent(WebInputEvent::GestureShowPress,
564 WebGestureEvent::Touchscreen);
565
566 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
jdduke (slow) 2013/10/25 20:37:12 Please also check that 1) We get the ack immediate
tdresser 2013/11/04 15:57:30 Done.
567
568 SimulateGestureEvent(WebInputEvent::GestureShowPress,
569 WebGestureEvent::Touchscreen);
570
571 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
572
573 SimulateGestureEvent(WebInputEvent::GestureShowPress,
574 WebGestureEvent::Touchscreen);
575
576 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
577 }
578
579 // Test that events don't get out of order due to ignoring their acks.
580 TEST_F(ImmediateInputRouterTest, EventsIgnoringAckDispositionStayInOrder) {
581 SimulateGestureEvent(WebInputEvent::GestureFlingStart,
582 WebGestureEvent::Touchscreen);
583
584 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
585
586 SimulateGestureEvent(WebInputEvent::GestureShowPress,
587 WebGestureEvent::Touchscreen);
588
589 EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
590
591 SimulateGestureEvent(WebInputEvent::GestureShowPress,
592 WebGestureEvent::Touchscreen);
593
594 EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
595
596 SendInputEventACK(WebInputEvent::GestureFlingStart,
597 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
598
599 EXPECT_EQ(2U, GetSentMessageCountAndResetSink());
jdduke (slow) 2013/10/25 20:37:12 Same as above, check that we get the immediate ack
tdresser 2013/11/04 15:57:30 Done.
600 }
601
561 } // namespace content 602 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698