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

Side by Side Diff: content/common/input/input_param_traits_unittest.cc

Issue 1544293002: Convert Pass()→std::move() in //content (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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/input/input_param_traits.h" 5 #include "content/common/input/input_param_traits.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility>
8 9
9 #include "content/common/input/input_event.h" 10 #include "content/common/input/input_event.h"
10 #include "content/common/input/synthetic_gesture_params.h" 11 #include "content/common/input/synthetic_gesture_params.h"
11 #include "content/common/input/synthetic_pinch_gesture_params.h" 12 #include "content/common/input/synthetic_pinch_gesture_params.h"
12 #include "content/common/input/synthetic_smooth_drag_gesture_params.h" 13 #include "content/common/input/synthetic_smooth_drag_gesture_params.h"
13 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" 14 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h"
14 #include "content/common/input_messages.h" 15 #include "content/common/input_messages.h"
15 #include "ipc/ipc_message.h" 16 #include "ipc/ipc_message.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 #include "third_party/WebKit/public/web/WebInputEvent.h" 18 #include "third_party/WebKit/public/web/WebInputEvent.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 new SyntheticSmoothScrollGestureParams); 209 new SyntheticSmoothScrollGestureParams);
209 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; 210 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
210 gesture_params->anchor.SetPoint(234, 345); 211 gesture_params->anchor.SetPoint(234, 345);
211 gesture_params->distances.push_back(gfx::Vector2d(123, -789)); 212 gesture_params->distances.push_back(gfx::Vector2d(123, -789));
212 gesture_params->distances.push_back(gfx::Vector2d(-78, 43)); 213 gesture_params->distances.push_back(gfx::Vector2d(-78, 43));
213 gesture_params->prevent_fling = false; 214 gesture_params->prevent_fling = false;
214 gesture_params->speed_in_pixels_s = 456; 215 gesture_params->speed_in_pixels_s = 456;
215 ASSERT_EQ(SyntheticGestureParams::SMOOTH_SCROLL_GESTURE, 216 ASSERT_EQ(SyntheticGestureParams::SMOOTH_SCROLL_GESTURE,
216 gesture_params->GetGestureType()); 217 gesture_params->GetGestureType());
217 SyntheticGesturePacket packet_in; 218 SyntheticGesturePacket packet_in;
218 packet_in.set_gesture_params(gesture_params.Pass()); 219 packet_in.set_gesture_params(std::move(gesture_params));
219 220
220 Verify(packet_in); 221 Verify(packet_in);
221 } 222 }
222 223
223 TEST_F(InputParamTraitsTest, SyntheticPinchGestureParams) { 224 TEST_F(InputParamTraitsTest, SyntheticPinchGestureParams) {
224 scoped_ptr<SyntheticPinchGestureParams> gesture_params( 225 scoped_ptr<SyntheticPinchGestureParams> gesture_params(
225 new SyntheticPinchGestureParams); 226 new SyntheticPinchGestureParams);
226 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; 227 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
227 gesture_params->scale_factor = 2.3f; 228 gesture_params->scale_factor = 2.3f;
228 gesture_params->anchor.SetPoint(234, 345); 229 gesture_params->anchor.SetPoint(234, 345);
229 gesture_params->relative_pointer_speed_in_pixels_s = 456; 230 gesture_params->relative_pointer_speed_in_pixels_s = 456;
230 ASSERT_EQ(SyntheticGestureParams::PINCH_GESTURE, 231 ASSERT_EQ(SyntheticGestureParams::PINCH_GESTURE,
231 gesture_params->GetGestureType()); 232 gesture_params->GetGestureType());
232 SyntheticGesturePacket packet_in; 233 SyntheticGesturePacket packet_in;
233 packet_in.set_gesture_params(gesture_params.Pass()); 234 packet_in.set_gesture_params(std::move(gesture_params));
234 235
235 Verify(packet_in); 236 Verify(packet_in);
236 } 237 }
237 238
238 TEST_F(InputParamTraitsTest, SyntheticTapGestureParams) { 239 TEST_F(InputParamTraitsTest, SyntheticTapGestureParams) {
239 scoped_ptr<SyntheticTapGestureParams> gesture_params( 240 scoped_ptr<SyntheticTapGestureParams> gesture_params(
240 new SyntheticTapGestureParams); 241 new SyntheticTapGestureParams);
241 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; 242 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
242 gesture_params->position.SetPoint(798, 233); 243 gesture_params->position.SetPoint(798, 233);
243 gesture_params->duration_ms = 13; 244 gesture_params->duration_ms = 13;
244 ASSERT_EQ(SyntheticGestureParams::TAP_GESTURE, 245 ASSERT_EQ(SyntheticGestureParams::TAP_GESTURE,
245 gesture_params->GetGestureType()); 246 gesture_params->GetGestureType());
246 SyntheticGesturePacket packet_in; 247 SyntheticGesturePacket packet_in;
247 packet_in.set_gesture_params(gesture_params.Pass()); 248 packet_in.set_gesture_params(std::move(gesture_params));
248 249
249 Verify(packet_in); 250 Verify(packet_in);
250 } 251 }
251 252
252 } // namespace 253 } // namespace
253 } // namespace content 254 } // namespace content
OLDNEW
« no previous file with comments | « content/common/input/input_param_traits.cc ('k') | content/common/input/synthetic_gesture_packet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698