| 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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 sent_wheel_event_(false), | 63 sent_wheel_event_(false), |
| 64 sent_keyboard_event_(false), | 64 sent_keyboard_event_(false), |
| 65 sent_gesture_event_(false), | 65 sent_gesture_event_(false), |
| 66 send_touch_event_not_cancelled_(false), | 66 send_touch_event_not_cancelled_(false), |
| 67 message_received_(false), | 67 message_received_(false), |
| 68 client_(client) { | 68 client_(client) { |
| 69 } | 69 } |
| 70 ~MockInputRouter() override {} | 70 ~MockInputRouter() override {} |
| 71 | 71 |
| 72 // InputRouter | 72 // InputRouter |
| 73 void Flush() override { flush_called_ = true; } | |
| 74 bool SendInput(scoped_ptr<IPC::Message> message) override { | 73 bool SendInput(scoped_ptr<IPC::Message> message) override { |
| 75 send_event_called_ = true; | 74 send_event_called_ = true; |
| 76 return true; | 75 return true; |
| 77 } | 76 } |
| 78 void SendMouseEvent(const MouseEventWithLatencyInfo& mouse_event) override { | 77 void SendMouseEvent(const MouseEventWithLatencyInfo& mouse_event) override { |
| 79 sent_mouse_event_ = true; | 78 sent_mouse_event_ = true; |
| 80 } | 79 } |
| 81 void SendWheelEvent( | 80 void SendWheelEvent( |
| 82 const MouseWheelEventWithLatencyInfo& wheel_event) override { | 81 const MouseWheelEventWithLatencyInfo& wheel_event) override { |
| 83 sent_wheel_event_ = true; | 82 sent_wheel_event_ = true; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 94 void SendTouchEvent(const TouchEventWithLatencyInfo& touch_event) override { | 93 void SendTouchEvent(const TouchEventWithLatencyInfo& touch_event) override { |
| 95 send_touch_event_not_cancelled_ = | 94 send_touch_event_not_cancelled_ = |
| 96 client_->FilterInputEvent(touch_event.event, touch_event.latency) == | 95 client_->FilterInputEvent(touch_event.event, touch_event.latency) == |
| 97 INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 96 INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
| 98 } | 97 } |
| 99 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override { | 98 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override { |
| 100 NOTREACHED(); | 99 NOTREACHED(); |
| 101 return NULL; | 100 return NULL; |
| 102 } | 101 } |
| 103 void OnViewUpdated(int view_flags) override {} | 102 void OnViewUpdated(int view_flags) override {} |
| 103 void RequestNotificationWhenFlushed() override {} |
| 104 bool HasPendingEvents() const override { return false; } | 104 bool HasPendingEvents() const override { return false; } |
| 105 | 105 |
| 106 // IPC::Listener | 106 // IPC::Listener |
| 107 bool OnMessageReceived(const IPC::Message& message) override { | 107 bool OnMessageReceived(const IPC::Message& message) override { |
| 108 message_received_ = true; | 108 message_received_ = true; |
| 109 return false; | 109 return false; |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool flush_called_; | |
| 113 bool send_event_called_; | 112 bool send_event_called_; |
| 114 bool sent_mouse_event_; | 113 bool sent_mouse_event_; |
| 115 bool sent_wheel_event_; | 114 bool sent_wheel_event_; |
| 116 bool sent_keyboard_event_; | 115 bool sent_keyboard_event_; |
| 117 bool sent_gesture_event_; | 116 bool sent_gesture_event_; |
| 118 bool send_touch_event_not_cancelled_; | 117 bool send_touch_event_not_cancelled_; |
| 119 bool message_received_; | 118 bool message_received_; |
| 120 | 119 |
| 121 private: | 120 private: |
| 122 InputRouterClient* client_; | 121 InputRouterClient* client_; |
| (...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 // Having an initial size set means that the size information had been sent | 1493 // Having an initial size set means that the size information had been sent |
| 1495 // with the reqiest to new up the RenderView and so subsequent WasResized | 1494 // with the reqiest to new up the RenderView and so subsequent WasResized |
| 1496 // calls should not result in new IPC (unless the size has actually changed). | 1495 // calls should not result in new IPC (unless the size has actually changed). |
| 1497 host_->WasResized(); | 1496 host_->WasResized(); |
| 1498 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); | 1497 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
| 1499 EXPECT_EQ(initial_size_, host_->old_resize_params_->new_size); | 1498 EXPECT_EQ(initial_size_, host_->old_resize_params_->new_size); |
| 1500 EXPECT_TRUE(host_->resize_ack_pending_); | 1499 EXPECT_TRUE(host_->resize_ack_pending_); |
| 1501 } | 1500 } |
| 1502 | 1501 |
| 1503 } // namespace content | 1502 } // namespace content |
| OLD | NEW |