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

Side by Side Diff: content/browser/renderer_host/input/gesture_event_queue_unittest.cc

Issue 1545243002: Convert Pass()→std::move() in //content/browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/renderer_host/input/gesture_event_queue.h"
6
5 #include <stddef.h> 7 #include <stddef.h>
6 8 #include <utility>
7 #include <vector> 9 #include <vector>
8 10
9 #include "base/location.h" 11 #include "base/location.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
13 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
14 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
15 #include "base/time/time.h" 17 #include "base/time/time.h"
16 #include "content/browser/renderer_host/input/gesture_event_queue.h"
17 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h" 18 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h"
18 #include "content/common/input/input_event_ack_state.h" 19 #include "content/common/input/input_event_ack_state.h"
19 #include "content/common/input/synthetic_web_input_event_builders.h" 20 #include "content/common/input/synthetic_web_input_event_builders.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 #include "third_party/WebKit/public/web/WebInputEvent.h" 22 #include "third_party/WebKit/public/web/WebInputEvent.h"
22 23
23 using base::TimeDelta; 24 using base::TimeDelta;
24 using blink::WebGestureDevice; 25 using blink::WebGestureDevice;
25 using blink::WebGestureEvent; 26 using blink::WebGestureEvent;
26 using blink::WebInputEvent; 27 using blink::WebInputEvent;
(...skipping 19 matching lines...) Expand all
46 // Process all pending tasks to avoid leaks. 47 // Process all pending tasks to avoid leaks.
47 RunUntilIdle(); 48 RunUntilIdle();
48 queue_.reset(); 49 queue_.reset();
49 } 50 }
50 51
51 // GestureEventQueueClient 52 // GestureEventQueueClient
52 void SendGestureEventImmediately( 53 void SendGestureEventImmediately(
53 const GestureEventWithLatencyInfo& event) override { 54 const GestureEventWithLatencyInfo& event) override {
54 ++sent_gesture_event_count_; 55 ++sent_gesture_event_count_;
55 if (sync_ack_result_) { 56 if (sync_ack_result_) {
56 scoped_ptr<InputEventAckState> ack_result = sync_ack_result_.Pass(); 57 scoped_ptr<InputEventAckState> ack_result = std::move(sync_ack_result_);
57 SendInputEventACK(event.event.type, *ack_result); 58 SendInputEventACK(event.event.type, *ack_result);
58 } 59 }
59 } 60 }
60 61
61 void OnGestureEventAck(const GestureEventWithLatencyInfo& event, 62 void OnGestureEventAck(const GestureEventWithLatencyInfo& event,
62 InputEventAckState ack_result) override { 63 InputEventAckState ack_result) override {
63 ++acked_gesture_event_count_; 64 ++acked_gesture_event_count_;
64 last_acked_event_ = event.event; 65 last_acked_event_ = event.event;
65 if (sync_followup_event_) { 66 if (sync_followup_event_) {
66 auto sync_followup_event = sync_followup_event_.Pass(); 67 auto sync_followup_event = std::move(sync_followup_event_);
67 SimulateGestureEvent(*sync_followup_event); 68 SimulateGestureEvent(*sync_followup_event);
68 } 69 }
69 } 70 }
70 71
71 // TouchpadTapSuppressionControllerClient 72 // TouchpadTapSuppressionControllerClient
72 void SendMouseEventImmediately( 73 void SendMouseEventImmediately(
73 const MouseEventWithLatencyInfo& event) override {} 74 const MouseEventWithLatencyInfo& event) override {}
74 75
75 protected: 76 protected:
76 static GestureEventQueue::Config DefaultConfig() { 77 static GestureEventQueue::Config DefaultConfig() {
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 WebInputEvent::GestureScrollUpdate}; 1148 WebInputEvent::GestureScrollUpdate};
1148 1149
1149 for (unsigned i = 0; i < sizeof(expected) / sizeof(WebInputEvent::Type); 1150 for (unsigned i = 0; i < sizeof(expected) / sizeof(WebInputEvent::Type);
1150 i++) { 1151 i++) {
1151 WebGestureEvent merged_event = GestureEventQueueEventAt(i); 1152 WebGestureEvent merged_event = GestureEventQueueEventAt(i);
1152 EXPECT_EQ(expected[i], merged_event.type); 1153 EXPECT_EQ(expected[i], merged_event.type);
1153 } 1154 }
1154 } 1155 }
1155 1156
1156 } // namespace content 1157 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698