| 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/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" |
| 11 #include "content/browser/renderer_host/input/input_router_unittest.h" | 11 #include "content/browser/renderer_host/input/input_router_unittest.h" |
| 12 #include "content/browser/renderer_host/input/mock_input_router_client.h" | 12 #include "content/browser/renderer_host/input/mock_input_router_client.h" |
| 13 #include "content/common/content_constants_internal.h" | 13 #include "content/common/content_constants_internal.h" |
| 14 #include "content/common/edit_command.h" | 14 #include "content/common/edit_command.h" |
| 15 #include "content/common/input_messages.h" | 15 #include "content/common/input_messages.h" |
| 16 #include "content/common/view_messages.h" | 16 #include "content/common/view_messages.h" |
| 17 #include "content/public/test/mock_render_process_host.h" | 17 #include "content/public/test/mock_render_process_host.h" |
| 18 #include "content/public/test/test_browser_context.h" | 18 #include "content/public/test/test_browser_context.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "ui/events/keycodes/keyboard_codes.h" | 20 #include "ui/events/keycodes/keyboard_codes.h" |
| 21 | 21 |
| 22 #if defined(OS_WIN) || defined(USE_AURA) | 22 #if defined(OS_WIN) || defined(USE_AURA) |
| 23 #include "content/browser/renderer_host/ui_events_helper.h" | 23 #include "content/browser/renderer_host/ui_events_helper.h" |
| 24 #include "ui/events/event.h" | 24 #include "ui/events/event.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 using base::TimeDelta; | 27 using base::TimeDelta; |
| 28 using WebKit::WebGestureEvent; | 28 using blink::WebGestureEvent; |
| 29 using WebKit::WebInputEvent; | 29 using blink::WebInputEvent; |
| 30 using WebKit::WebMouseEvent; | 30 using blink::WebMouseEvent; |
| 31 using WebKit::WebMouseWheelEvent; | 31 using blink::WebMouseWheelEvent; |
| 32 using WebKit::WebTouchEvent; | 32 using blink::WebTouchEvent; |
| 33 using WebKit::WebTouchPoint; | 33 using blink::WebTouchPoint; |
| 34 | 34 |
| 35 namespace content { | 35 namespace content { |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 const WebInputEvent* GetInputEventFromMessage(const IPC::Message& message) { | 39 const WebInputEvent* GetInputEventFromMessage(const IPC::Message& message) { |
| 40 PickleIterator iter(message); | 40 PickleIterator iter(message); |
| 41 const char* data; | 41 const char* data; |
| 42 int data_length; | 42 int data_length; |
| 43 if (!message.ReadData(&iter, &data, &data_length)) | 43 if (!message.ReadData(&iter, &data, &data_length)) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 protected: | 110 protected: |
| 111 // InputRouterTest | 111 // InputRouterTest |
| 112 virtual scoped_ptr<InputRouter> CreateInputRouter(RenderProcessHost* process, | 112 virtual scoped_ptr<InputRouter> CreateInputRouter(RenderProcessHost* process, |
| 113 InputRouterClient* client, | 113 InputRouterClient* client, |
| 114 InputAckHandler* handler, | 114 InputAckHandler* handler, |
| 115 int routing_id) OVERRIDE { | 115 int routing_id) OVERRIDE { |
| 116 return scoped_ptr<InputRouter>( | 116 return scoped_ptr<InputRouter>( |
| 117 new ImmediateInputRouter(process, client, handler, routing_id)); | 117 new ImmediateInputRouter(process, client, handler, routing_id)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void SendInputEventACK(WebKit::WebInputEvent::Type type, | 120 void SendInputEventACK(blink::WebInputEvent::Type type, |
| 121 InputEventAckState ack_result) { | 121 InputEventAckState ack_result) { |
| 122 scoped_ptr<IPC::Message> response( | 122 scoped_ptr<IPC::Message> response( |
| 123 new InputHostMsg_HandleInputEvent_ACK(0, type, ack_result, | 123 new InputHostMsg_HandleInputEvent_ACK(0, type, ack_result, |
| 124 ui::LatencyInfo())); | 124 ui::LatencyInfo())); |
| 125 input_router_->OnMessageReceived(*response); | 125 input_router_->OnMessageReceived(*response); |
| 126 } | 126 } |
| 127 | 127 |
| 128 ImmediateInputRouter* input_router() const { | 128 ImmediateInputRouter* input_router() const { |
| 129 return static_cast<ImmediateInputRouter*>(input_router_.get()); | 129 return static_cast<ImmediateInputRouter*>(input_router_.get()); |
| 130 } | 130 } |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } // namespace content | 561 } // namespace content |
| OLD | NEW |