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

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

Issue 1707943002: Add SyntheticPointerActionParams used in Chromedriver extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/browser/renderer_host/input/synthetic_gesture_controller.h" 5 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 base::TimeDelta::FromMilliseconds(params.duration_ms)); 1467 base::TimeDelta::FromMilliseconds(params.duration_ms));
1468 } 1468 }
1469 1469
1470 TEST_F(SyntheticGestureControllerTest, PointerTouchAction) { 1470 TEST_F(SyntheticGestureControllerTest, PointerTouchAction) {
1471 CreateControllerAndTarget<MockSyntheticPointerTouchActionTarget>(); 1471 CreateControllerAndTarget<MockSyntheticPointerTouchActionTarget>();
1472 1472
1473 SyntheticTouchPointer synthetic_pointer; 1473 SyntheticTouchPointer synthetic_pointer;
1474 1474
1475 gfx::PointF position(54, 89); 1475 gfx::PointF position(54, 89);
1476 scoped_ptr<SyntheticPointerAction> gesture(new SyntheticPointerAction( 1476 scoped_ptr<SyntheticPointerAction> gesture(new SyntheticPointerAction(
1477 SyntheticGestureParams::TOUCH_INPUT, SyntheticGesture::PRESS, 1477 SyntheticGestureParams::TOUCH_INPUT, SyntheticGestureParams::PRESS,
1478 &synthetic_pointer, position)); 1478 &synthetic_pointer, position));
1479 QueueSyntheticGesture(std::move(gesture)); 1479 QueueSyntheticGesture(std::move(gesture));
1480 FlushInputUntilComplete(); 1480 FlushInputUntilComplete();
1481 1481
1482 MockSyntheticPointerTouchActionTarget* pointer_touch_target = 1482 MockSyntheticPointerTouchActionTarget* pointer_touch_target =
1483 static_cast<MockSyntheticPointerTouchActionTarget*>(target_); 1483 static_cast<MockSyntheticPointerTouchActionTarget*>(target_);
1484 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); 1484 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart);
1485 EXPECT_EQ(pointer_touch_target->positions(0), position); 1485 EXPECT_EQ(pointer_touch_target->positions(0), position);
1486 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed); 1486 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed);
1487 ASSERT_EQ(pointer_touch_target->touch_length(), 1U); 1487 ASSERT_EQ(pointer_touch_target->touch_length(), 1U);
1488 1488
1489 position.SetPoint(79, 132); 1489 position.SetPoint(79, 132);
1490 gesture.reset(new SyntheticPointerAction(SyntheticGestureParams::TOUCH_INPUT, 1490 gesture.reset(new SyntheticPointerAction(SyntheticGestureParams::TOUCH_INPUT,
1491 SyntheticGesture::PRESS, 1491 SyntheticGestureParams::PRESS,
1492 &synthetic_pointer, position)); 1492 &synthetic_pointer, position));
1493 QueueSyntheticGesture(std::move(gesture)); 1493 QueueSyntheticGesture(std::move(gesture));
1494 FlushInputUntilComplete(); 1494 FlushInputUntilComplete();
1495 1495
1496 pointer_touch_target = 1496 pointer_touch_target =
1497 static_cast<MockSyntheticPointerTouchActionTarget*>(target_); 1497 static_cast<MockSyntheticPointerTouchActionTarget*>(target_);
1498 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); 1498 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart);
1499 EXPECT_EQ(pointer_touch_target->indexes(1), 1); 1499 EXPECT_EQ(pointer_touch_target->indexes(1), 1);
1500 EXPECT_EQ(pointer_touch_target->positions(1), position); 1500 EXPECT_EQ(pointer_touch_target->positions(1), position);
1501 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StatePressed); 1501 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StatePressed);
1502 ASSERT_EQ(pointer_touch_target->touch_length(), 2U); 1502 ASSERT_EQ(pointer_touch_target->touch_length(), 2U);
1503 1503
1504 int index = 1; 1504 int index = 1;
1505 position.SetPoint(133, 156); 1505 position.SetPoint(133, 156);
1506 gesture.reset(new SyntheticPointerAction( 1506 gesture.reset(new SyntheticPointerAction(
1507 SyntheticGestureParams::TOUCH_INPUT, SyntheticGesture::MOVE, 1507 SyntheticGestureParams::TOUCH_INPUT, SyntheticGestureParams::MOVE,
1508 &synthetic_pointer, position, index)); 1508 &synthetic_pointer, position, index));
1509 QueueSyntheticGesture(std::move(gesture)); 1509 QueueSyntheticGesture(std::move(gesture));
1510 FlushInputUntilComplete(); 1510 FlushInputUntilComplete();
1511 1511
1512 pointer_touch_target = 1512 pointer_touch_target =
1513 static_cast<MockSyntheticPointerTouchActionTarget*>(target_); 1513 static_cast<MockSyntheticPointerTouchActionTarget*>(target_);
1514 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchMove); 1514 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchMove);
1515 EXPECT_EQ(pointer_touch_target->positions(1), position); 1515 EXPECT_EQ(pointer_touch_target->positions(1), position);
1516 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateMoved); 1516 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateMoved);
1517 ASSERT_EQ(pointer_touch_target->touch_length(), 2U); 1517 ASSERT_EQ(pointer_touch_target->touch_length(), 2U);
1518 1518
1519 gesture.reset(new SyntheticPointerAction( 1519 gesture.reset(new SyntheticPointerAction(
1520 SyntheticGestureParams::TOUCH_INPUT, SyntheticGesture::RELEASE, 1520 SyntheticGestureParams::TOUCH_INPUT, SyntheticGestureParams::RELEASE,
1521 &synthetic_pointer, position, index)); 1521 &synthetic_pointer, position, index));
1522 QueueSyntheticGesture(std::move(gesture)); 1522 QueueSyntheticGesture(std::move(gesture));
1523 FlushInputUntilComplete(); 1523 FlushInputUntilComplete();
1524 1524
1525 pointer_touch_target = 1525 pointer_touch_target =
1526 static_cast<MockSyntheticPointerTouchActionTarget*>(target_); 1526 static_cast<MockSyntheticPointerTouchActionTarget*>(target_);
1527 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchEnd); 1527 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchEnd);
1528 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateReleased); 1528 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateReleased);
1529 } 1529 }
1530 1530
1531 } // namespace 1531 } // namespace
1532 1532
1533 } // namespace content 1533 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698