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

Unified Diff: content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc

Issue 2478423002: Rename SyntheticPointer to SyntheticPointerDriver (Closed)
Patch Set: Move valid user input in SyntheticPointerDriver Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc
diff --git a/content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc b/content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc
index e4b0f9d22f73427a2a71e9ddcd7e0eb6b5db5553..5b6d1aa4c348e7c4850044407083fa484ac2c5fa 100644
--- a/content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc
+++ b/content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc
@@ -7,7 +7,7 @@
#include "content/browser/renderer_host/input/synthetic_gesture.h"
#include "content/browser/renderer_host/input/synthetic_gesture_target.h"
#include "content/browser/renderer_host/input/synthetic_pointer_action.h"
-#include "content/browser/renderer_host/input/synthetic_touch_pointer.h"
+#include "content/browser/renderer_host/input/synthetic_touch_driver.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/gfx/geometry/point.h"
@@ -120,7 +120,6 @@ class SyntheticPointerActionTest : public testing::Test {
public:
SyntheticPointerActionTest() {
action_param_list_.reset(new std::vector<SyntheticPointerActionParams>());
- std::fill(index_map_.begin(), index_map_.end(), -1);
num_success_ = 0;
num_failure_ = 0;
}
@@ -130,13 +129,13 @@ class SyntheticPointerActionTest : public testing::Test {
template <typename MockGestureTarget>
void CreateSyntheticPointerActionTarget() {
target_.reset(new MockGestureTarget());
- synthetic_pointer_ = SyntheticPointer::Create(
+ synthetic_pointer_driver_ = SyntheticPointerDriver::Create(
target_->GetDefaultSyntheticGestureSourceType());
}
void ForwardSyntheticPointerAction() {
pointer_action_.reset(new SyntheticPointerAction(
- std::move(action_param_list_), synthetic_pointer_.get(), &index_map_));
+ std::move(action_param_list_), synthetic_pointer_driver_.get()));
SyntheticGesture::Result result = pointer_action_->ForwardInputEvents(
base::TimeTicks::Now(), target_.get());
@@ -147,13 +146,16 @@ class SyntheticPointerActionTest : public testing::Test {
num_failure_++;
}
+ int GetPointIndex(int index) const {
+ return synthetic_pointer_driver_->GetPointIndex(index);
+ }
+
int num_success_;
int num_failure_;
std::unique_ptr<MockSyntheticPointerActionTarget> target_;
std::unique_ptr<SyntheticGesture> pointer_action_;
- std::unique_ptr<SyntheticPointer> synthetic_pointer_;
+ std::unique_ptr<SyntheticPointerDriver> synthetic_pointer_driver_;
std::unique_ptr<std::vector<SyntheticPointerActionParams>> action_param_list_;
- SyntheticPointerAction::IndexMap index_map_;
};
TEST_F(SyntheticPointerActionTest, PointerTouchAction) {
@@ -174,7 +176,7 @@ TEST_F(SyntheticPointerActionTest, PointerTouchAction) {
EXPECT_EQ(0, num_failure_);
EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart);
EXPECT_EQ(pointer_touch_target->indexes(0), 0);
- EXPECT_EQ(index_map_[0], 0);
+ EXPECT_EQ(GetPointIndex(0), 0);
EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89));
EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed);
ASSERT_EQ(pointer_touch_target->touch_length(), 1U);
@@ -199,11 +201,11 @@ TEST_F(SyntheticPointerActionTest, PointerTouchAction) {
// The type of the SyntheticWebTouchEvent is the action of the last finger.
EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart);
EXPECT_EQ(pointer_touch_target->indexes(0), 0);
- EXPECT_EQ(index_map_[0], 0);
+ EXPECT_EQ(GetPointIndex(0), 0);
EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(133, 156));
EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StateMoved);
EXPECT_EQ(pointer_touch_target->indexes(1), 1);
- EXPECT_EQ(index_map_[1], 1);
+ EXPECT_EQ(GetPointIndex(1), 1);
EXPECT_EQ(pointer_touch_target->positions(1), gfx::PointF(79, 132));
EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StatePressed);
ASSERT_EQ(pointer_touch_target->touch_length(), 2U);
@@ -220,7 +222,7 @@ TEST_F(SyntheticPointerActionTest, PointerTouchAction) {
EXPECT_EQ(0, num_failure_);
EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchMove);
EXPECT_EQ(pointer_touch_target->indexes(1), 1);
- EXPECT_EQ(index_map_[1], 1);
+ EXPECT_EQ(GetPointIndex(1), 1);
EXPECT_EQ(pointer_touch_target->positions(1), gfx::PointF(87, 253));
EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateMoved);
ASSERT_EQ(pointer_touch_target->touch_length(), 2U);
@@ -239,10 +241,10 @@ TEST_F(SyntheticPointerActionTest, PointerTouchAction) {
EXPECT_EQ(0, num_failure_);
EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchEnd);
EXPECT_EQ(pointer_touch_target->indexes(0), 0);
- EXPECT_EQ(index_map_[0], -1);
+ EXPECT_EQ(GetPointIndex(0), -1);
EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StateReleased);
EXPECT_EQ(pointer_touch_target->indexes(1), 1);
- EXPECT_EQ(index_map_[1], -1);
+ EXPECT_EQ(GetPointIndex(1), -1);
EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateReleased);
ASSERT_EQ(pointer_touch_target->touch_length(), 2U);
}
@@ -273,7 +275,7 @@ TEST_F(SyntheticPointerActionTest, PointerTouchActionIndexInvalid) {
EXPECT_EQ(1, num_failure_);
EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart);
EXPECT_EQ(pointer_touch_target->indexes(0), 0);
- EXPECT_EQ(index_map_[0], 0);
+ EXPECT_EQ(GetPointIndex(0), 0);
EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89));
EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed);
ASSERT_EQ(pointer_touch_target->touch_length(), 1U);
@@ -305,7 +307,7 @@ TEST_F(SyntheticPointerActionTest, PointerTouchActionSourceTypeInvalid) {
EXPECT_EQ(1, num_failure_);
EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart);
EXPECT_EQ(pointer_touch_target->indexes(0), 0);
- EXPECT_EQ(index_map_[0], 0);
+ EXPECT_EQ(GetPointIndex(0), 0);
EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89));
EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed);
ASSERT_EQ(pointer_touch_target->touch_length(), 1U);
@@ -349,7 +351,7 @@ TEST_F(SyntheticPointerActionTest, PointerTouchActionTypeInvalid) {
EXPECT_EQ(2, num_failure_);
EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart);
EXPECT_EQ(pointer_touch_target->indexes(0), 0);
- EXPECT_EQ(index_map_[0], 0);
+ EXPECT_EQ(GetPointIndex(0), 0);
EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89));
EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed);
ASSERT_EQ(pointer_touch_target->touch_length(), 1U);

Powered by Google App Engine
This is Rietveld 408576698