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

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: Use get functions in the IPC message 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,
1478 &synthetic_pointer, position)); 1478 SyntheticGestureParams::PointerActionType::PRESS, &synthetic_pointer,
1479 position));
1479 QueueSyntheticGesture(std::move(gesture)); 1480 QueueSyntheticGesture(std::move(gesture));
1480 FlushInputUntilComplete(); 1481 FlushInputUntilComplete();
1481 1482
1482 MockSyntheticPointerTouchActionTarget* pointer_touch_target = 1483 MockSyntheticPointerTouchActionTarget* pointer_touch_target =
1483 static_cast<MockSyntheticPointerTouchActionTarget*>(target_); 1484 static_cast<MockSyntheticPointerTouchActionTarget*>(target_);
1484 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); 1485 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart);
1485 EXPECT_EQ(pointer_touch_target->positions(0), position); 1486 EXPECT_EQ(pointer_touch_target->positions(0), position);
1486 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed); 1487 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed);
1487 ASSERT_EQ(pointer_touch_target->touch_length(), 1U); 1488 ASSERT_EQ(pointer_touch_target->touch_length(), 1U);
1488 1489
1489 position.SetPoint(79, 132); 1490 position.SetPoint(79, 132);
1490 gesture.reset(new SyntheticPointerAction(SyntheticGestureParams::TOUCH_INPUT, 1491 gesture.reset(new SyntheticPointerAction(
1491 SyntheticGesture::PRESS, 1492 SyntheticGestureParams::TOUCH_INPUT,
1492 &synthetic_pointer, position)); 1493 SyntheticGestureParams::PointerActionType::PRESS, &synthetic_pointer,
1494 position));
1493 QueueSyntheticGesture(std::move(gesture)); 1495 QueueSyntheticGesture(std::move(gesture));
1494 FlushInputUntilComplete(); 1496 FlushInputUntilComplete();
1495 1497
1496 pointer_touch_target = 1498 pointer_touch_target =
1497 static_cast<MockSyntheticPointerTouchActionTarget*>(target_); 1499 static_cast<MockSyntheticPointerTouchActionTarget*>(target_);
1498 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); 1500 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart);
1499 EXPECT_EQ(pointer_touch_target->indexes(1), 1); 1501 EXPECT_EQ(pointer_touch_target->indexes(1), 1);
1500 EXPECT_EQ(pointer_touch_target->positions(1), position); 1502 EXPECT_EQ(pointer_touch_target->positions(1), position);
1501 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StatePressed); 1503 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StatePressed);
1502 ASSERT_EQ(pointer_touch_target->touch_length(), 2U); 1504 ASSERT_EQ(pointer_touch_target->touch_length(), 2U);
1503 1505
1504 int index = 1; 1506 int index = 1;
1505 position.SetPoint(133, 156); 1507 position.SetPoint(133, 156);
1506 gesture.reset(new SyntheticPointerAction( 1508 gesture.reset(new SyntheticPointerAction(
1507 SyntheticGestureParams::TOUCH_INPUT, SyntheticGesture::MOVE, 1509 SyntheticGestureParams::TOUCH_INPUT,
1508 &synthetic_pointer, position, index)); 1510 SyntheticGestureParams::PointerActionType::MOVE, &synthetic_pointer,
1511 position, index));
1509 QueueSyntheticGesture(std::move(gesture)); 1512 QueueSyntheticGesture(std::move(gesture));
1510 FlushInputUntilComplete(); 1513 FlushInputUntilComplete();
1511 1514
1512 pointer_touch_target = 1515 pointer_touch_target =
1513 static_cast<MockSyntheticPointerTouchActionTarget*>(target_); 1516 static_cast<MockSyntheticPointerTouchActionTarget*>(target_);
1514 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchMove); 1517 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchMove);
1515 EXPECT_EQ(pointer_touch_target->positions(1), position); 1518 EXPECT_EQ(pointer_touch_target->positions(1), position);
1516 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateMoved); 1519 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateMoved);
1517 ASSERT_EQ(pointer_touch_target->touch_length(), 2U); 1520 ASSERT_EQ(pointer_touch_target->touch_length(), 2U);
1518 1521
1519 gesture.reset(new SyntheticPointerAction( 1522 gesture.reset(new SyntheticPointerAction(
1520 SyntheticGestureParams::TOUCH_INPUT, SyntheticGesture::RELEASE, 1523 SyntheticGestureParams::TOUCH_INPUT,
1521 &synthetic_pointer, position, index)); 1524 SyntheticGestureParams::PointerActionType::RELEASE, &synthetic_pointer,
1525 position, index));
1522 QueueSyntheticGesture(std::move(gesture)); 1526 QueueSyntheticGesture(std::move(gesture));
1523 FlushInputUntilComplete(); 1527 FlushInputUntilComplete();
1524 1528
1525 pointer_touch_target = 1529 pointer_touch_target =
1526 static_cast<MockSyntheticPointerTouchActionTarget*>(target_); 1530 static_cast<MockSyntheticPointerTouchActionTarget*>(target_);
1527 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchEnd); 1531 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchEnd);
1528 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateReleased); 1532 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateReleased);
1529 } 1533 }
1530 1534
1531 } // namespace 1535 } // namespace
1532 1536
1533 } // namespace content 1537 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698