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

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

Issue 2742473002: gpu benchmarking swipe for touchpad
Patch Set: Update direction in tests that use swipeElement/Page to maintain the same behavior. Created 3 years, 8 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 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 Compare((*a)[i].get(), (*b)[i].get()); 50 Compare((*a)[i].get(), (*b)[i].get());
51 } 51 }
52 52
53 static void Compare(const SyntheticSmoothScrollGestureParams* a, 53 static void Compare(const SyntheticSmoothScrollGestureParams* a,
54 const SyntheticSmoothScrollGestureParams* b) { 54 const SyntheticSmoothScrollGestureParams* b) {
55 EXPECT_EQ(a->gesture_source_type, b->gesture_source_type); 55 EXPECT_EQ(a->gesture_source_type, b->gesture_source_type);
56 EXPECT_EQ(a->anchor, b->anchor); 56 EXPECT_EQ(a->anchor, b->anchor);
57 EXPECT_EQ(a->distances.size(), b->distances.size()); 57 EXPECT_EQ(a->distances.size(), b->distances.size());
58 for (size_t i = 0; i < a->distances.size(); i++) 58 for (size_t i = 0; i < a->distances.size(); i++)
59 EXPECT_EQ(a->distances[i], b->distances[i]); 59 EXPECT_EQ(a->distances[i], b->distances[i]);
60 EXPECT_EQ(a->velocity, b->velocity);
60 EXPECT_EQ(a->prevent_fling, b->prevent_fling); 61 EXPECT_EQ(a->prevent_fling, b->prevent_fling);
61 EXPECT_EQ(a->speed_in_pixels_s, b->speed_in_pixels_s); 62 EXPECT_EQ(a->speed_in_pixels_s, b->speed_in_pixels_s);
62 } 63 }
63 64
64 static void Compare(const SyntheticSmoothDragGestureParams* a, 65 static void Compare(const SyntheticSmoothDragGestureParams* a,
65 const SyntheticSmoothDragGestureParams* b) { 66 const SyntheticSmoothDragGestureParams* b) {
66 EXPECT_EQ(a->gesture_source_type, b->gesture_source_type); 67 EXPECT_EQ(a->gesture_source_type, b->gesture_source_type);
67 EXPECT_EQ(a->start_point, b->start_point); 68 EXPECT_EQ(a->start_point, b->start_point);
68 EXPECT_EQ(a->distances.size(), b->distances.size()); 69 EXPECT_EQ(a->distances.size(), b->distances.size());
69 for (size_t i = 0; i < a->distances.size(); i++) 70 for (size_t i = 0; i < a->distances.size(); i++)
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 gesture_params->prevent_fling = false; 259 gesture_params->prevent_fling = false;
259 gesture_params->speed_in_pixels_s = 456; 260 gesture_params->speed_in_pixels_s = 456;
260 ASSERT_EQ(SyntheticGestureParams::SMOOTH_SCROLL_GESTURE, 261 ASSERT_EQ(SyntheticGestureParams::SMOOTH_SCROLL_GESTURE,
261 gesture_params->GetGestureType()); 262 gesture_params->GetGestureType());
262 SyntheticGesturePacket packet_in; 263 SyntheticGesturePacket packet_in;
263 packet_in.set_gesture_params(std::move(gesture_params)); 264 packet_in.set_gesture_params(std::move(gesture_params));
264 265
265 Verify(packet_in); 266 Verify(packet_in);
266 } 267 }
267 268
269 TEST_F(InputParamTraitsTest, SyntheticSmoothScrollGestureParamsWithVelocity) {
270 std::unique_ptr<SyntheticSmoothScrollGestureParams> gesture_params(
271 new SyntheticSmoothScrollGestureParams);
272 gesture_params->gesture_source_type = SyntheticGestureParams::MOUSE_INPUT;
273 gesture_params->anchor.SetPoint(234, 345);
274 gesture_params->distances.push_back(gfx::Vector2d(123, -789));
275 gesture_params->distances.push_back(gfx::Vector2d(-78, 43));
276 gesture_params->velocity = gfx::Vector2d(-45, 76);
277 gesture_params->prevent_fling = false;
278 gesture_params->speed_in_pixels_s = 456;
279 ASSERT_EQ(SyntheticGestureParams::SMOOTH_SCROLL_GESTURE,
280 gesture_params->GetGestureType());
281 SyntheticGesturePacket packet_in;
282 packet_in.set_gesture_params(std::move(gesture_params));
283
284 Verify(packet_in);
285 }
286
268 TEST_F(InputParamTraitsTest, SyntheticPinchGestureParams) { 287 TEST_F(InputParamTraitsTest, SyntheticPinchGestureParams) {
269 std::unique_ptr<SyntheticPinchGestureParams> gesture_params( 288 std::unique_ptr<SyntheticPinchGestureParams> gesture_params(
270 new SyntheticPinchGestureParams); 289 new SyntheticPinchGestureParams);
271 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; 290 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
272 gesture_params->scale_factor = 2.3f; 291 gesture_params->scale_factor = 2.3f;
273 gesture_params->anchor.SetPoint(234, 345); 292 gesture_params->anchor.SetPoint(234, 345);
274 gesture_params->relative_pointer_speed_in_pixels_s = 456; 293 gesture_params->relative_pointer_speed_in_pixels_s = 456;
275 ASSERT_EQ(SyntheticGestureParams::PINCH_GESTURE, 294 ASSERT_EQ(SyntheticGestureParams::PINCH_GESTURE,
276 gesture_params->GetGestureType()); 295 gesture_params->GetGestureType());
277 SyntheticGesturePacket packet_in; 296 SyntheticGesturePacket packet_in;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 379
361 ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION_LIST, 380 ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION_LIST,
362 gesture_params->GetGestureType()); 381 gesture_params->GetGestureType());
363 SyntheticGesturePacket packet_in; 382 SyntheticGesturePacket packet_in;
364 packet_in.set_gesture_params(std::move(gesture_params)); 383 packet_in.set_gesture_params(std::move(gesture_params));
365 Verify(packet_in); 384 Verify(packet_in);
366 } 385 }
367 386
368 } // namespace 387 } // namespace
369 } // namespace content 388 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698