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/bind.h" | 6 #include "base/bind.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE {} | 164 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE {} |
165 virtual const NativeWebKeyboardEvent* GetLastKeyboardEvent() const OVERRIDE { | 165 virtual const NativeWebKeyboardEvent* GetLastKeyboardEvent() const OVERRIDE { |
166 NOTREACHED(); | 166 NOTREACHED(); |
167 return NULL; | 167 return NULL; |
168 } | 168 } |
169 virtual bool ShouldForwardTouchEvent() const OVERRIDE { return true; } | 169 virtual bool ShouldForwardTouchEvent() const OVERRIDE { return true; } |
170 virtual bool ShouldForwardGestureEvent( | 170 virtual bool ShouldForwardGestureEvent( |
171 const GestureEventWithLatencyInfo& gesture_event) const OVERRIDE { | 171 const GestureEventWithLatencyInfo& gesture_event) const OVERRIDE { |
172 return true; | 172 return true; |
173 } | 173 } |
174 virtual bool HasQueuedGestureEvents() const OVERRIDE { return true; } | |
175 | 174 |
176 // IPC::Listener | 175 // IPC::Listener |
177 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 176 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
178 message_received_ = true; | 177 message_received_ = true; |
179 return false; | 178 return false; |
180 } | 179 } |
181 | 180 |
182 bool flush_called_; | 181 bool flush_called_; |
183 bool send_event_called_; | 182 bool send_event_called_; |
184 bool sent_mouse_event_; | 183 bool sent_mouse_event_; |
(...skipping 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2282 SendInputEventACK(WebInputEvent::GestureScrollBegin, | 2281 SendInputEventACK(WebInputEvent::GestureScrollBegin, |
2283 INPUT_EVENT_ACK_STATE_CONSUMED); | 2282 INPUT_EVENT_ACK_STATE_CONSUMED); |
2284 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 2283 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
2285 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2284 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
2286 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 2285 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
2287 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 2286 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
2288 process_->sink().ClearMessages(); | 2287 process_->sink().ClearMessages(); |
2289 | 2288 |
2290 // Overscroll gesture is in progress. Send a mouse-move now. This should | 2289 // Overscroll gesture is in progress. Send a mouse-move now. This should |
2291 // complete the gesture (because the amount overscrolled is above the | 2290 // complete the gesture (because the amount overscrolled is above the |
2292 // threshold), and consume the event. | 2291 // threshold). |
2293 SimulateMouseMove(5, 10, 0); | 2292 SimulateMouseMove(5, 10, 0); |
2294 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); | 2293 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); |
2295 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 2294 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
2296 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 2295 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
2297 EXPECT_EQ(0U, process_->sink().message_count()); | 2296 EXPECT_EQ(1U, process_->sink().message_count()); |
2297 process_->sink().ClearMessages(); | |
2298 SendInputEventACK(WebInputEvent::MouseMove, | |
2299 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
2298 | 2300 |
jdduke (slow)
2013/09/12 16:32:35
Are there any additional states or event sequences
sadrul
2013/09/12 17:31:20
I added some expectations in a few more tests.
| |
2299 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 2301 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
2300 WebGestureEvent::Touchscreen); | 2302 WebGestureEvent::Touchscreen); |
2301 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 2303 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
2302 EXPECT_EQ(1U, process_->sink().message_count()); | 2304 EXPECT_EQ(1U, process_->sink().message_count()); |
2303 process_->sink().ClearMessages(); | 2305 process_->sink().ClearMessages(); |
2304 SendInputEventACK(WebInputEvent::GestureScrollEnd, | 2306 SendInputEventACK(WebInputEvent::GestureScrollEnd, |
2305 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2307 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
2306 | 2308 |
2307 // Move mouse some more. The mouse-move events should reach the renderer. | 2309 // Move mouse some more. The mouse-move events should reach the renderer. |
2308 SimulateMouseMove(5, 10, 0); | 2310 SimulateMouseMove(5, 10, 0); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2570 | 2572 |
2571 TEST_F(RenderWidgetHostTest, InputRouterReceivesHasTouchEventHandlers) { | 2573 TEST_F(RenderWidgetHostTest, InputRouterReceivesHasTouchEventHandlers) { |
2572 host_->SetupForInputRouterTest(); | 2574 host_->SetupForInputRouterTest(); |
2573 | 2575 |
2574 host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); | 2576 host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); |
2575 | 2577 |
2576 EXPECT_TRUE(host_->mock_input_router()->message_received_); | 2578 EXPECT_TRUE(host_->mock_input_router()->message_received_); |
2577 } | 2579 } |
2578 | 2580 |
2579 } // namespace content | 2581 } // namespace content |
OLD | NEW |