OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "base/timer.h" | 8 #include "base/timer.h" |
9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
10 #include "content/browser/renderer_host/backing_store.h" | 10 #include "content/browser/renderer_host/backing_store.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 unsigned GestureEventDebouncingQueueSize() { | 136 unsigned GestureEventDebouncingQueueSize() { |
137 return gesture_event_filter_->debouncing_deferral_queue_.size(); | 137 return gesture_event_filter_->debouncing_deferral_queue_.size(); |
138 } | 138 } |
139 | 139 |
140 WebGestureEvent GestureEventQueueEventAt(int i) { | 140 WebGestureEvent GestureEventQueueEventAt(int i) { |
141 return gesture_event_filter_->coalesced_gesture_events_.at(i); | 141 return gesture_event_filter_->coalesced_gesture_events_.at(i); |
142 } | 142 } |
143 | 143 |
| 144 bool shouldDeferTapDownEvents() { |
| 145 return gesture_event_filter_->maximum_tap_gap_time_ms_ != 0; |
| 146 } |
| 147 |
144 bool ScrollingInProgress() { | 148 bool ScrollingInProgress() { |
145 return gesture_event_filter_->scrolling_in_progress_; | 149 return gesture_event_filter_->scrolling_in_progress_; |
146 } | 150 } |
147 | 151 |
148 bool FlingInProgress() { | 152 bool FlingInProgress() { |
149 return gesture_event_filter_->fling_in_progress_; | 153 return gesture_event_filter_->fling_in_progress_; |
150 } | 154 } |
151 | 155 |
152 void SetupForOverscrollControllerTest() { | 156 void SetupForOverscrollControllerTest() { |
153 InitializeOverscrollController(); | 157 InitializeOverscrollController(); |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 EXPECT_EQ(1U, process_->sink().message_count()); | 1440 EXPECT_EQ(1U, process_->sink().message_count()); |
1437 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); | 1441 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); |
1438 EXPECT_EQ(3U, host_->GestureEventDebouncingQueueSize()); | 1442 EXPECT_EQ(3U, host_->GestureEventDebouncingQueueSize()); |
1439 | 1443 |
1440 MessageLoop::current()->PostDelayedTask( | 1444 MessageLoop::current()->PostDelayedTask( |
1441 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(5)); | 1445 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(5)); |
1442 MessageLoop::current()->Run(); | 1446 MessageLoop::current()->Run(); |
1443 | 1447 |
1444 // The deferred events are correctly queued in coalescing queue. | 1448 // The deferred events are correctly queued in coalescing queue. |
1445 EXPECT_EQ(1U, process_->sink().message_count()); | 1449 EXPECT_EQ(1U, process_->sink().message_count()); |
1446 // NOTE: The TapDown is still deferred hence not queued. | 1450 if (host_->shouldDeferTapDownEvents()) |
1447 EXPECT_EQ(4U, host_->GestureEventLastQueueEventSize()); | 1451 // NOTE: The TapDown is still deferred hence not queued. |
| 1452 EXPECT_EQ(4U, host_->GestureEventLastQueueEventSize()); |
| 1453 else |
| 1454 EXPECT_EQ(5U, host_->GestureEventLastQueueEventSize()); |
1448 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 1455 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
1449 EXPECT_FALSE(host_->ScrollingInProgress()); | 1456 EXPECT_FALSE(host_->ScrollingInProgress()); |
1450 | 1457 |
1451 // Verify that the coalescing queue contains the correct events. | 1458 // Verify that the coalescing queue contains the correct events. |
1452 WebInputEvent::Type expected[] = { | 1459 WebInputEvent::Type expected[] = { |
1453 WebInputEvent::GestureScrollUpdate, | 1460 WebInputEvent::GestureScrollUpdate, |
1454 WebInputEvent::GestureScrollUpdate, | 1461 WebInputEvent::GestureScrollUpdate, |
1455 WebInputEvent::GestureScrollEnd, | 1462 WebInputEvent::GestureScrollEnd, |
1456 WebInputEvent::GestureFlingStart}; | 1463 WebInputEvent::GestureFlingStart}; |
1457 | 1464 |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2428 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 2435 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
2429 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 2436 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
2430 | 2437 |
2431 SendInputEventACK(WebKit::WebInputEvent::GestureScrollEnd, false); | 2438 SendInputEventACK(WebKit::WebInputEvent::GestureScrollEnd, false); |
2432 EXPECT_EQ(0U, process_->sink().message_count()); | 2439 EXPECT_EQ(0U, process_->sink().message_count()); |
2433 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 2440 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
2434 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 2441 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
2435 } | 2442 } |
2436 | 2443 |
2437 } // namespace content | 2444 } // namespace content |
OLD | NEW |