| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 MoveTouchPoint(0, 5, 5); | 381 MoveTouchPoint(0, 5, 5); |
| 382 EXPECT_EQ(2U, queued_event_count()); | 382 EXPECT_EQ(2U, queued_event_count()); |
| 383 EXPECT_EQ(0U, GetAndResetAckedEventCount()); | 383 EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
| 384 EXPECT_EQ(0U, GetAndResetSentEventCount()); | 384 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
| 385 | 385 |
| 386 // Unregister all touch handlers. | 386 // Unregister all touch handlers. |
| 387 OnHasTouchEventHandlers(false); | 387 OnHasTouchEventHandlers(false); |
| 388 EXPECT_EQ(0U, GetAndResetAckedEventCount()); | 388 EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
| 389 EXPECT_EQ(2U, queued_event_count()); | 389 EXPECT_EQ(2U, queued_event_count()); |
| 390 | 390 |
| 391 // Repeated registration/unregstration of handlers should have no effect as |
| 392 // we're still awaiting the ack arrival. |
| 393 OnHasTouchEventHandlers(true); |
| 394 EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
| 395 EXPECT_EQ(2U, queued_event_count()); |
| 396 OnHasTouchEventHandlers(false); |
| 397 EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
| 398 EXPECT_EQ(2U, queued_event_count()); |
| 399 |
| 391 // The ack should be flush the queue. | 400 // The ack should be flush the queue. |
| 392 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); | 401 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); |
| 393 EXPECT_EQ(2U, GetAndResetAckedEventCount()); | 402 EXPECT_EQ(2U, GetAndResetAckedEventCount()); |
| 394 EXPECT_EQ(0U, queued_event_count()); | 403 EXPECT_EQ(0U, queued_event_count()); |
| 395 | 404 |
| 396 // Events should be dropped while there is no touch handler. | 405 // Events should be dropped while there is no touch handler. |
| 397 MoveTouchPoint(0, 10, 10); | 406 MoveTouchPoint(0, 10, 10); |
| 398 EXPECT_EQ(0U, queued_event_count()); | 407 EXPECT_EQ(0U, queued_event_count()); |
| 399 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 408 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 400 EXPECT_EQ(0U, GetAndResetSentEventCount()); | 409 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
| (...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2116 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 2125 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
| 2117 | 2126 |
| 2118 // Touch move event is throttled. | 2127 // Touch move event is throttled. |
| 2119 MoveTouchPoint(0, 60, 5); | 2128 MoveTouchPoint(0, 60, 5); |
| 2120 SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED); | 2129 SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED); |
| 2121 EXPECT_EQ(0U, queued_event_count()); | 2130 EXPECT_EQ(0U, queued_event_count()); |
| 2122 EXPECT_EQ(0U, GetAndResetSentEventCount()); | 2131 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
| 2123 } | 2132 } |
| 2124 | 2133 |
| 2125 } // namespace content | 2134 } // namespace content |
| OLD | NEW |