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

Side by Side Diff: content/renderer/mus/compositor_mus_connection_unittest.cc

Issue 2621303004: Keep track of coalesced events in main thread event queue (Closed)
Patch Set: Rebase Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/renderer/mus/compositor_mus_connection.h" 5 #include "content/renderer/mus/compositor_mus_connection.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 public: 174 public:
175 TestRenderWidgetInputHandler(RenderWidget* render_widget); 175 TestRenderWidgetInputHandler(RenderWidget* render_widget);
176 ~TestRenderWidgetInputHandler() override {} 176 ~TestRenderWidgetInputHandler() override {}
177 177
178 void set_delegate(RenderWidgetInputHandlerDelegate* delegate) { 178 void set_delegate(RenderWidgetInputHandlerDelegate* delegate) {
179 delegate_ = delegate; 179 delegate_ = delegate;
180 } 180 }
181 void set_state(InputEventAckState state) { state_ = state; } 181 void set_state(InputEventAckState state) { state_ = state; }
182 182
183 // RenderWidgetInputHandler: 183 // RenderWidgetInputHandler:
184 void HandleInputEvent(const blink::WebInputEvent& input_event, 184 void HandleInputEvent(const blink::WebCoalescedInputEvent& input_event,
185 const ui::LatencyInfo& latency_info, 185 const ui::LatencyInfo& latency_info,
186 InputEventDispatchType dispatch_type) override; 186 InputEventDispatchType dispatch_type) override;
187 187
188 private: 188 private:
189 // The input delegate which receives event acks. 189 // The input delegate which receives event acks.
190 RenderWidgetInputHandlerDelegate* delegate_; 190 RenderWidgetInputHandlerDelegate* delegate_;
191 191
192 // The result of input handling to send to |delegate_| during the ack. 192 // The result of input handling to send to |delegate_| during the ack.
193 InputEventAckState state_; 193 InputEventAckState state_;
194 194
195 DISALLOW_COPY_AND_ASSIGN(TestRenderWidgetInputHandler); 195 DISALLOW_COPY_AND_ASSIGN(TestRenderWidgetInputHandler);
196 }; 196 };
197 197
198 TestRenderWidgetInputHandler::TestRenderWidgetInputHandler( 198 TestRenderWidgetInputHandler::TestRenderWidgetInputHandler(
199 RenderWidget* render_widget) 199 RenderWidget* render_widget)
200 : RenderWidgetInputHandler(render_widget, render_widget), 200 : RenderWidgetInputHandler(render_widget, render_widget),
201 delegate_(nullptr), 201 delegate_(nullptr),
202 state_(InputEventAckState::INPUT_EVENT_ACK_STATE_UNKNOWN) {} 202 state_(InputEventAckState::INPUT_EVENT_ACK_STATE_UNKNOWN) {}
203 203
204 void TestRenderWidgetInputHandler::HandleInputEvent( 204 void TestRenderWidgetInputHandler::HandleInputEvent(
205 const blink::WebInputEvent& input_event, 205 const blink::WebCoalescedInputEvent& input_event,
206 const ui::LatencyInfo& latency_info, 206 const ui::LatencyInfo& latency_info,
207 InputEventDispatchType dispatch_type) { 207 InputEventDispatchType dispatch_type) {
208 if (delegate_) { 208 if (delegate_) {
209 std::unique_ptr<InputEventAck> ack(new InputEventAck( 209 std::unique_ptr<InputEventAck> ack(
210 InputEventAckSource::COMPOSITOR_THREAD, input_event.type(), state_)); 210 new InputEventAck(InputEventAckSource::COMPOSITOR_THREAD,
211 input_event.event().type(), state_));
211 delegate_->OnInputEventAck(std::move(ack)); 212 delegate_->OnInputEventAck(std::move(ack));
212 } 213 }
213 } 214 }
214 215
215 } // namespace 216 } // namespace
216 217
217 // Test suite for CompositorMusConnection, this does not setup a full renderer 218 // Test suite for CompositorMusConnection, this does not setup a full renderer
218 // environment. This does not establish a connection to a mus server, nor does 219 // environment. This does not establish a connection to a mus server, nor does
219 // it initialize one. 220 // it initialize one.
220 class CompositorMusConnectionTest : public testing::Test { 221 class CompositorMusConnectionTest : public testing::Test {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 EXPECT_FALSE(ack_callback.get()); 494 EXPECT_FALSE(ack_callback.get());
494 495
495 VerifyAndRunQueues(true, true); 496 VerifyAndRunQueues(true, true);
496 497
497 // The ack callback should have been called 498 // The ack callback should have been called
498 EXPECT_TRUE(test_callback->called()); 499 EXPECT_TRUE(test_callback->called());
499 EXPECT_EQ(EventResult::HANDLED, test_callback->result()); 500 EXPECT_EQ(EventResult::HANDLED, test_callback->result());
500 } 501 }
501 502
502 } // namespace content 503 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698