| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 message_received_(false), | 85 message_received_(false), |
| 86 client_(client) { | 86 client_(client) { |
| 87 } | 87 } |
| 88 ~MockInputRouter() override {} | 88 ~MockInputRouter() override {} |
| 89 | 89 |
| 90 // InputRouter | 90 // InputRouter |
| 91 bool SendInput(scoped_ptr<IPC::Message> message) override { | 91 bool SendInput(scoped_ptr<IPC::Message> message) override { |
| 92 send_event_called_ = true; | 92 send_event_called_ = true; |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 void FlushInput(base::TimeTicks flush_time) override {} |
| 95 void SendMouseEvent(const MouseEventWithLatencyInfo& mouse_event) override { | 96 void SendMouseEvent(const MouseEventWithLatencyInfo& mouse_event) override { |
| 96 sent_mouse_event_ = true; | 97 sent_mouse_event_ = true; |
| 97 } | 98 } |
| 98 void SendWheelEvent( | 99 void SendWheelEvent( |
| 99 const MouseWheelEventWithLatencyInfo& wheel_event) override { | 100 const MouseWheelEventWithLatencyInfo& wheel_event) override { |
| 100 sent_wheel_event_ = true; | 101 sent_wheel_event_ = true; |
| 101 } | 102 } |
| 102 void SendKeyboardEvent( | 103 void SendKeyboardEvent( |
| 103 const NativeWebKeyboardEventWithLatencyInfo& key_event) override { | 104 const NativeWebKeyboardEventWithLatencyInfo& key_event) override { |
| 104 sent_keyboard_event_ = true; | 105 sent_keyboard_event_ = true; |
| 105 } | 106 } |
| 106 void SendGestureEvent( | 107 void SendGestureEvent( |
| 107 const GestureEventWithLatencyInfo& gesture_event) override { | 108 const GestureEventWithLatencyInfo& gesture_event) override { |
| 108 sent_gesture_event_ = true; | 109 sent_gesture_event_ = true; |
| 109 } | 110 } |
| 110 void SendTouchEvent(const TouchEventWithLatencyInfo& touch_event) override { | 111 void SendTouchEvent(const TouchEventWithLatencyInfo& touch_event) override { |
| 111 send_touch_event_not_cancelled_ = | 112 send_touch_event_not_cancelled_ = |
| 112 client_->FilterInputEvent(touch_event.event, touch_event.latency) == | 113 client_->FilterInputEvent(touch_event.event, touch_event.latency) == |
| 113 INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 114 INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
| 114 } | 115 } |
| 115 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override { | 116 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override { |
| 116 NOTREACHED(); | 117 NOTREACHED(); |
| 117 return NULL; | 118 return NULL; |
| 118 } | 119 } |
| 119 void NotifySiteIsMobileOptimized(bool is_mobile_optimized) override {} | 120 void NotifySiteIsMobileOptimized(bool is_mobile_optimized) override {} |
| 120 void RequestNotificationWhenFlushed() override {} | |
| 121 bool HasPendingEvents() const override { return false; } | 121 bool HasPendingEvents() const override { return false; } |
| 122 | 122 |
| 123 // IPC::Listener | 123 // IPC::Listener |
| 124 bool OnMessageReceived(const IPC::Message& message) override { | 124 bool OnMessageReceived(const IPC::Message& message) override { |
| 125 message_received_ = true; | 125 message_received_ = true; |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 | 128 |
| 129 bool send_event_called_; | 129 bool send_event_called_; |
| 130 bool sent_mouse_event_; | 130 bool sent_mouse_event_; |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 // Having an initial size set means that the size information had been sent | 1647 // Having an initial size set means that the size information had been sent |
| 1648 // with the reqiest to new up the RenderView and so subsequent WasResized | 1648 // with the reqiest to new up the RenderView and so subsequent WasResized |
| 1649 // calls should not result in new IPC (unless the size has actually changed). | 1649 // calls should not result in new IPC (unless the size has actually changed). |
| 1650 host_->WasResized(); | 1650 host_->WasResized(); |
| 1651 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); | 1651 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
| 1652 EXPECT_EQ(initial_size_, host_->old_resize_params_->new_size); | 1652 EXPECT_EQ(initial_size_, host_->old_resize_params_->new_size); |
| 1653 EXPECT_TRUE(host_->resize_ack_pending_); | 1653 EXPECT_TRUE(host_->resize_ack_pending_); |
| 1654 } | 1654 } |
| 1655 | 1655 |
| 1656 } // namespace content | 1656 } // namespace content |
| OLD | NEW |