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; |
84 } | 83 } |
85 void SendKeyboardEvent(const NativeWebKeyboardEvent& key_event, | 84 void SendKeyboardEvent(const NativeWebKeyboardEvent& key_event, |
86 const ui::LatencyInfo& latency_info, | 85 const ui::LatencyInfo& latency_info, |
87 bool is_shortcut) override { | 86 bool is_shortcut) override { |
88 sent_keyboard_event_ = true; | 87 sent_keyboard_event_ = true; |
89 } | 88 } |
90 void SendGestureEvent( | 89 void SendGestureEvent( |
91 const GestureEventWithLatencyInfo& gesture_event) override { | 90 const GestureEventWithLatencyInfo& gesture_event) override { |
92 sent_gesture_event_ = true; | 91 sent_gesture_event_ = true; |
93 } | 92 } |
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 } |
| 98 virtual void RequestFlushedNotification() override {} |
99 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override { | 99 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override { |
100 NOTREACHED(); | 100 NOTREACHED(); |
101 return NULL; | 101 return NULL; |
102 } | 102 } |
103 bool ShouldForwardTouchEvent() const override { return true; } | 103 bool ShouldForwardTouchEvent() const override { return true; } |
104 void OnViewUpdated(int view_flags) override {} | 104 void OnViewUpdated(int view_flags) override {} |
105 bool HasPendingEvents() const override { return false; } | 105 bool HasPendingEvents() const override { return false; } |
106 | 106 |
107 // IPC::Listener | 107 // IPC::Listener |
108 bool OnMessageReceived(const IPC::Message& message) override { | 108 bool OnMessageReceived(const IPC::Message& message) override { |
109 message_received_ = true; | 109 message_received_ = true; |
110 return false; | 110 return false; |
111 } | 111 } |
112 | 112 |
113 bool flush_called_; | |
114 bool send_event_called_; | 113 bool send_event_called_; |
115 bool sent_mouse_event_; | 114 bool sent_mouse_event_; |
116 bool sent_wheel_event_; | 115 bool sent_wheel_event_; |
117 bool sent_keyboard_event_; | 116 bool sent_keyboard_event_; |
118 bool sent_gesture_event_; | 117 bool sent_gesture_event_; |
119 bool send_touch_event_not_cancelled_; | 118 bool send_touch_event_not_cancelled_; |
120 bool message_received_; | 119 bool message_received_; |
121 | 120 |
122 private: | 121 private: |
123 InputRouterClient* client_; | 122 InputRouterClient* client_; |
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 | 1487 |
1489 ASSERT_TRUE(host_->is_hidden()); | 1488 ASSERT_TRUE(host_->is_hidden()); |
1490 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); | 1489 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); |
1491 ASSERT_FALSE(host_->is_hidden()); | 1490 ASSERT_FALSE(host_->is_hidden()); |
1492 | 1491 |
1493 // Make sure the input router is in a fresh state. | 1492 // Make sure the input router is in a fresh state. |
1494 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); | 1493 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); |
1495 } | 1494 } |
1496 | 1495 |
1497 } // namespace content | 1496 } // namespace content |
OLD | NEW |