Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 628763003: Support InputRouter recycling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 virtual ~MockInputRouter() {} 70 virtual ~MockInputRouter() {}
71 71
72 // InputRouter 72 // InputRouter
73 virtual void Flush() override {
74 flush_called_ = true;
75 }
76 virtual bool SendInput(scoped_ptr<IPC::Message> message) override { 73 virtual bool SendInput(scoped_ptr<IPC::Message> message) override {
77 send_event_called_ = true; 74 send_event_called_ = true;
78 return true; 75 return true;
79 } 76 }
80 virtual void SendMouseEvent( 77 virtual void SendMouseEvent(
81 const MouseEventWithLatencyInfo& mouse_event) override { 78 const MouseEventWithLatencyInfo& mouse_event) override {
82 sent_mouse_event_ = true; 79 sent_mouse_event_ = true;
83 } 80 }
84 virtual void SendWheelEvent( 81 virtual void SendWheelEvent(
85 const MouseWheelEventWithLatencyInfo& wheel_event) override { 82 const MouseWheelEventWithLatencyInfo& wheel_event) override {
86 sent_wheel_event_ = true; 83 sent_wheel_event_ = true;
87 } 84 }
88 virtual void SendKeyboardEvent( 85 virtual void SendKeyboardEvent(
89 const NativeWebKeyboardEvent& key_event, 86 const NativeWebKeyboardEvent& key_event,
90 const ui::LatencyInfo& latency_info, 87 const ui::LatencyInfo& latency_info,
91 bool is_shortcut) override { 88 bool is_shortcut) override {
92 sent_keyboard_event_ = true; 89 sent_keyboard_event_ = true;
93 } 90 }
94 virtual void SendGestureEvent( 91 virtual void SendGestureEvent(
95 const GestureEventWithLatencyInfo& gesture_event) override { 92 const GestureEventWithLatencyInfo& gesture_event) override {
96 sent_gesture_event_ = true; 93 sent_gesture_event_ = true;
97 } 94 }
98 virtual void SendTouchEvent( 95 virtual void SendTouchEvent(
99 const TouchEventWithLatencyInfo& touch_event) override { 96 const TouchEventWithLatencyInfo& touch_event) override {
100 send_touch_event_not_cancelled_ = 97 send_touch_event_not_cancelled_ =
101 client_->FilterInputEvent(touch_event.event, touch_event.latency) == 98 client_->FilterInputEvent(touch_event.event, touch_event.latency) ==
102 INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 99 INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
103 } 100 }
101 virtual void Recycle() override {}
102 virtual void RequestFlushedNotification() override {}
104 virtual const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override { 103 virtual const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override {
105 NOTREACHED(); 104 NOTREACHED();
106 return NULL; 105 return NULL;
107 } 106 }
108 virtual bool ShouldForwardTouchEvent() const override { return true; } 107 virtual bool ShouldForwardTouchEvent() const override { return true; }
109 virtual void OnViewUpdated(int view_flags) override {} 108 virtual void OnViewUpdated(int view_flags) override {}
110 virtual bool HasPendingEvents() const override { return false; } 109 virtual bool HasPendingEvents() const override { return false; }
111 110
112 // IPC::Listener 111 // IPC::Listener
113 virtual bool OnMessageReceived(const IPC::Message& message) override { 112 virtual bool OnMessageReceived(const IPC::Message& message) override {
114 message_received_ = true; 113 message_received_ = true;
115 return false; 114 return false;
116 } 115 }
117 116
118 bool flush_called_;
119 bool send_event_called_; 117 bool send_event_called_;
120 bool sent_mouse_event_; 118 bool sent_mouse_event_;
121 bool sent_wheel_event_; 119 bool sent_wheel_event_;
122 bool sent_keyboard_event_; 120 bool sent_keyboard_event_;
123 bool sent_gesture_event_; 121 bool sent_gesture_event_;
124 bool send_touch_event_not_cancelled_; 122 bool send_touch_event_not_cancelled_;
125 bool message_received_; 123 bool message_received_;
126 124
127 private: 125 private:
128 InputRouterClient* client_; 126 InputRouterClient* client_;
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 1498
1501 ASSERT_TRUE(host_->is_hidden()); 1499 ASSERT_TRUE(host_->is_hidden());
1502 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); 1500 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
1503 ASSERT_FALSE(host_->is_hidden()); 1501 ASSERT_FALSE(host_->is_hidden());
1504 1502
1505 // Make sure the input router is in a fresh state. 1503 // Make sure the input router is in a fresh state.
1506 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); 1504 ASSERT_FALSE(host_->input_router()->HasPendingEvents());
1507 } 1505 }
1508 1506
1509 } // namespace content 1507 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698