| OLD | NEW |
| 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/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/browser/renderer_host/input/timeout_monitor.h" | 9 #include "content/browser/renderer_host/input/timeout_monitor.h" |
| 10 #include "content/browser/renderer_host/input/touch_event_queue.h" | 10 #include "content/browser/renderer_host/input/touch_event_queue.h" |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 EXPECT_EQ(4U, GetAndResetAckedEventCount()); | 539 EXPECT_EQ(4U, GetAndResetAckedEventCount()); |
| 540 EXPECT_EQ(1U, queued_event_count()); | 540 EXPECT_EQ(1U, queued_event_count()); |
| 541 | 541 |
| 542 // ACK the second press event as NO_CONSUMER too. | 542 // ACK the second press event as NO_CONSUMER too. |
| 543 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); | 543 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); |
| 544 EXPECT_EQ(0U, GetAndResetSentEventCount()); | 544 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
| 545 EXPECT_EQ(WebInputEvent::TouchStart, acked_event().type); | 545 EXPECT_EQ(WebInputEvent::TouchStart, acked_event().type); |
| 546 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 546 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 547 EXPECT_EQ(0U, queued_event_count()); | 547 EXPECT_EQ(0U, queued_event_count()); |
| 548 | 548 |
| 549 // Send a second press event. Even though the first touch had NO_CONSUMER, | 549 // Send a second press event. As the first touch press had NO_CONSUMER, this |
| 550 // this press event should reach the renderer. | 550 // press event should not reach the renderer. |
| 551 PressTouchPoint(1, 1); | 551 PressTouchPoint(1, 1); |
| 552 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 552 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
| 553 EXPECT_EQ(1U, queued_event_count()); | 553 EXPECT_EQ(WebInputEvent::TouchStart, acked_event().type); |
| 554 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 555 EXPECT_EQ(0U, queued_event_count()); |
| 554 } | 556 } |
| 555 | 557 |
| 556 TEST_F(TouchEventQueueTest, ConsumerIgnoreMultiFinger) { | 558 TEST_F(TouchEventQueueTest, ConsumerIgnoreMultiFinger) { |
| 557 // Press two touch points and move them around a bit. The renderer consumes | 559 // Press two touch points and move them around a bit. The renderer consumes |
| 558 // the events for the first touch point, but returns NO_CONSUMER_EXISTS for | 560 // the events for the first touch point, but returns NO_CONSUMER_EXISTS for |
| 559 // the second touch point. | 561 // the second touch point. |
| 560 | 562 |
| 561 PressTouchPoint(1, 1); | 563 PressTouchPoint(1, 1); |
| 562 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 564 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
| 563 | 565 |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 SendGestureEventAck(WebInputEvent::GestureScrollUpdate, | 1506 SendGestureEventAck(WebInputEvent::GestureScrollUpdate, |
| 1505 INPUT_EVENT_ACK_STATE_CONSUMED); | 1507 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 1506 MoveTouchPoint(0, 20, 5); | 1508 MoveTouchPoint(0, 20, 5); |
| 1507 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 1509 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 1508 EXPECT_EQ(0U, queued_event_count()); | 1510 EXPECT_EQ(0U, queued_event_count()); |
| 1509 EXPECT_EQ(0U, GetAndResetSentEventCount()); | 1511 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
| 1510 } | 1512 } |
| 1511 } | 1513 } |
| 1512 | 1514 |
| 1513 } // namespace content | 1515 } // namespace content |
| OLD | NEW |