Change definitions of EventPointerType.
Change the name definitions, replacing the old style. POINTER_TYPE_XXX -> kXXX Done via sed. This change will allow us to only have a single definition in UI/blink, currently there are 3 definitions of the same value. No functional changes in this CL. BUG=1073560 TBR=sky@chromium.org Change-Id: I20be33b33c0689b720e00d2cfa86a43f145ae808 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2170856 Commit-Queue: Dave Tapuska <dtapuska@chromium.org> Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org> Cr-Commit-Position: refs/heads/master@{#763831}
This commit is contained in:
ash
accessibility
app_list
display
drag_drop
events
fast_ink
magnifier
metrics
shelf
system
touch
utility
wm
chrome/browser
chromeos
accessibility
events
power
ui
views
fullscreen_control
chromecast
browser
graphics
components/exo
content
browser
renderer_host
input
render_widget_host_view_aura.ccrender_widget_host_view_aura.hrender_widget_host_view_aura_unittest.ccui_events_helper.ccweb_contents
public
ui
aura
base
user_activity
events
blink
cocoa
devices
event.hevent_constants.hevent_unittest.ccevents_stub.ccfuchsia
gesture_detection
gesture_event_details.hgestures
gesture_provider_aura.ccgesture_provider_aura_unittest.ccgesture_recognizer_impl.ccmotion_event_aura.ccmotion_event_aura_unittest.cc
mojom
ozone
evdev
test
win
x
ozone
platform
wayland
host
views
animation
controls
touchui
widget
win
wm
@ -1149,9 +1149,8 @@ gfx::PointF TouchExplorationController::ConvertDIPToPixels(
|
|||||||
bool TouchExplorationController::IsTargetedToArcVirtualKeyboard(
|
bool TouchExplorationController::IsTargetedToArcVirtualKeyboard(
|
||||||
const gfx::Point& location) {
|
const gfx::Point& location) {
|
||||||
// Copy event here as WindowTargeter::FindTargetForEvent modify touch event.
|
// Copy event here as WindowTargeter::FindTargetForEvent modify touch event.
|
||||||
ui::TouchEvent event(
|
ui::TouchEvent event(ui::ET_TOUCH_MOVED, gfx::Point(), Now(),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(), Now(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
event.set_location(location);
|
event.set_location(location);
|
||||||
|
|
||||||
// It's safe to static cast to aura::Window here. As current implementation of
|
// It's safe to static cast to aura::Window here. As current implementation of
|
||||||
|
@ -297,7 +297,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
|
|||||||
void EnterTouchExplorationModeAtLocation(gfx::Point tap_location) {
|
void EnterTouchExplorationModeAtLocation(gfx::Point tap_location) {
|
||||||
ui::TouchEvent touch_press(
|
ui::TouchEvent touch_press(
|
||||||
ui::ET_TOUCH_PRESSED, tap_location, Now(),
|
ui::ET_TOUCH_PRESSED, tap_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&touch_press);
|
generator_->Dispatch(&touch_press);
|
||||||
AdvanceSimulatedTimePastTapDelay();
|
AdvanceSimulatedTimePastTapDelay();
|
||||||
EXPECT_TRUE(IsInTouchToMouseMode());
|
EXPECT_TRUE(IsInTouchToMouseMode());
|
||||||
@ -523,7 +523,7 @@ TEST_F(TouchExplorationTest, TurnOnMidTouch) {
|
|||||||
SwitchTouchExplorationMode(true);
|
SwitchTouchExplorationMode(true);
|
||||||
ui::TouchEvent touch_move(
|
ui::TouchEvent touch_move(
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(11, 12), Now(),
|
ui::ET_TOUCH_MOVED, gfx::Point(11, 12), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&touch_move);
|
generator_->Dispatch(&touch_move);
|
||||||
EXPECT_TRUE(cursor_client()->IsCursorVisible());
|
EXPECT_TRUE(cursor_client()->IsCursorVisible());
|
||||||
EXPECT_FALSE(cursor_client()->IsMouseEventsEnabled());
|
EXPECT_FALSE(cursor_client()->IsMouseEventsEnabled());
|
||||||
@ -550,7 +550,7 @@ TEST_F(TouchExplorationTest, TurnOnMidTouch) {
|
|||||||
// The release of the first finger shouldn't be affected.
|
// The release of the first finger shouldn't be affected.
|
||||||
ui::TouchEvent touch_release(
|
ui::TouchEvent touch_release(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(11, 12), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(11, 12), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&touch_release);
|
generator_->Dispatch(&touch_release);
|
||||||
captured_events = GetCapturedLocatedEvents();
|
captured_events = GetCapturedLocatedEvents();
|
||||||
ASSERT_EQ(1u, captured_events.size());
|
ASSERT_EQ(1u, captured_events.size());
|
||||||
@ -979,7 +979,7 @@ TEST_F(TouchExplorationTest, SplitTap) {
|
|||||||
// After the release, there is still a finger in touch explore mode.
|
// After the release, there is still a finger in touch explore mode.
|
||||||
ui::TouchEvent split_tap_press(
|
ui::TouchEvent split_tap_press(
|
||||||
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_press);
|
generator_->Dispatch(&split_tap_press);
|
||||||
// To simulate the behavior of the real device, we manually disable
|
// To simulate the behavior of the real device, we manually disable
|
||||||
// mouse events. To not rely on manually setting the state, this is also
|
// mouse events. To not rely on manually setting the state, this is also
|
||||||
@ -990,7 +990,7 @@ TEST_F(TouchExplorationTest, SplitTap) {
|
|||||||
EXPECT_FALSE(IsInGestureInProgressState());
|
EXPECT_FALSE(IsInGestureInProgressState());
|
||||||
ui::TouchEvent split_tap_release(
|
ui::TouchEvent split_tap_release(
|
||||||
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_release);
|
generator_->Dispatch(&split_tap_release);
|
||||||
// Releasing the second finger should re-enable mouse events putting us
|
// Releasing the second finger should re-enable mouse events putting us
|
||||||
// back into the touch exploration mode.
|
// back into the touch exploration mode.
|
||||||
@ -1009,7 +1009,7 @@ TEST_F(TouchExplorationTest, SplitTap) {
|
|||||||
|
|
||||||
ui::TouchEvent touch_explore_release(
|
ui::TouchEvent touch_explore_release(
|
||||||
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&touch_explore_release);
|
generator_->Dispatch(&touch_explore_release);
|
||||||
AdvanceSimulatedTimePastTapDelay();
|
AdvanceSimulatedTimePastTapDelay();
|
||||||
EXPECT_TRUE(IsInNoFingersDownState());
|
EXPECT_TRUE(IsInNoFingersDownState());
|
||||||
@ -1040,15 +1040,15 @@ TEST_F(TouchExplorationTest, SplitTapRelease) {
|
|||||||
// not at the location of the second tap and release.
|
// not at the location of the second tap and release.
|
||||||
ui::TouchEvent split_tap_press(
|
ui::TouchEvent split_tap_press(
|
||||||
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_press);
|
generator_->Dispatch(&split_tap_press);
|
||||||
ui::TouchEvent touch_explore_release(
|
ui::TouchEvent touch_explore_release(
|
||||||
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&touch_explore_release);
|
generator_->Dispatch(&touch_explore_release);
|
||||||
ui::TouchEvent split_tap_release(
|
ui::TouchEvent split_tap_release(
|
||||||
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_release);
|
generator_->Dispatch(&split_tap_release);
|
||||||
EXPECT_TRUE(IsInNoFingersDownState());
|
EXPECT_TRUE(IsInNoFingersDownState());
|
||||||
|
|
||||||
@ -1083,7 +1083,7 @@ TEST_F(TouchExplorationTest, SplitTapMultiFinger) {
|
|||||||
// Now tap at a different location
|
// Now tap at a different location
|
||||||
ui::TouchEvent split_tap_press(
|
ui::TouchEvent split_tap_press(
|
||||||
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_press);
|
generator_->Dispatch(&split_tap_press);
|
||||||
simulated_clock_.Advance(gesture_detector_config_.longpress_timeout);
|
simulated_clock_.Advance(gesture_detector_config_.longpress_timeout);
|
||||||
|
|
||||||
@ -1091,22 +1091,22 @@ TEST_F(TouchExplorationTest, SplitTapMultiFinger) {
|
|||||||
// enter the wait state.
|
// enter the wait state.
|
||||||
ui::TouchEvent third_press(
|
ui::TouchEvent third_press(
|
||||||
ui::ET_TOUCH_PRESSED, third_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, third_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
generator_->Dispatch(&third_press);
|
generator_->Dispatch(&third_press);
|
||||||
|
|
||||||
// When all three fingers are released, no events should be captured.
|
// When all three fingers are released, no events should be captured.
|
||||||
// All fingers should then be up.
|
// All fingers should then be up.
|
||||||
ui::TouchEvent touch_explore_release(
|
ui::TouchEvent touch_explore_release(
|
||||||
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&touch_explore_release);
|
generator_->Dispatch(&touch_explore_release);
|
||||||
ui::TouchEvent split_tap_release(
|
ui::TouchEvent split_tap_release(
|
||||||
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_release);
|
generator_->Dispatch(&split_tap_release);
|
||||||
ui::TouchEvent third_tap_release(
|
ui::TouchEvent third_tap_release(
|
||||||
ui::ET_TOUCH_RELEASED, third_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, third_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
generator_->Dispatch(&third_tap_release);
|
generator_->Dispatch(&third_tap_release);
|
||||||
|
|
||||||
std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents();
|
std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents();
|
||||||
@ -1132,22 +1132,22 @@ TEST_F(TouchExplorationTest, SplitTapLeaveSlop) {
|
|||||||
// Now tap at a different location for split tap.
|
// Now tap at a different location for split tap.
|
||||||
ui::TouchEvent split_tap_press(
|
ui::TouchEvent split_tap_press(
|
||||||
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_press);
|
generator_->Dispatch(&split_tap_press);
|
||||||
|
|
||||||
// Move the first finger out of slop and release both fingers. The split
|
// Move the first finger out of slop and release both fingers. The split
|
||||||
// tap should have been cancelled.
|
// tap should have been cancelled.
|
||||||
ui::TouchEvent first_touch_move(
|
ui::TouchEvent first_touch_move(
|
||||||
ui::ET_TOUCH_MOVED, first_move_location, Now(),
|
ui::ET_TOUCH_MOVED, first_move_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&first_touch_move);
|
generator_->Dispatch(&first_touch_move);
|
||||||
ui::TouchEvent first_touch_release(
|
ui::TouchEvent first_touch_release(
|
||||||
ui::ET_TOUCH_RELEASED, first_move_location, Now(),
|
ui::ET_TOUCH_RELEASED, first_move_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&first_touch_release);
|
generator_->Dispatch(&first_touch_release);
|
||||||
ui::TouchEvent second_touch_release(
|
ui::TouchEvent second_touch_release(
|
||||||
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&second_touch_release);
|
generator_->Dispatch(&second_touch_release);
|
||||||
|
|
||||||
std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents();
|
std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents();
|
||||||
@ -1159,22 +1159,22 @@ TEST_F(TouchExplorationTest, SplitTapLeaveSlop) {
|
|||||||
ClearCapturedEvents();
|
ClearCapturedEvents();
|
||||||
ui::TouchEvent split_tap_press2(
|
ui::TouchEvent split_tap_press2(
|
||||||
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_press2);
|
generator_->Dispatch(&split_tap_press2);
|
||||||
|
|
||||||
// Move the second finger out of slop and release both fingers. The split
|
// Move the second finger out of slop and release both fingers. The split
|
||||||
// tap should have been cancelled.
|
// tap should have been cancelled.
|
||||||
ui::TouchEvent second_touch_move2(
|
ui::TouchEvent second_touch_move2(
|
||||||
ui::ET_TOUCH_MOVED, second_move_location, Now(),
|
ui::ET_TOUCH_MOVED, second_move_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&second_touch_move2);
|
generator_->Dispatch(&second_touch_move2);
|
||||||
ui::TouchEvent first_touch_release2(
|
ui::TouchEvent first_touch_release2(
|
||||||
ui::ET_TOUCH_RELEASED, first_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, first_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&first_touch_release2);
|
generator_->Dispatch(&first_touch_release2);
|
||||||
ui::TouchEvent second_touch_release2(
|
ui::TouchEvent second_touch_release2(
|
||||||
ui::ET_TOUCH_RELEASED, second_move_location, Now(),
|
ui::ET_TOUCH_RELEASED, second_move_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&second_touch_release2);
|
generator_->Dispatch(&second_touch_release2);
|
||||||
|
|
||||||
captured_events = GetCapturedLocatedEvents();
|
captured_events = GetCapturedLocatedEvents();
|
||||||
@ -1194,7 +1194,7 @@ TEST_F(TouchExplorationTest, EnterGestureInProgressState) {
|
|||||||
float distance = gesture_detector_config_.touch_slop + 1;
|
float distance = gesture_detector_config_.touch_slop + 1;
|
||||||
ui::TouchEvent first_press(
|
ui::TouchEvent first_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(0, 1), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(0, 1), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
gfx::Point second_location(distance / 2, 1);
|
gfx::Point second_location(distance / 2, 1);
|
||||||
gfx::Point third_location(distance, 1);
|
gfx::Point third_location(distance, 1);
|
||||||
gfx::Point touch_exploration_location(20, 21);
|
gfx::Point touch_exploration_location(20, 21);
|
||||||
@ -1371,18 +1371,15 @@ TEST_F(TouchExplorationTest, DISABLED_AllFingerPermutations) {
|
|||||||
int y = 10 * touch_id + 2;
|
int y = 10 * touch_id + 2;
|
||||||
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(x++, y++), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(x++, y++), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch, touch_id)));
|
||||||
touch_id)));
|
|
||||||
queued_events.push_back(all_events.back().get());
|
queued_events.push_back(all_events.back().get());
|
||||||
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(x++, y++), Now(),
|
ui::ET_TOUCH_MOVED, gfx::Point(x++, y++), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch, touch_id)));
|
||||||
touch_id)));
|
|
||||||
queued_events.push_back(all_events.back().get());
|
queued_events.push_back(all_events.back().get());
|
||||||
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(x, y), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(x, y), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch, touch_id)));
|
||||||
touch_id)));
|
|
||||||
queued_events.push_back(all_events.back().get());
|
queued_events.push_back(all_events.back().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1487,7 +1484,7 @@ TEST_F(TouchExplorationTest, GestureAddedFinger) {
|
|||||||
float distance = gesture_detector_config_.touch_slop + 1;
|
float distance = gesture_detector_config_.touch_slop + 1;
|
||||||
ui::TouchEvent first_press(
|
ui::TouchEvent first_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&first_press);
|
generator_->Dispatch(&first_press);
|
||||||
simulated_clock_.Advance(base::TimeDelta::FromMilliseconds(10));
|
simulated_clock_.Advance(base::TimeDelta::FromMilliseconds(10));
|
||||||
gfx::Point second_location(100 + distance, 200);
|
gfx::Point second_location(100 + distance, 200);
|
||||||
@ -1501,7 +1498,7 @@ TEST_F(TouchExplorationTest, GestureAddedFinger) {
|
|||||||
// gestures are prevented from continuing to go through.
|
// gestures are prevented from continuing to go through.
|
||||||
ui::TouchEvent second_press(
|
ui::TouchEvent second_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(20, 21), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(20, 21), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&second_press);
|
generator_->Dispatch(&second_press);
|
||||||
AdvanceSimulatedTimePastTapDelay();
|
AdvanceSimulatedTimePastTapDelay();
|
||||||
EXPECT_FALSE(IsInGestureInProgressState());
|
EXPECT_FALSE(IsInGestureInProgressState());
|
||||||
@ -1518,7 +1515,7 @@ TEST_F(TouchExplorationTest, EnterSlideGestureState) {
|
|||||||
float distance = gesture_detector_config_.touch_slop + 1;
|
float distance = gesture_detector_config_.touch_slop + 1;
|
||||||
ui::TouchEvent first_press(
|
ui::TouchEvent first_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(window_right, 1), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(window_right, 1), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
gfx::Point second_location(window_right, 1 + distance / 2);
|
gfx::Point second_location(window_right, 1 + distance / 2);
|
||||||
gfx::Point third_location(window_right, 1 + distance);
|
gfx::Point third_location(window_right, 1 + distance);
|
||||||
gfx::Point fourth_location(window_right, 35);
|
gfx::Point fourth_location(window_right, 35);
|
||||||
@ -1578,7 +1575,7 @@ TEST_F(TouchExplorationTest, AvoidEnteringSlideGesture) {
|
|||||||
ui::TouchEvent first_press(
|
ui::TouchEvent first_press(
|
||||||
ui::ET_TOUCH_PRESSED,
|
ui::ET_TOUCH_PRESSED,
|
||||||
gfx::Point(window.right() - GetSlopDistanceFromEdge(), 1), Now(),
|
gfx::Point(window.right() - GetSlopDistanceFromEdge(), 1), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
gfx::Point out_of_slop(window.right() - GetSlopDistanceFromEdge() + distance,
|
gfx::Point out_of_slop(window.right() - GetSlopDistanceFromEdge() + distance,
|
||||||
1);
|
1);
|
||||||
gfx::Point into_boundaries(window.right() - GetMaxDistanceFromEdge() / 2, 1);
|
gfx::Point into_boundaries(window.right() - GetMaxDistanceFromEdge() / 2, 1);
|
||||||
@ -1619,7 +1616,7 @@ TEST_F(TouchExplorationTest, TestingBoundaries) {
|
|||||||
|
|
||||||
ui::TouchEvent first_press(
|
ui::TouchEvent first_press(
|
||||||
ui::ET_TOUCH_PRESSED, initial_press, Now(),
|
ui::ET_TOUCH_PRESSED, initial_press, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&first_press);
|
generator_->Dispatch(&first_press);
|
||||||
simulated_clock_.Advance(base::TimeDelta::FromMilliseconds(10));
|
simulated_clock_.Advance(base::TimeDelta::FromMilliseconds(10));
|
||||||
EXPECT_FALSE(IsInGestureInProgressState());
|
EXPECT_FALSE(IsInGestureInProgressState());
|
||||||
@ -1696,7 +1693,7 @@ TEST_F(TouchExplorationTest, InBoundariesTouchExploration) {
|
|||||||
gfx::Point initial_press(window.right() - GetMaxDistanceFromEdge() / 2, 1);
|
gfx::Point initial_press(window.right() - GetMaxDistanceFromEdge() / 2, 1);
|
||||||
ui::TouchEvent first_press(
|
ui::TouchEvent first_press(
|
||||||
ui::ET_TOUCH_PRESSED, initial_press, Now(),
|
ui::ET_TOUCH_PRESSED, initial_press, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&first_press);
|
generator_->Dispatch(&first_press);
|
||||||
EXPECT_FALSE(IsInGestureInProgressState());
|
EXPECT_FALSE(IsInGestureInProgressState());
|
||||||
EXPECT_FALSE(IsInSlideGestureState());
|
EXPECT_FALSE(IsInSlideGestureState());
|
||||||
@ -1760,24 +1757,24 @@ TEST_F(TouchExplorationTest, TwoFingerTapAndMoveFirstFinger) {
|
|||||||
// tap.
|
// tap.
|
||||||
ui::TouchEvent first_press_id_1(
|
ui::TouchEvent first_press_id_1(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent first_press_id_2(
|
ui::TouchEvent first_press_id_2(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
|
|
||||||
ui::TouchEvent slop_move_id_1(
|
ui::TouchEvent slop_move_id_1(
|
||||||
ui::ET_TOUCH_MOVED,
|
ui::ET_TOUCH_MOVED,
|
||||||
gfx::Point(100 + gesture_detector_config_.touch_slop, 200), Now(),
|
gfx::Point(100 + gesture_detector_config_.touch_slop, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent slop_move_id_2(
|
ui::TouchEvent slop_move_id_2(
|
||||||
ui::ET_TOUCH_MOVED,
|
ui::ET_TOUCH_MOVED,
|
||||||
gfx::Point(110 + gesture_detector_config_.touch_slop, 200), Now(),
|
gfx::Point(110 + gesture_detector_config_.touch_slop, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
|
|
||||||
ui::TouchEvent out_slop_id_1(
|
ui::TouchEvent out_slop_id_1(
|
||||||
ui::ET_TOUCH_MOVED,
|
ui::ET_TOUCH_MOVED,
|
||||||
gfx::Point(100 + gesture_detector_config_.touch_slop + 1, 200), Now(),
|
gfx::Point(100 + gesture_detector_config_.touch_slop + 1, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
|
|
||||||
// Dispatch the inital presses.
|
// Dispatch the inital presses.
|
||||||
generator_->Dispatch(&first_press_id_1);
|
generator_->Dispatch(&first_press_id_1);
|
||||||
@ -1810,15 +1807,15 @@ TEST_F(TouchExplorationTest, TwoFingerTapAndMoveSecondFinger) {
|
|||||||
// tap.
|
// tap.
|
||||||
ui::TouchEvent first_press_id_1(
|
ui::TouchEvent first_press_id_1(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent first_press_id_2(
|
ui::TouchEvent first_press_id_2(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
|
|
||||||
ui::TouchEvent out_slop_id_2(
|
ui::TouchEvent out_slop_id_2(
|
||||||
ui::ET_TOUCH_MOVED,
|
ui::ET_TOUCH_MOVED,
|
||||||
gfx::Point(100 + gesture_detector_config_.touch_slop + 1, 200), Now(),
|
gfx::Point(100 + gesture_detector_config_.touch_slop + 1, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
|
|
||||||
generator_->Dispatch(&first_press_id_1);
|
generator_->Dispatch(&first_press_id_1);
|
||||||
EXPECT_FALSE(IsInTwoFingerTapState());
|
EXPECT_FALSE(IsInTwoFingerTapState());
|
||||||
@ -1965,7 +1962,7 @@ TEST_F(TouchExplorationTest, TouchExploreLiftInLiftActivationArea) {
|
|||||||
// A touch release should trigger a tap.
|
// A touch release should trigger a tap.
|
||||||
ui::TouchEvent touch_explore_release(
|
ui::TouchEvent touch_explore_release(
|
||||||
ui::ET_TOUCH_RELEASED, tap_location, Now(),
|
ui::ET_TOUCH_RELEASED, tap_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&touch_explore_release);
|
generator_->Dispatch(&touch_explore_release);
|
||||||
AdvanceSimulatedTimePastTapDelay();
|
AdvanceSimulatedTimePastTapDelay();
|
||||||
|
|
||||||
@ -1985,7 +1982,7 @@ TEST_F(TouchExplorationTest, TouchExploreLiftInLiftActivationArea) {
|
|||||||
ClearCapturedEvents();
|
ClearCapturedEvents();
|
||||||
ui::TouchEvent out_touch_explore_release(
|
ui::TouchEvent out_touch_explore_release(
|
||||||
ui::ET_TOUCH_RELEASED, out_tap_location, Now(),
|
ui::ET_TOUCH_RELEASED, out_tap_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&out_touch_explore_release);
|
generator_->Dispatch(&out_touch_explore_release);
|
||||||
AdvanceSimulatedTimePastTapDelay();
|
AdvanceSimulatedTimePastTapDelay();
|
||||||
|
|
||||||
@ -2014,28 +2011,28 @@ TEST_F(TouchExplorationTest, ThreeOrFourFingerTap) {
|
|||||||
|
|
||||||
ui::TouchEvent press_id_1(
|
ui::TouchEvent press_id_1(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent release_id_1(
|
ui::TouchEvent release_id_1(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(100, 200), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(100, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent press_id_2(
|
ui::TouchEvent press_id_2(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
ui::TouchEvent release_id_2(
|
ui::TouchEvent release_id_2(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(110, 200), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(110, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
ui::TouchEvent press_id_3(
|
ui::TouchEvent press_id_3(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(120, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(120, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 3));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 3));
|
||||||
ui::TouchEvent release_id_3(
|
ui::TouchEvent release_id_3(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(120, 200), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(120, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 3));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 3));
|
||||||
ui::TouchEvent press_id_4(
|
ui::TouchEvent press_id_4(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(130, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(130, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 4));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 4));
|
||||||
ui::TouchEvent release_id_4(
|
ui::TouchEvent release_id_4(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(120, 200), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(120, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 4));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 4));
|
||||||
|
|
||||||
// Three fingers down.
|
// Three fingers down.
|
||||||
generator_->Dispatch(&press_id_1);
|
generator_->Dispatch(&press_id_1);
|
||||||
|
@ -1404,9 +1404,9 @@ TEST_P(AppListPresenterDelegateTest, LongPressOutsideCloseAppList) {
|
|||||||
outside_point.Offset(0, -10);
|
outside_point.Offset(0, -10);
|
||||||
|
|
||||||
// Dispatch LONG_PRESS to AppListPresenterDelegate.
|
// Dispatch LONG_PRESS to AppListPresenterDelegate.
|
||||||
ui::TouchEvent long_press(
|
ui::TouchEvent long_press(ui::ET_GESTURE_LONG_PRESS, outside_point,
|
||||||
ui::ET_GESTURE_LONG_PRESS, outside_point, base::TimeTicks::Now(),
|
base::TimeTicks::Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH));
|
ui::PointerDetails(ui::EventPointerType::kTouch));
|
||||||
GetEventGenerator()->Dispatch(&long_press);
|
GetEventGenerator()->Dispatch(&long_press);
|
||||||
GetAppListTestHelper()->WaitUntilIdle();
|
GetAppListTestHelper()->WaitUntilIdle();
|
||||||
GetAppListTestHelper()->CheckVisibility(false);
|
GetAppListTestHelper()->CheckVisibility(false);
|
||||||
@ -1423,7 +1423,7 @@ TEST_P(AppListPresenterDelegateTest, TwoFingerTapOutsideCloseAppList) {
|
|||||||
// Dispatch TWO_FINGER_TAP to AppListPresenterDelegate.
|
// Dispatch TWO_FINGER_TAP to AppListPresenterDelegate.
|
||||||
ui::TouchEvent two_finger_tap(
|
ui::TouchEvent two_finger_tap(
|
||||||
ui::ET_GESTURE_TWO_FINGER_TAP, outside_point, base::TimeTicks::Now(),
|
ui::ET_GESTURE_TWO_FINGER_TAP, outside_point, base::TimeTicks::Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH));
|
ui::PointerDetails(ui::EventPointerType::kTouch));
|
||||||
GetEventGenerator()->Dispatch(&two_finger_tap);
|
GetEventGenerator()->Dispatch(&two_finger_tap);
|
||||||
GetAppListTestHelper()->WaitUntilIdle();
|
GetAppListTestHelper()->WaitUntilIdle();
|
||||||
GetAppListTestHelper()->CheckVisibility(false);
|
GetAppListTestHelper()->CheckVisibility(false);
|
||||||
|
@ -148,13 +148,11 @@ class TouchCalibratorControllerTest : public AshTestBase {
|
|||||||
|
|
||||||
ui::TouchEvent press_touch_event(
|
ui::TouchEvent press_touch_event(
|
||||||
ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 12, 1.0f,
|
ui::PointerDetails(ui::EventPointerType::kTouch, 12, 1.0f, 1.0f, 0.0f),
|
||||||
1.0f, 0.0f),
|
|
||||||
0);
|
0);
|
||||||
ui::TouchEvent release_touch_event(
|
ui::TouchEvent release_touch_event(
|
||||||
ui::ET_TOUCH_RELEASED, location, ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, location, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 12, 1.0f,
|
ui::PointerDetails(ui::EventPointerType::kTouch, 12, 1.0f, 1.0f, 0.0f),
|
||||||
1.0f, 0.0f),
|
|
||||||
0);
|
0);
|
||||||
|
|
||||||
press_touch_event.set_source_device_id(touch_device_id);
|
press_touch_event.set_source_device_id(touch_device_id);
|
||||||
|
@ -1146,28 +1146,24 @@ TEST_F(DragDropControllerTest, TouchDragDropCompletesOnFling) {
|
|||||||
gfx::Point end = start + gfx::Vector2d(drag_view->bounds().width() / 3, 0);
|
gfx::Point end = start + gfx::Vector2d(drag_view->bounds().width() / 3, 0);
|
||||||
|
|
||||||
base::TimeTicks timestamp = ui::EventTimeForNow();
|
base::TimeTicks timestamp = ui::EventTimeForNow();
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, start, timestamp,
|
||||||
ui::ET_TOUCH_PRESSED, start, timestamp,
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
generator.Dispatch(&press);
|
generator.Dispatch(&press);
|
||||||
|
|
||||||
DispatchGesture(ui::ET_GESTURE_LONG_PRESS, start);
|
DispatchGesture(ui::ET_GESTURE_LONG_PRESS, start);
|
||||||
UpdateDragData();
|
UpdateDragData();
|
||||||
timestamp += base::TimeDelta::FromMilliseconds(10);
|
timestamp += base::TimeDelta::FromMilliseconds(10);
|
||||||
ui::TouchEvent move1(
|
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, mid, timestamp,
|
||||||
ui::ET_TOUCH_MOVED, mid, timestamp,
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
generator.Dispatch(&move1);
|
generator.Dispatch(&move1);
|
||||||
// Doing two moves instead of one will guarantee to generate a fling at the
|
// Doing two moves instead of one will guarantee to generate a fling at the
|
||||||
// end.
|
// end.
|
||||||
timestamp += base::TimeDelta::FromMilliseconds(10);
|
timestamp += base::TimeDelta::FromMilliseconds(10);
|
||||||
ui::TouchEvent move2(
|
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, end, timestamp,
|
||||||
ui::ET_TOUCH_MOVED, end, timestamp,
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
generator.Dispatch(&move2);
|
generator.Dispatch(&move2);
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, end, timestamp,
|
||||||
ui::ET_TOUCH_RELEASED, end, timestamp,
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
generator.Dispatch(&release);
|
generator.Dispatch(&release);
|
||||||
|
|
||||||
EXPECT_TRUE(drag_drop_controller_->drag_start_received_);
|
EXPECT_TRUE(drag_drop_controller_->drag_start_received_);
|
||||||
|
@ -43,7 +43,7 @@ void SelectToSpeakEventHandler::SetSelectToSpeakStateSelecting(
|
|||||||
if (state_ != MOUSE_RELEASED)
|
if (state_ != MOUSE_RELEASED)
|
||||||
state_ = INACTIVE;
|
state_ = INACTIVE;
|
||||||
touch_id_ = ui::kPointerIdUnknown;
|
touch_id_ = ui::kPointerIdUnknown;
|
||||||
touch_type_ = ui::EventPointerType::POINTER_TYPE_UNKNOWN;
|
touch_type_ = ui::EventPointerType::kUnknown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ void SelectToSpeakEventHandler::OnTouchEvent(ui::TouchEvent* event) {
|
|||||||
state_ == CAPTURING_TOUCH_ONLY) {
|
state_ == CAPTURING_TOUCH_ONLY) {
|
||||||
state_ = INACTIVE;
|
state_ = INACTIVE;
|
||||||
touch_id_ = ui::kPointerIdUnknown;
|
touch_id_ = ui::kPointerIdUnknown;
|
||||||
touch_type_ = ui::EventPointerType::POINTER_TYPE_UNKNOWN;
|
touch_type_ = ui::EventPointerType::kUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a mouse event to send to the extension, describing the touch.
|
// Create a mouse event to send to the extension, describing the touch.
|
||||||
|
@ -99,7 +99,7 @@ class ASH_EXPORT SelectToSpeakEventHandler : public ui::EventHandler {
|
|||||||
|
|
||||||
ui::PointerId touch_id_ = ui::kPointerIdUnknown;
|
ui::PointerId touch_id_ = ui::kPointerIdUnknown;
|
||||||
|
|
||||||
ui::EventPointerType touch_type_ = ui::EventPointerType::POINTER_TYPE_UNKNOWN;
|
ui::EventPointerType touch_type_ = ui::EventPointerType::kUnknown;
|
||||||
|
|
||||||
// The delegate used to send key events to the Select-to-Speak extension.
|
// The delegate used to send key events to the Select-to-Speak extension.
|
||||||
SelectToSpeakEventHandlerDelegate* delegate_;
|
SelectToSpeakEventHandlerDelegate* delegate_;
|
||||||
|
@ -45,8 +45,7 @@ void FastInkPointerController::OnTouchEvent(ui::TouchEvent* event) {
|
|||||||
if (!enabled_)
|
if (!enabled_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event->pointer_details().pointer_type !=
|
if (event->pointer_details().pointer_type != ui::EventPointerType::kPen)
|
||||||
ui::EventPointerType::POINTER_TYPE_PEN)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event->type() != ui::ET_TOUCH_MOVED &&
|
if (event->type() != ui::ET_TOUCH_MOVED &&
|
||||||
|
@ -441,8 +441,7 @@ void MagnificationController::OnMouseEvent(ui::MouseEvent* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IsMagnified() && event->type() == ui::ET_MOUSE_MOVED &&
|
if (IsMagnified() && event->type() == ui::ET_MOUSE_MOVED &&
|
||||||
event->pointer_details().pointer_type !=
|
event->pointer_details().pointer_type != ui::EventPointerType::kPen) {
|
||||||
ui::EventPointerType::POINTER_TYPE_PEN) {
|
|
||||||
OnMouseMove(event->root_location());
|
OnMouseMove(event->root_location());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,10 +120,8 @@ class MagnificationControllerTest : public AshTestBase {
|
|||||||
// Performs a two-finger scroll gesture in the given |direction|.
|
// Performs a two-finger scroll gesture in the given |direction|.
|
||||||
void PerformTwoFingersScrollGesture(ScrollDirection direction) {
|
void PerformTwoFingersScrollGesture(ScrollDirection direction) {
|
||||||
base::TimeTicks time = base::TimeTicks::Now();
|
base::TimeTicks time = base::TimeTicks::Now();
|
||||||
ui::PointerDetails pointer_details1(
|
ui::PointerDetails pointer_details1(ui::EventPointerType::kTouch, 0);
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH, 0);
|
ui::PointerDetails pointer_details2(ui::EventPointerType::kTouch, 1);
|
||||||
ui::PointerDetails pointer_details2(
|
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH, 1);
|
|
||||||
|
|
||||||
// The offset by which the two fingers will move according to the given
|
// The offset by which the two fingers will move according to the given
|
||||||
// direction.
|
// direction.
|
||||||
@ -829,10 +827,8 @@ TEST_F(MagnificationControllerTest, PinchZoom) {
|
|||||||
ASSERT_EQ(2.0f, GetMagnificationController()->GetScale());
|
ASSERT_EQ(2.0f, GetMagnificationController()->GetScale());
|
||||||
|
|
||||||
base::TimeTicks time = base::TimeTicks::Now();
|
base::TimeTicks time = base::TimeTicks::Now();
|
||||||
ui::PointerDetails pointer_details1(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails pointer_details1(ui::EventPointerType::kTouch, 0);
|
||||||
0);
|
ui::PointerDetails pointer_details2(ui::EventPointerType::kTouch, 1);
|
||||||
ui::PointerDetails pointer_details2(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
|
||||||
1);
|
|
||||||
|
|
||||||
// Simulate pinch gesture.
|
// Simulate pinch gesture.
|
||||||
DispatchTouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(900, 10), time,
|
DispatchTouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(900, 10), time,
|
||||||
@ -1009,10 +1005,8 @@ TEST_F(MagnificationControllerTest, ZoomsIntoCenter) {
|
|||||||
GetMagnificationController()->GetViewportRect().CenterPoint());
|
GetMagnificationController()->GetViewportRect().CenterPoint());
|
||||||
|
|
||||||
base::TimeTicks time = base::TimeTicks::Now();
|
base::TimeTicks time = base::TimeTicks::Now();
|
||||||
ui::PointerDetails pointer_details1(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails pointer_details1(ui::EventPointerType::kTouch, 0);
|
||||||
0);
|
ui::PointerDetails pointer_details2(ui::EventPointerType::kTouch, 1);
|
||||||
ui::PointerDetails pointer_details2(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
|
||||||
1);
|
|
||||||
|
|
||||||
// Simulate pinch gesture with keeping center of bounding box of touches at
|
// Simulate pinch gesture with keeping center of bounding box of touches at
|
||||||
// (250, 250). Note that GestureProvider dispatches scroll gesture from this
|
// (250, 250). Note that GestureProvider dispatches scroll gesture from this
|
||||||
|
@ -265,7 +265,7 @@ void PartialMagnificationController::OnLocatedEvent(
|
|||||||
if (!is_enabled_)
|
if (!is_enabled_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pointer_details.pointer_type != ui::EventPointerType::POINTER_TYPE_PEN)
|
if (pointer_details.pointer_type != ui::EventPointerType::kPen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Compute the event location in screen space.
|
// Compute the event location in screen space.
|
||||||
|
@ -44,7 +44,7 @@ DownEventMetric2 FindCombination(int destination,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RecordUMA(ui::EventPointerType type, ui::EventTarget* event_target) {
|
void RecordUMA(ui::EventPointerType type, ui::EventTarget* event_target) {
|
||||||
DCHECK_NE(type, ui::EventPointerType::POINTER_TYPE_UNKNOWN);
|
DCHECK_NE(type, ui::EventPointerType::kUnknown);
|
||||||
views::Widget* target = views::Widget::GetTopLevelWidgetForNativeView(
|
views::Widget* target = views::Widget::GetTopLevelWidgetForNativeView(
|
||||||
static_cast<aura::Window*>(event_target));
|
static_cast<aura::Window*>(event_target));
|
||||||
DownEventFormFactor form_factor = DownEventFormFactor::kClamshell;
|
DownEventFormFactor form_factor = DownEventFormFactor::kClamshell;
|
||||||
@ -61,18 +61,18 @@ void RecordUMA(ui::EventPointerType type, ui::EventTarget* event_target) {
|
|||||||
|
|
||||||
DownEventSource input_type = DownEventSource::kUnknown;
|
DownEventSource input_type = DownEventSource::kUnknown;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ui::EventPointerType::POINTER_TYPE_UNKNOWN:
|
case ui::EventPointerType::kUnknown:
|
||||||
return;
|
return;
|
||||||
case ui::EventPointerType::POINTER_TYPE_MOUSE:
|
case ui::EventPointerType::kMouse:
|
||||||
input_type = DownEventSource::kMouse;
|
input_type = DownEventSource::kMouse;
|
||||||
break;
|
break;
|
||||||
case ui::EventPointerType::POINTER_TYPE_PEN:
|
case ui::EventPointerType::kPen:
|
||||||
input_type = DownEventSource::kStylus;
|
input_type = DownEventSource::kStylus;
|
||||||
break;
|
break;
|
||||||
case ui::EventPointerType::POINTER_TYPE_TOUCH:
|
case ui::EventPointerType::kTouch:
|
||||||
input_type = DownEventSource::kTouch;
|
input_type = DownEventSource::kTouch;
|
||||||
break;
|
break;
|
||||||
case ui::EventPointerType::POINTER_TYPE_ERASER:
|
case ui::EventPointerType::kEraser:
|
||||||
input_type = DownEventSource::kStylus;
|
input_type = DownEventSource::kStylus;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ void PointerMetricsRecorderTest::CreateDownEvent(
|
|||||||
test_api.SetDisplayRotation(rotation,
|
test_api.SetDisplayRotation(rotation,
|
||||||
display::Display::RotationSource::ACTIVE);
|
display::Display::RotationSource::ACTIVE);
|
||||||
}
|
}
|
||||||
if (pointer_type == ui::EventPointerType::POINTER_TYPE_MOUSE) {
|
if (pointer_type == ui::EventPointerType::kMouse) {
|
||||||
ui::MouseEvent mouse_down(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
|
ui::MouseEvent mouse_down(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
|
||||||
base::TimeTicks(), 0, 0);
|
base::TimeTicks(), 0, 0);
|
||||||
ui::Event::DispatcherApi(&mouse_down).set_target(window);
|
ui::Event::DispatcherApi(&mouse_down).set_target(window);
|
||||||
@ -126,282 +126,282 @@ TEST_F(PointerMetricsRecorderTest, DownEventPerCombination) {
|
|||||||
display::test::ScopedSetInternalDisplayId set_internal(display_manager,
|
display::test::ScopedSetInternalDisplayId set_internal(display_manager,
|
||||||
display_id);
|
display_id);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::NON_APP);
|
AppType::NON_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kNonAppMouseClamshell), 1);
|
static_cast<int>(DownEventMetric2::kNonAppMouseClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse,
|
||||||
DownEventFormFactor::kTabletModeLandscape, AppType::NON_APP);
|
DownEventFormFactor::kTabletModeLandscape, AppType::NON_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kNonAppMouseTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kNonAppMouseTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse,
|
||||||
DownEventFormFactor::kTabletModePortrait, AppType::NON_APP);
|
DownEventFormFactor::kTabletModePortrait, AppType::NON_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kNonAppMouseTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kNonAppMouseTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::NON_APP);
|
AppType::NON_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kNonAppStylusClamshell), 1);
|
static_cast<int>(DownEventMetric2::kNonAppStylusClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen,
|
||||||
DownEventFormFactor::kTabletModeLandscape, AppType::NON_APP);
|
DownEventFormFactor::kTabletModeLandscape, AppType::NON_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kNonAppStylusTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kNonAppStylusTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen,
|
||||||
DownEventFormFactor::kTabletModePortrait, AppType::NON_APP);
|
DownEventFormFactor::kTabletModePortrait, AppType::NON_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kNonAppStylusTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kNonAppStylusTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::NON_APP);
|
AppType::NON_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kNonAppStylusClamshell), 1);
|
static_cast<int>(DownEventMetric2::kNonAppStylusClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch,
|
||||||
DownEventFormFactor::kTabletModeLandscape, AppType::NON_APP);
|
DownEventFormFactor::kTabletModeLandscape, AppType::NON_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kNonAppStylusTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kNonAppStylusTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch,
|
||||||
DownEventFormFactor::kTabletModePortrait, AppType::NON_APP);
|
DownEventFormFactor::kTabletModePortrait, AppType::NON_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kNonAppStylusTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kNonAppStylusTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::BROWSER);
|
AppType::BROWSER);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kBrowserMouseClamshell), 1);
|
static_cast<int>(DownEventMetric2::kBrowserMouseClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse,
|
||||||
DownEventFormFactor::kTabletModeLandscape, AppType::BROWSER);
|
DownEventFormFactor::kTabletModeLandscape, AppType::BROWSER);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kBrowserMouseTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kBrowserMouseTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse,
|
||||||
DownEventFormFactor::kTabletModePortrait, AppType::BROWSER);
|
DownEventFormFactor::kTabletModePortrait, AppType::BROWSER);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kBrowserMouseTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kBrowserMouseTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::BROWSER);
|
AppType::BROWSER);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kBrowserStylusClamshell), 1);
|
static_cast<int>(DownEventMetric2::kBrowserStylusClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen,
|
||||||
DownEventFormFactor::kTabletModeLandscape, AppType::BROWSER);
|
DownEventFormFactor::kTabletModeLandscape, AppType::BROWSER);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kBrowserStylusTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kBrowserStylusTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen,
|
||||||
DownEventFormFactor::kTabletModePortrait, AppType::BROWSER);
|
DownEventFormFactor::kTabletModePortrait, AppType::BROWSER);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kBrowserStylusTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kBrowserStylusTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::BROWSER);
|
AppType::BROWSER);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kBrowserStylusClamshell), 1);
|
static_cast<int>(DownEventMetric2::kBrowserStylusClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch,
|
||||||
DownEventFormFactor::kTabletModeLandscape, AppType::BROWSER);
|
DownEventFormFactor::kTabletModeLandscape, AppType::BROWSER);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kBrowserStylusTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kBrowserStylusTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch,
|
||||||
DownEventFormFactor::kTabletModePortrait, AppType::BROWSER);
|
DownEventFormFactor::kTabletModePortrait, AppType::BROWSER);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kBrowserStylusTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kBrowserStylusTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::CHROME_APP);
|
AppType::CHROME_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kChromeAppMouseClamshell), 1);
|
static_cast<int>(DownEventMetric2::kChromeAppMouseClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse,
|
||||||
DownEventFormFactor::kTabletModeLandscape,
|
DownEventFormFactor::kTabletModeLandscape,
|
||||||
AppType::CHROME_APP);
|
AppType::CHROME_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kChromeAppMouseTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kChromeAppMouseTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse,
|
||||||
DownEventFormFactor::kTabletModePortrait,
|
DownEventFormFactor::kTabletModePortrait,
|
||||||
AppType::CHROME_APP);
|
AppType::CHROME_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kChromeAppMouseTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kChromeAppMouseTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::CHROME_APP);
|
AppType::CHROME_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kChromeAppStylusClamshell), 1);
|
static_cast<int>(DownEventMetric2::kChromeAppStylusClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen,
|
||||||
DownEventFormFactor::kTabletModeLandscape,
|
DownEventFormFactor::kTabletModeLandscape,
|
||||||
AppType::CHROME_APP);
|
AppType::CHROME_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen,
|
||||||
DownEventFormFactor::kTabletModePortrait,
|
DownEventFormFactor::kTabletModePortrait,
|
||||||
AppType::CHROME_APP);
|
AppType::CHROME_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::CHROME_APP);
|
AppType::CHROME_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kChromeAppStylusClamshell), 1);
|
static_cast<int>(DownEventMetric2::kChromeAppStylusClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch,
|
||||||
DownEventFormFactor::kTabletModeLandscape,
|
DownEventFormFactor::kTabletModeLandscape,
|
||||||
AppType::CHROME_APP);
|
AppType::CHROME_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch,
|
||||||
DownEventFormFactor::kTabletModePortrait,
|
DownEventFormFactor::kTabletModePortrait,
|
||||||
AppType::CHROME_APP);
|
AppType::CHROME_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::ARC_APP);
|
AppType::ARC_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kArcAppMouseClamshell), 1);
|
static_cast<int>(DownEventMetric2::kArcAppMouseClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse,
|
||||||
DownEventFormFactor::kTabletModeLandscape, AppType::ARC_APP);
|
DownEventFormFactor::kTabletModeLandscape, AppType::ARC_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kArcAppMouseTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kArcAppMouseTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse,
|
||||||
DownEventFormFactor::kTabletModePortrait, AppType::ARC_APP);
|
DownEventFormFactor::kTabletModePortrait, AppType::ARC_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kArcAppMouseTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kArcAppMouseTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::ARC_APP);
|
AppType::ARC_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kArcAppStylusClamshell), 1);
|
static_cast<int>(DownEventMetric2::kArcAppStylusClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen,
|
||||||
DownEventFormFactor::kTabletModeLandscape, AppType::ARC_APP);
|
DownEventFormFactor::kTabletModeLandscape, AppType::ARC_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kArcAppStylusTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kArcAppStylusTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen,
|
||||||
DownEventFormFactor::kTabletModePortrait, AppType::ARC_APP);
|
DownEventFormFactor::kTabletModePortrait, AppType::ARC_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kArcAppStylusTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kArcAppStylusTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::ARC_APP);
|
AppType::ARC_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kArcAppStylusClamshell), 1);
|
static_cast<int>(DownEventMetric2::kArcAppStylusClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch,
|
||||||
DownEventFormFactor::kTabletModeLandscape, AppType::ARC_APP);
|
DownEventFormFactor::kTabletModeLandscape, AppType::ARC_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kArcAppStylusTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kArcAppStylusTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch,
|
||||||
DownEventFormFactor::kTabletModePortrait, AppType::ARC_APP);
|
DownEventFormFactor::kTabletModePortrait, AppType::ARC_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kArcAppStylusTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kArcAppStylusTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::CROSTINI_APP);
|
AppType::CROSTINI_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kCrostiniAppMouseClamshell), 1);
|
static_cast<int>(DownEventMetric2::kCrostiniAppMouseClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse,
|
||||||
DownEventFormFactor::kTabletModeLandscape,
|
DownEventFormFactor::kTabletModeLandscape,
|
||||||
AppType::CROSTINI_APP);
|
AppType::CROSTINI_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kCrostiniAppMouseTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kCrostiniAppMouseTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_MOUSE,
|
CreateDownEvent(ui::EventPointerType::kMouse,
|
||||||
DownEventFormFactor::kTabletModePortrait,
|
DownEventFormFactor::kTabletModePortrait,
|
||||||
AppType::CROSTINI_APP);
|
AppType::CROSTINI_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kCrostiniAppMouseTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kCrostiniAppMouseTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::CROSTINI_APP);
|
AppType::CROSTINI_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kCrostiniAppStylusClamshell), 1);
|
static_cast<int>(DownEventMetric2::kCrostiniAppStylusClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen,
|
||||||
DownEventFormFactor::kTabletModeLandscape,
|
DownEventFormFactor::kTabletModeLandscape,
|
||||||
AppType::CROSTINI_APP);
|
AppType::CROSTINI_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_PEN,
|
CreateDownEvent(ui::EventPointerType::kPen,
|
||||||
DownEventFormFactor::kTabletModePortrait,
|
DownEventFormFactor::kTabletModePortrait,
|
||||||
AppType::CROSTINI_APP);
|
AppType::CROSTINI_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletPortrait), 1);
|
static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletPortrait), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell,
|
||||||
DownEventFormFactor::kClamshell, AppType::CROSTINI_APP);
|
AppType::CROSTINI_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kCrostiniAppStylusClamshell), 1);
|
static_cast<int>(DownEventMetric2::kCrostiniAppStylusClamshell), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch,
|
||||||
DownEventFormFactor::kTabletModeLandscape,
|
DownEventFormFactor::kTabletModeLandscape,
|
||||||
AppType::CROSTINI_APP);
|
AppType::CROSTINI_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
kCombinationHistogramName,
|
kCombinationHistogramName,
|
||||||
static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletLandscape), 1);
|
static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletLandscape), 1);
|
||||||
|
|
||||||
CreateDownEvent(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
CreateDownEvent(ui::EventPointerType::kTouch,
|
||||||
DownEventFormFactor::kTabletModePortrait,
|
DownEventFormFactor::kTabletModePortrait,
|
||||||
AppType::CROSTINI_APP);
|
AppType::CROSTINI_APP);
|
||||||
histogram_tester_->ExpectBucketCount(
|
histogram_tester_->ExpectBucketCount(
|
||||||
|
@ -164,7 +164,7 @@ TEST_F(ShelfButtonPressedMetricTrackerTest,
|
|||||||
Launcher_ButtonPressed_MouseIsRecordedWhenIconActivatedByTouch) {
|
Launcher_ButtonPressed_MouseIsRecordedWhenIconActivatedByTouch) {
|
||||||
const ui::TouchEvent touch_event(
|
const ui::TouchEvent touch_event(
|
||||||
ui::ET_GESTURE_TAP, gfx::Point(), base::TimeTicks(),
|
ui::ET_GESTURE_TAP, gfx::Point(), base::TimeTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
base::UserActionTester user_action_tester;
|
base::UserActionTester user_action_tester;
|
||||||
ButtonPressed(touch_event);
|
ButtonPressed(touch_event);
|
||||||
|
@ -257,9 +257,9 @@ TEST_F(ShelfWidgetTest, HiddenShelfHitTestTouch) {
|
|||||||
// should not find the shelf as the target.
|
// should not find the shelf as the target.
|
||||||
{
|
{
|
||||||
gfx::Point event_location(20, shelf_bounds.y() - 1);
|
gfx::Point event_location(20, shelf_bounds.y() - 1);
|
||||||
ui::TouchEvent touch(
|
ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, event_location,
|
||||||
ui::ET_TOUCH_PRESSED, event_location, ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
EXPECT_NE(shelf_widget->GetNativeWindow(),
|
EXPECT_NE(shelf_widget->GetNativeWindow(),
|
||||||
targeter->FindTargetForEvent(root, &touch));
|
targeter->FindTargetForEvent(root, &touch));
|
||||||
}
|
}
|
||||||
@ -276,9 +276,9 @@ TEST_F(ShelfWidgetTest, HiddenShelfHitTestTouch) {
|
|||||||
// shelf as the target.
|
// shelf as the target.
|
||||||
{
|
{
|
||||||
gfx::Point event_location(20, shelf_bounds.y() - 1);
|
gfx::Point event_location(20, shelf_bounds.y() - 1);
|
||||||
ui::TouchEvent touch(
|
ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, event_location,
|
||||||
ui::ET_TOUCH_PRESSED, event_location, ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
EXPECT_EQ(shelf_widget->GetNativeWindow(),
|
EXPECT_EQ(shelf_widget->GetNativeWindow(),
|
||||||
targeter->FindTargetForEvent(root, &touch));
|
targeter->FindTargetForEvent(root, &touch));
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,7 @@ class StylusEventHandler : public ui::EventHandler {
|
|||||||
|
|
||||||
// ui::EventHandler:
|
// ui::EventHandler:
|
||||||
void OnTouchEvent(ui::TouchEvent* event) override {
|
void OnTouchEvent(ui::TouchEvent* event) override {
|
||||||
if (event->pointer_details().pointer_type ==
|
if (event->pointer_details().pointer_type == ui::EventPointerType::kPen) {
|
||||||
ui::EventPointerType::POINTER_TYPE_PEN) {
|
|
||||||
palette_tray_->OnStylusEvent(*event);
|
palette_tray_->OnStylusEvent(*event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,8 +106,7 @@ void MetalayerMode::OnTouchEvent(ui::TouchEvent* event) {
|
|||||||
if (enabled())
|
if (enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event->pointer_details().pointer_type !=
|
if (event->pointer_details().pointer_type != ui::EventPointerType::kPen)
|
||||||
ui::EventPointerType::POINTER_TYPE_PEN)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event->type() == ui::ET_TOUCH_RELEASED) {
|
if (event->type() == ui::ET_TOUCH_RELEASED) {
|
||||||
|
@ -106,9 +106,9 @@ bool SystemTrayTestApi::Is24HourClock() {
|
|||||||
void SystemTrayTestApi::TapSelectToSpeakTray() {
|
void SystemTrayTestApi::TapSelectToSpeakTray() {
|
||||||
// The Select-to-Speak tray doesn't actually use the event, so construct
|
// The Select-to-Speak tray doesn't actually use the event, so construct
|
||||||
// a bare bones event to perform the action.
|
// a bare bones event to perform the action.
|
||||||
ui::TouchEvent event(
|
ui::TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(), base::TimeTicks::Now(),
|
base::TimeTicks::Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH), 0);
|
ui::PointerDetails(ui::EventPointerType::kTouch), 0);
|
||||||
StatusAreaWidget* status_area_widget =
|
StatusAreaWidget* status_area_widget =
|
||||||
RootWindowController::ForWindow(GetTray()->GetWidget()->GetNativeWindow())
|
RootWindowController::ForWindow(GetTray()->GetWidget()->GetNativeWindow())
|
||||||
->GetStatusAreaWidget();
|
->GetStatusAreaWidget();
|
||||||
|
@ -285,7 +285,7 @@ class TouchHudProjectionTest : public TouchHudTestBase {
|
|||||||
int touch_id) {
|
int touch_id) {
|
||||||
ui::TouchEvent event(
|
ui::TouchEvent event(
|
||||||
type, location, event_time,
|
type, location, event_time,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, touch_id));
|
ui::PointerDetails(ui::EventPointerType::kTouch, touch_id));
|
||||||
GetInternalTouchHudProjection()->OnTouchEvent(&event);
|
GetInternalTouchHudProjection()->OnTouchEvent(&event);
|
||||||
|
|
||||||
// Advance time for next event.
|
// Advance time for next event.
|
||||||
|
@ -441,7 +441,7 @@ void ScreenshotController::SetSelectedWindow(aura::Window* selected) {
|
|||||||
bool ScreenshotController::ShouldProcessEvent(
|
bool ScreenshotController::ShouldProcessEvent(
|
||||||
const ui::PointerDetails& pointer_details) const {
|
const ui::PointerDetails& pointer_details) const {
|
||||||
return !pen_events_only_ ||
|
return !pen_events_only_ ||
|
||||||
pointer_details.pointer_type == ui::EventPointerType::POINTER_TYPE_PEN;
|
pointer_details.pointer_type == ui::EventPointerType::kPen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenshotController::OnKeyEvent(ui::KeyEvent* event) {
|
void ScreenshotController::OnKeyEvent(ui::KeyEvent* event) {
|
||||||
|
@ -175,10 +175,8 @@ void BackGestureEventHandler::OnGestureEvent(ui::GestureEvent* event) {}
|
|||||||
void BackGestureEventHandler::OnTouchEvent(ui::TouchEvent* event) {
|
void BackGestureEventHandler::OnTouchEvent(ui::TouchEvent* event) {
|
||||||
// Do not handle PEN and ERASER events for back gesture. PEN events can come
|
// Do not handle PEN and ERASER events for back gesture. PEN events can come
|
||||||
// from stylus device.
|
// from stylus device.
|
||||||
if (event->pointer_details().pointer_type ==
|
if (event->pointer_details().pointer_type == ui::EventPointerType::kPen ||
|
||||||
ui::EventPointerType::POINTER_TYPE_PEN ||
|
event->pointer_details().pointer_type == ui::EventPointerType::kEraser) {
|
||||||
event->pointer_details().pointer_type ==
|
|
||||||
ui::EventPointerType::POINTER_TYPE_ERASER) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,11 +90,11 @@ class BackGestureEventHandlerTest : public AshTestBase {
|
|||||||
|
|
||||||
// Send touch event with |type| to the toplevel window event handler.
|
// Send touch event with |type| to the toplevel window event handler.
|
||||||
void SendTouchEvent(const gfx::Point& position, ui::EventType type) {
|
void SendTouchEvent(const gfx::Point& position, ui::EventType type) {
|
||||||
ui::TouchEvent event = ui::TouchEvent(
|
ui::TouchEvent event =
|
||||||
type, position, base::TimeTicks::Now(),
|
ui::TouchEvent(type, position, base::TimeTicks::Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/*pointer_id=*/5, /*radius_x=*/5.0f,
|
/*pointer_id=*/5, /*radius_x=*/5.0f,
|
||||||
/*radius_y=*/5.0, /*force=*/1.0f));
|
/*radius_y=*/5.0, /*force=*/1.0f));
|
||||||
ui::Event::DispatcherApi(&event).set_target(top_window_.get());
|
ui::Event::DispatcherApi(&event).set_target(top_window_.get());
|
||||||
Shell::Get()->back_gesture_event_handler()->OnTouchEvent(&event);
|
Shell::Get()->back_gesture_event_handler()->OnTouchEvent(&event);
|
||||||
}
|
}
|
||||||
|
@ -815,9 +815,9 @@ TEST_F(ImmersiveFullscreenControllerTest, EventsDoNotLeakToWindowUnderneath) {
|
|||||||
EXPECT_EQ(behind->GetBoundsInScreen().y(), window()->GetBoundsInScreen().y());
|
EXPECT_EQ(behind->GetBoundsInScreen().y(), window()->GetBoundsInScreen().y());
|
||||||
int top = behind->GetBoundsInScreen().y();
|
int top = behind->GetBoundsInScreen().y();
|
||||||
|
|
||||||
ui::TouchEvent touch(
|
ui::TouchEvent touch(ui::ET_TOUCH_MOVED, gfx::Point(10, top),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(10, top), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
aura::Window* root = window()->GetRootWindow();
|
aura::Window* root = window()->GetRootWindow();
|
||||||
ui::EventTargeter* targeter =
|
ui::EventTargeter* targeter =
|
||||||
root->GetHost()->dispatcher()->GetDefaultEventTargeter();
|
root->GetHost()->dispatcher()->GetDefaultEventTargeter();
|
||||||
@ -828,9 +828,9 @@ TEST_F(ImmersiveFullscreenControllerTest, EventsDoNotLeakToWindowUnderneath) {
|
|||||||
// Make sure the windows are still aligned on top.
|
// Make sure the windows are still aligned on top.
|
||||||
EXPECT_EQ(behind->GetBoundsInScreen().y(), window()->GetBoundsInScreen().y());
|
EXPECT_EQ(behind->GetBoundsInScreen().y(), window()->GetBoundsInScreen().y());
|
||||||
top = behind->GetBoundsInScreen().y();
|
top = behind->GetBoundsInScreen().y();
|
||||||
ui::TouchEvent touch2(
|
ui::TouchEvent touch2(ui::ET_TOUCH_MOVED, gfx::Point(10, top),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(10, top), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
// The event should still be targeted to window().
|
// The event should still be targeted to window().
|
||||||
EXPECT_EQ(window(), targeter->FindTargetForEvent(root, &touch2));
|
EXPECT_EQ(window(), targeter->FindTargetForEvent(root, &touch2));
|
||||||
}
|
}
|
||||||
|
@ -3114,7 +3114,7 @@ class TabletModeOverviewSessionTest : public OverviewSessionTest {
|
|||||||
ui::ET_GESTURE_LONG_PRESS,
|
ui::ET_GESTURE_LONG_PRESS,
|
||||||
gfx::ToRoundedPoint(item->target_bounds().CenterPoint()),
|
gfx::ToRoundedPoint(item->target_bounds().CenterPoint()),
|
||||||
base::TimeTicks::Now(),
|
base::TimeTicks::Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH));
|
ui::PointerDetails(ui::EventPointerType::kTouch));
|
||||||
GetEventGenerator()->Dispatch(&long_press);
|
GetEventGenerator()->Dispatch(&long_press);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,9 +177,8 @@ TEST_F(WindowManagerTest, Focus) {
|
|||||||
// Touch on a sub-window (w122) to focus it.
|
// Touch on a sub-window (w122) to focus it.
|
||||||
gfx::Point click_point = w122->bounds().CenterPoint();
|
gfx::Point click_point = w122->bounds().CenterPoint();
|
||||||
aura::Window::ConvertPointToTarget(w122->parent(), root_window, &click_point);
|
aura::Window::ConvertPointToTarget(w122->parent(), root_window, &click_point);
|
||||||
ui::TouchEvent touchev(
|
ui::TouchEvent touchev(ui::ET_TOUCH_PRESSED, click_point, getTime(),
|
||||||
ui::ET_TOUCH_PRESSED, click_point, getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
details = sink->OnEventFromSource(&touchev);
|
details = sink->OnEventFromSource(&touchev);
|
||||||
ASSERT_FALSE(details.dispatcher_destroyed);
|
ASSERT_FALSE(details.dispatcher_destroyed);
|
||||||
focus_client = aura::client::GetFocusClient(w122.get());
|
focus_client = aura::client::GetFocusClient(w122.get());
|
||||||
@ -434,9 +433,8 @@ TEST_F(WindowManagerTest, ActivateOnTouch) {
|
|||||||
// Touch window2.
|
// Touch window2.
|
||||||
gfx::Point press_point = w2->bounds().CenterPoint();
|
gfx::Point press_point = w2->bounds().CenterPoint();
|
||||||
aura::Window::ConvertPointToTarget(w2->parent(), root_window, &press_point);
|
aura::Window::ConvertPointToTarget(w2->parent(), root_window, &press_point);
|
||||||
ui::TouchEvent touchev1(
|
ui::TouchEvent touchev1(ui::ET_TOUCH_PRESSED, press_point, getTime(),
|
||||||
ui::ET_TOUCH_PRESSED, press_point, getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
|
|
||||||
ui::EventSink* sink = root_window->GetHost()->event_sink();
|
ui::EventSink* sink = root_window->GetHost()->event_sink();
|
||||||
ui::EventDispatchDetails details = sink->OnEventFromSource(&touchev1);
|
ui::EventDispatchDetails details = sink->OnEventFromSource(&touchev1);
|
||||||
@ -456,9 +454,8 @@ TEST_F(WindowManagerTest, ActivateOnTouch) {
|
|||||||
press_point = w1->bounds().CenterPoint();
|
press_point = w1->bounds().CenterPoint();
|
||||||
aura::Window::ConvertPointToTarget(w1->parent(), root_window, &press_point);
|
aura::Window::ConvertPointToTarget(w1->parent(), root_window, &press_point);
|
||||||
d1.set_activate(false);
|
d1.set_activate(false);
|
||||||
ui::TouchEvent touchev2(
|
ui::TouchEvent touchev2(ui::ET_TOUCH_PRESSED, press_point, getTime(),
|
||||||
ui::ET_TOUCH_PRESSED, press_point, getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
details = sink->OnEventFromSource(&touchev2);
|
details = sink->OnEventFromSource(&touchev2);
|
||||||
ASSERT_FALSE(details.dispatcher_destroyed);
|
ASSERT_FALSE(details.dispatcher_destroyed);
|
||||||
|
|
||||||
|
@ -1380,9 +1380,9 @@ TEST_F(WorkspaceControllerTest, WindowEdgeHitTest) {
|
|||||||
ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse);
|
ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse);
|
||||||
EXPECT_EQ(expected_target, target);
|
EXPECT_EQ(expected_target, target);
|
||||||
|
|
||||||
ui::TouchEvent touch(
|
ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location,
|
||||||
ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
target = targeter->FindTargetForEvent(root, &touch);
|
target = targeter->FindTargetForEvent(root, &touch);
|
||||||
EXPECT_EQ(expected_target, target);
|
EXPECT_EQ(expected_target, target);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ IN_PROC_BROWSER_TEST_F(TouchExplorationTest, MAYBE_NoRewritingEventsWhenOff) {
|
|||||||
base::TimeTicks initial_time = Now();
|
base::TimeTicks initial_time = Now();
|
||||||
ui::TouchEvent initial_press(
|
ui::TouchEvent initial_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(99, 200), initial_time,
|
ui::ET_TOUCH_PRESSED, gfx::Point(99, 200), initial_time,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator.Dispatch(&initial_press);
|
generator.Dispatch(&initial_press);
|
||||||
|
|
||||||
// Since the touch exploration controller doesn't know if the user is
|
// Since the touch exploration controller doesn't know if the user is
|
||||||
@ -97,7 +97,7 @@ IN_PROC_BROWSER_TEST_F(TouchExplorationTest, MAYBE_NoRewritingEventsWhenOff) {
|
|||||||
ui::ET_TOUCH_MOVED, gfx::Point(100, 200),
|
ui::ET_TOUCH_MOVED, gfx::Point(100, 200),
|
||||||
initial_time + gesture_detector_config_.double_tap_timeout +
|
initial_time + gesture_detector_config_.double_tap_timeout +
|
||||||
base::TimeDelta::FromMilliseconds(1),
|
base::TimeDelta::FromMilliseconds(1),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator.Dispatch(&touch_time_advance);
|
generator.Dispatch(&touch_time_advance);
|
||||||
|
|
||||||
EXPECT_EQ(0, event_handler_->num_mouse_events());
|
EXPECT_EQ(0, event_handler_->num_mouse_events());
|
||||||
@ -112,13 +112,13 @@ IN_PROC_BROWSER_TEST_F(TouchExplorationTest, MAYBE_NoRewritingEventsWhenOff) {
|
|||||||
initial_time = Now();
|
initial_time = Now();
|
||||||
ui::TouchEvent second_initial_press(
|
ui::TouchEvent second_initial_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(499, 600), initial_time,
|
ui::ET_TOUCH_PRESSED, gfx::Point(499, 600), initial_time,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
generator.Dispatch(&second_initial_press);
|
generator.Dispatch(&second_initial_press);
|
||||||
ui::TouchEvent second_touch_time_advance(
|
ui::TouchEvent second_touch_time_advance(
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(500, 600),
|
ui::ET_TOUCH_MOVED, gfx::Point(500, 600),
|
||||||
initial_time + gesture_detector_config_.double_tap_timeout +
|
initial_time + gesture_detector_config_.double_tap_timeout +
|
||||||
base::TimeDelta::FromMilliseconds(1),
|
base::TimeDelta::FromMilliseconds(1),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
generator.Dispatch(&second_touch_time_advance);
|
generator.Dispatch(&second_touch_time_advance);
|
||||||
EXPECT_EQ(0, event_handler_->num_mouse_events());
|
EXPECT_EQ(0, event_handler_->num_mouse_events());
|
||||||
EXPECT_EQ(2, event_handler_->num_touch_events());
|
EXPECT_EQ(2, event_handler_->num_touch_events());
|
||||||
@ -134,7 +134,7 @@ IN_PROC_BROWSER_TEST_F(TouchExplorationTest, DISABLED_RewritesEventsWhenOn) {
|
|||||||
base::TimeTicks initial_time = Now();
|
base::TimeTicks initial_time = Now();
|
||||||
ui::TouchEvent initial_press(
|
ui::TouchEvent initial_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), initial_time,
|
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), initial_time,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator.Dispatch(&initial_press);
|
generator.Dispatch(&initial_press);
|
||||||
|
|
||||||
// Since the touch exploration controller doesn't know if the user is
|
// Since the touch exploration controller doesn't know if the user is
|
||||||
@ -146,7 +146,7 @@ IN_PROC_BROWSER_TEST_F(TouchExplorationTest, DISABLED_RewritesEventsWhenOn) {
|
|||||||
ui::ET_TOUCH_MOVED, gfx::Point(100, 200),
|
ui::ET_TOUCH_MOVED, gfx::Point(100, 200),
|
||||||
initial_time + gesture_detector_config_.double_tap_timeout +
|
initial_time + gesture_detector_config_.double_tap_timeout +
|
||||||
base::TimeDelta::FromMilliseconds(1),
|
base::TimeDelta::FromMilliseconds(1),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator.Dispatch(&touch_time_advance);
|
generator.Dispatch(&touch_time_advance);
|
||||||
|
|
||||||
// Number of mouse events may be greater than 1 because of ET_MOUSE_ENTERED.
|
// Number of mouse events may be greater than 1 because of ET_MOUSE_ENTERED.
|
||||||
@ -157,13 +157,13 @@ IN_PROC_BROWSER_TEST_F(TouchExplorationTest, DISABLED_RewritesEventsWhenOn) {
|
|||||||
initial_time = Now();
|
initial_time = Now();
|
||||||
ui::TouchEvent second_initial_press(
|
ui::TouchEvent second_initial_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(500, 600), initial_time,
|
ui::ET_TOUCH_PRESSED, gfx::Point(500, 600), initial_time,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
generator.Dispatch(&second_initial_press);
|
generator.Dispatch(&second_initial_press);
|
||||||
ui::TouchEvent second_touch_time_advance(
|
ui::TouchEvent second_touch_time_advance(
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(500, 600),
|
ui::ET_TOUCH_MOVED, gfx::Point(500, 600),
|
||||||
initial_time + gesture_detector_config_.double_tap_timeout +
|
initial_time + gesture_detector_config_.double_tap_timeout +
|
||||||
base::TimeDelta::FromMilliseconds(1),
|
base::TimeDelta::FromMilliseconds(1),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
generator.Dispatch(&second_touch_time_advance);
|
generator.Dispatch(&second_touch_time_advance);
|
||||||
EXPECT_GT(event_handler_->num_mouse_events(), 0);
|
EXPECT_GT(event_handler_->num_mouse_events(), 0);
|
||||||
EXPECT_EQ(1, event_handler_->num_touch_events());
|
EXPECT_EQ(1, event_handler_->num_touch_events());
|
||||||
@ -177,7 +177,7 @@ IN_PROC_BROWSER_TEST_F(TouchExplorationTest, DISABLED_RewritesEventsWhenOn) {
|
|||||||
ui::ET_TOUCH_RELEASED, gfx::Point(500, 600),
|
ui::ET_TOUCH_RELEASED, gfx::Point(500, 600),
|
||||||
initial_time + gesture_detector_config_.double_tap_timeout +
|
initial_time + gesture_detector_config_.double_tap_timeout +
|
||||||
base::TimeDelta::FromMilliseconds(1),
|
base::TimeDelta::FromMilliseconds(1),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
generator.Dispatch(&release_second_touch);
|
generator.Dispatch(&release_second_touch);
|
||||||
EXPECT_GT(event_handler_->num_mouse_events(), 0);
|
EXPECT_GT(event_handler_->num_mouse_events(), 0);
|
||||||
EXPECT_EQ(1, event_handler_->num_touch_events());
|
EXPECT_EQ(1, event_handler_->num_touch_events());
|
||||||
@ -203,7 +203,7 @@ IN_PROC_BROWSER_TEST_F(TouchExplorationTest, DISABLED_SplitTapExplore) {
|
|||||||
base::TimeTicks initial_time = Now();
|
base::TimeTicks initial_time = Now();
|
||||||
ui::TouchEvent initial_press(
|
ui::TouchEvent initial_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), initial_time,
|
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), initial_time,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator.Dispatch(&initial_press);
|
generator.Dispatch(&initial_press);
|
||||||
EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
|
EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
|
||||||
EXPECT_TRUE(cursor_client->IsCursorVisible());
|
EXPECT_TRUE(cursor_client->IsCursorVisible());
|
||||||
@ -214,7 +214,7 @@ IN_PROC_BROWSER_TEST_F(TouchExplorationTest, DISABLED_SplitTapExplore) {
|
|||||||
ui::ET_TOUCH_MOVED, gfx::Point(100, 200),
|
ui::ET_TOUCH_MOVED, gfx::Point(100, 200),
|
||||||
initial_time + gesture_detector_config_.double_tap_timeout +
|
initial_time + gesture_detector_config_.double_tap_timeout +
|
||||||
base::TimeDelta::FromMilliseconds(1),
|
base::TimeDelta::FromMilliseconds(1),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator.Dispatch(&touch_time_advance);
|
generator.Dispatch(&touch_time_advance);
|
||||||
EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
|
EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
|
||||||
EXPECT_FALSE(cursor_client->IsCursorVisible());
|
EXPECT_FALSE(cursor_client->IsCursorVisible());
|
||||||
|
@ -2835,7 +2835,7 @@ TEST_F(EventRewriterTest, TestRewriteNonNativeEvent) {
|
|||||||
gfx::Point location(0, 0);
|
gfx::Point location(0, 0);
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(
|
||||||
ui::ET_TOUCH_PRESSED, location, base::TimeTicks(),
|
ui::ET_TOUCH_PRESSED, location, base::TimeTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, kTouchId));
|
ui::PointerDetails(ui::EventPointerType::kTouch, kTouchId));
|
||||||
press.set_flags(ui::EF_CONTROL_DOWN);
|
press.set_flags(ui::EF_CONTROL_DOWN);
|
||||||
|
|
||||||
TestEventRewriterContinuation continuation;
|
TestEventRewriterContinuation continuation;
|
||||||
|
@ -208,7 +208,7 @@ void AdaptiveScreenBrightnessManager::OnUserActivity(
|
|||||||
key_counter_->Log(time_since_boot);
|
key_counter_->Log(time_since_boot);
|
||||||
} else if (event->IsTouchEvent()) {
|
} else if (event->IsTouchEvent()) {
|
||||||
if (event->AsTouchEvent()->pointer_details().pointer_type ==
|
if (event->AsTouchEvent()->pointer_details().pointer_type ==
|
||||||
ui::EventPointerType::POINTER_TYPE_PEN) {
|
ui::EventPointerType::kPen) {
|
||||||
stylus_counter_->Log(time_since_boot);
|
stylus_counter_->Log(time_since_boot);
|
||||||
} else {
|
} else {
|
||||||
touch_counter_->Log(time_since_boot);
|
touch_counter_->Log(time_since_boot);
|
||||||
|
@ -584,7 +584,7 @@ TEST_F(AdaptiveScreenBrightnessManagerTest, UserEventCounts) {
|
|||||||
|
|
||||||
const ui::TouchEvent kTouchEvent(
|
const ui::TouchEvent kTouchEvent(
|
||||||
ui::ET_TOUCH_PRESSED, kEventLocation, base::TimeTicks(),
|
ui::ET_TOUCH_PRESSED, kEventLocation, base::TimeTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ReportUserActivity(&kTouchEvent);
|
ReportUserActivity(&kTouchEvent);
|
||||||
ReportUserActivity(&kTouchEvent);
|
ReportUserActivity(&kTouchEvent);
|
||||||
|
|
||||||
@ -597,8 +597,7 @@ TEST_F(AdaptiveScreenBrightnessManagerTest, UserEventCounts) {
|
|||||||
|
|
||||||
const ui::TouchEvent kStylusEvent(
|
const ui::TouchEvent kStylusEvent(
|
||||||
ui::ET_TOUCH_MOVED, kEventLocation, base::TimeTicks(),
|
ui::ET_TOUCH_MOVED, kEventLocation, base::TimeTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_PEN, 0),
|
ui::PointerDetails(ui::EventPointerType::kPen, 0), ui::EF_NONE);
|
||||||
ui::EF_NONE);
|
|
||||||
ReportUserActivity(&kStylusEvent);
|
ReportUserActivity(&kStylusEvent);
|
||||||
ReportUserActivity(&kStylusEvent);
|
ReportUserActivity(&kStylusEvent);
|
||||||
ReportUserActivity(&kStylusEvent);
|
ReportUserActivity(&kStylusEvent);
|
||||||
|
@ -536,7 +536,7 @@ TEST_F(IdleEventNotifierTest, UserInputEventsOneIdleEvent) {
|
|||||||
gfx::Point(0, 0), base::TimeTicks(), 0, 0);
|
gfx::Point(0, 0), base::TimeTicks(), 0, 0);
|
||||||
ui::TouchEvent touch_event(
|
ui::TouchEvent touch_event(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), base::TimeTicks::UnixEpoch(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), base::TimeTicks::UnixEpoch(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
const base::Time first_activity_time = base::Time::Now();
|
const base::Time first_activity_time = base::Time::Now();
|
||||||
// This key event will be too old to be counted.
|
// This key event will be too old to be counted.
|
||||||
@ -599,7 +599,7 @@ TEST_F(IdleEventNotifierTest, UserInputEventsTwoIdleEvents) {
|
|||||||
gfx::Point(0, 0), base::TimeTicks(), 0, 0);
|
gfx::Point(0, 0), base::TimeTicks(), 0, 0);
|
||||||
ui::TouchEvent touch_event(
|
ui::TouchEvent touch_event(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), base::TimeTicks::UnixEpoch(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), base::TimeTicks::UnixEpoch(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
const base::Time now_1 = base::Time::Now();
|
const base::Time now_1 = base::Time::Now();
|
||||||
idle_event_notifier_->OnUserActivity(&key_event);
|
idle_event_notifier_->OnUserActivity(&key_event);
|
||||||
|
@ -243,7 +243,7 @@ void SmartChargingManager::OnUserActivity(const ui::Event* event) {
|
|||||||
}
|
}
|
||||||
if (event->IsTouchEvent()) {
|
if (event->IsTouchEvent()) {
|
||||||
if (event->AsTouchEvent()->pointer_details().pointer_type ==
|
if (event->AsTouchEvent()->pointer_details().pointer_type ==
|
||||||
ui::EventPointerType::POINTER_TYPE_PEN) {
|
ui::EventPointerType::kPen) {
|
||||||
stylus_counter_->Log(time_since_boot);
|
stylus_counter_->Log(time_since_boot);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ TEST_F(SmartChargingManagerTest, UserEventCounts) {
|
|||||||
|
|
||||||
const ui::TouchEvent kTouchEvent(
|
const ui::TouchEvent kTouchEvent(
|
||||||
ui::ET_TOUCH_PRESSED, kEventLocation, base::TimeTicks(),
|
ui::ET_TOUCH_PRESSED, kEventLocation, base::TimeTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ReportUserActivity(&kTouchEvent);
|
ReportUserActivity(&kTouchEvent);
|
||||||
ReportUserActivity(&kTouchEvent);
|
ReportUserActivity(&kTouchEvent);
|
||||||
|
|
||||||
@ -258,8 +258,7 @@ TEST_F(SmartChargingManagerTest, UserEventCounts) {
|
|||||||
|
|
||||||
const ui::TouchEvent kStylusEvent(
|
const ui::TouchEvent kStylusEvent(
|
||||||
ui::ET_TOUCH_MOVED, kEventLocation, base::TimeTicks(),
|
ui::ET_TOUCH_MOVED, kEventLocation, base::TimeTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_PEN, 0),
|
ui::PointerDetails(ui::EventPointerType::kPen, 0), ui::EF_NONE);
|
||||||
ui::EF_NONE);
|
|
||||||
ReportUserActivity(&kStylusEvent);
|
ReportUserActivity(&kStylusEvent);
|
||||||
ReportUserActivity(&kStylusEvent);
|
ReportUserActivity(&kStylusEvent);
|
||||||
ReportUserActivity(&kStylusEvent);
|
ReportUserActivity(&kStylusEvent);
|
||||||
|
@ -326,12 +326,12 @@ IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, TouchPopupInteraction) {
|
|||||||
// Simulate a short tap that doesn't trigger the popup.
|
// Simulate a short tap that doesn't trigger the popup.
|
||||||
ui::TouchEvent touch_event(
|
ui::TouchEvent touch_event(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host->OnTouchEvent(touch_event);
|
host->OnTouchEvent(touch_event);
|
||||||
|
|
||||||
touch_event = ui::TouchEvent(
|
touch_event = ui::TouchEvent(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host->OnTouchEvent(touch_event);
|
host->OnTouchEvent(touch_event);
|
||||||
|
|
||||||
ASSERT_FALSE(host->IsVisible());
|
ASSERT_FALSE(host->IsVisible());
|
||||||
@ -339,7 +339,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, TouchPopupInteraction) {
|
|||||||
// Simulate a press-and-hold.
|
// Simulate a press-and-hold.
|
||||||
touch_event = ui::TouchEvent(
|
touch_event = ui::TouchEvent(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host->OnTouchEvent(touch_event);
|
host->OnTouchEvent(touch_event);
|
||||||
|
|
||||||
ui::GestureEvent gesture(1, 1, 0, ui::EventTimeForNow(),
|
ui::GestureEvent gesture(1, 1, 0, ui::EventTimeForNow(),
|
||||||
@ -350,14 +350,14 @@ IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, TouchPopupInteraction) {
|
|||||||
RunLoopUntilVisibilityChanges();
|
RunLoopUntilVisibilityChanges();
|
||||||
touch_event = ui::TouchEvent(
|
touch_event = ui::TouchEvent(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host->OnTouchEvent(touch_event);
|
host->OnTouchEvent(touch_event);
|
||||||
ASSERT_TRUE(host->IsVisible());
|
ASSERT_TRUE(host->IsVisible());
|
||||||
|
|
||||||
// Simulate pressing outside the popup, which should hide the popup.
|
// Simulate pressing outside the popup, which should hide the popup.
|
||||||
touch_event = ui::TouchEvent(
|
touch_event = ui::TouchEvent(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host->OnTouchEvent(touch_event);
|
host->OnTouchEvent(touch_event);
|
||||||
RunLoopUntilVisibilityChanges();
|
RunLoopUntilVisibilityChanges();
|
||||||
ASSERT_FALSE(host->IsVisible());
|
ASSERT_FALSE(host->IsVisible());
|
||||||
@ -365,7 +365,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, TouchPopupInteraction) {
|
|||||||
// Simulate a press-and-hold again.
|
// Simulate a press-and-hold again.
|
||||||
touch_event = ui::TouchEvent(
|
touch_event = ui::TouchEvent(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host->OnTouchEvent(touch_event);
|
host->OnTouchEvent(touch_event);
|
||||||
|
|
||||||
gesture =
|
gesture =
|
||||||
@ -377,7 +377,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, TouchPopupInteraction) {
|
|||||||
|
|
||||||
touch_event = ui::TouchEvent(
|
touch_event = ui::TouchEvent(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host->OnTouchEvent(touch_event);
|
host->OnTouchEvent(touch_event);
|
||||||
ASSERT_TRUE(host->IsVisible());
|
ASSERT_TRUE(host->IsVisible());
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest, TouchPopupInteraction) {
|
|||||||
// browser to exit fullscreen and destroy the exit control and its host.
|
// browser to exit fullscreen and destroy the exit control and its host.
|
||||||
touch_event = ui::TouchEvent(
|
touch_event = ui::TouchEvent(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
GetFullscreenControlView()->ButtonPressed(GetFullscreenExitButton(),
|
GetFullscreenControlView()->ButtonPressed(GetFullscreenExitButton(),
|
||||||
touch_event);
|
touch_event);
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest,
|
|||||||
// Simulate a press-and-hold.
|
// Simulate a press-and-hold.
|
||||||
ui::TouchEvent touch_event(
|
ui::TouchEvent touch_event(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host->OnTouchEvent(touch_event);
|
host->OnTouchEvent(touch_event);
|
||||||
ui::GestureEvent gesture(1, 1, 0, ui::EventTimeForNow(),
|
ui::GestureEvent gesture(1, 1, 0, ui::EventTimeForNow(),
|
||||||
ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
|
ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
|
||||||
@ -429,14 +429,14 @@ IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest,
|
|||||||
// Release the touch, which should have no effect.
|
// Release the touch, which should have no effect.
|
||||||
touch_event = ui::TouchEvent(
|
touch_event = ui::TouchEvent(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host->OnTouchEvent(touch_event);
|
host->OnTouchEvent(touch_event);
|
||||||
ASSERT_FALSE(host->IsVisible());
|
ASSERT_FALSE(host->IsVisible());
|
||||||
|
|
||||||
// Simulate a press-and-hold to trigger the UI.
|
// Simulate a press-and-hold to trigger the UI.
|
||||||
touch_event = ui::TouchEvent(
|
touch_event = ui::TouchEvent(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host->OnTouchEvent(touch_event);
|
host->OnTouchEvent(touch_event);
|
||||||
gesture =
|
gesture =
|
||||||
ui::GestureEvent(1, 1, 0, ui::EventTimeForNow(),
|
ui::GestureEvent(1, 1, 0, ui::EventTimeForNow(),
|
||||||
@ -462,7 +462,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControlViewTest,
|
|||||||
// Press outside the popup, which should hide the popup.
|
// Press outside the popup, which should hide the popup.
|
||||||
touch_event = ui::TouchEvent(
|
touch_event = ui::TouchEvent(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host->OnTouchEvent(touch_event);
|
host->OnTouchEvent(touch_event);
|
||||||
RunLoopUntilVisibilityChanges();
|
RunLoopUntilVisibilityChanges();
|
||||||
ASSERT_FALSE(host->IsVisible());
|
ASSERT_FALSE(host->IsVisible());
|
||||||
|
@ -317,7 +317,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
|
|||||||
void EnterTouchExplorationModeAtLocation(gfx::Point tap_location) {
|
void EnterTouchExplorationModeAtLocation(gfx::Point tap_location) {
|
||||||
ui::TouchEvent touch_press(
|
ui::TouchEvent touch_press(
|
||||||
ui::ET_TOUCH_PRESSED, tap_location, Now(),
|
ui::ET_TOUCH_PRESSED, tap_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&touch_press);
|
generator_->Dispatch(&touch_press);
|
||||||
AdvanceSimulatedTimePastTapDelay();
|
AdvanceSimulatedTimePastTapDelay();
|
||||||
EXPECT_TRUE(IsInTouchToMouseMode());
|
EXPECT_TRUE(IsInTouchToMouseMode());
|
||||||
@ -542,7 +542,7 @@ TEST_F(TouchExplorationTest, TurnOnMidTouch) {
|
|||||||
SwitchTouchExplorationMode(true);
|
SwitchTouchExplorationMode(true);
|
||||||
ui::TouchEvent touch_move(
|
ui::TouchEvent touch_move(
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(111, 112), Now(),
|
ui::ET_TOUCH_MOVED, gfx::Point(111, 112), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&touch_move);
|
generator_->Dispatch(&touch_move);
|
||||||
EXPECT_TRUE(cursor_client()->IsCursorVisible());
|
EXPECT_TRUE(cursor_client()->IsCursorVisible());
|
||||||
EXPECT_FALSE(cursor_client()->IsMouseEventsEnabled());
|
EXPECT_FALSE(cursor_client()->IsMouseEventsEnabled());
|
||||||
@ -569,7 +569,7 @@ TEST_F(TouchExplorationTest, TurnOnMidTouch) {
|
|||||||
// The release of the first finger shouldn't be affected.
|
// The release of the first finger shouldn't be affected.
|
||||||
ui::TouchEvent touch_release(
|
ui::TouchEvent touch_release(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(111, 112), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(111, 112), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&touch_release);
|
generator_->Dispatch(&touch_release);
|
||||||
captured_events = GetCapturedLocatedEvents();
|
captured_events = GetCapturedLocatedEvents();
|
||||||
ASSERT_EQ(1u, captured_events.size());
|
ASSERT_EQ(1u, captured_events.size());
|
||||||
@ -998,7 +998,7 @@ TEST_F(TouchExplorationTest, SplitTap) {
|
|||||||
// After the release, there is still a finger in touch explore mode.
|
// After the release, there is still a finger in touch explore mode.
|
||||||
ui::TouchEvent split_tap_press(
|
ui::TouchEvent split_tap_press(
|
||||||
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_press);
|
generator_->Dispatch(&split_tap_press);
|
||||||
// To simulate the behavior of the real device, we manually disable
|
// To simulate the behavior of the real device, we manually disable
|
||||||
// mouse events. To not rely on manually setting the state, this is also
|
// mouse events. To not rely on manually setting the state, this is also
|
||||||
@ -1009,7 +1009,7 @@ TEST_F(TouchExplorationTest, SplitTap) {
|
|||||||
EXPECT_FALSE(IsInGestureInProgressState());
|
EXPECT_FALSE(IsInGestureInProgressState());
|
||||||
ui::TouchEvent split_tap_release(
|
ui::TouchEvent split_tap_release(
|
||||||
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_release);
|
generator_->Dispatch(&split_tap_release);
|
||||||
// Releasing the second finger should re-enable mouse events putting us
|
// Releasing the second finger should re-enable mouse events putting us
|
||||||
// back into the touch exploration mode.
|
// back into the touch exploration mode.
|
||||||
@ -1028,7 +1028,7 @@ TEST_F(TouchExplorationTest, SplitTap) {
|
|||||||
|
|
||||||
ui::TouchEvent touch_explore_release(
|
ui::TouchEvent touch_explore_release(
|
||||||
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&touch_explore_release);
|
generator_->Dispatch(&touch_explore_release);
|
||||||
AdvanceSimulatedTimePastTapDelay();
|
AdvanceSimulatedTimePastTapDelay();
|
||||||
EXPECT_TRUE(IsInNoFingersDownState());
|
EXPECT_TRUE(IsInNoFingersDownState());
|
||||||
@ -1059,15 +1059,15 @@ TEST_F(TouchExplorationTest, SplitTapRelease) {
|
|||||||
// not at the location of the second tap and release.
|
// not at the location of the second tap and release.
|
||||||
ui::TouchEvent split_tap_press(
|
ui::TouchEvent split_tap_press(
|
||||||
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_press);
|
generator_->Dispatch(&split_tap_press);
|
||||||
ui::TouchEvent touch_explore_release(
|
ui::TouchEvent touch_explore_release(
|
||||||
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&touch_explore_release);
|
generator_->Dispatch(&touch_explore_release);
|
||||||
ui::TouchEvent split_tap_release(
|
ui::TouchEvent split_tap_release(
|
||||||
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_release);
|
generator_->Dispatch(&split_tap_release);
|
||||||
EXPECT_TRUE(IsInNoFingersDownState());
|
EXPECT_TRUE(IsInNoFingersDownState());
|
||||||
|
|
||||||
@ -1102,7 +1102,7 @@ TEST_F(TouchExplorationTest, SplitTapMultiFinger) {
|
|||||||
// Now tap at a different location
|
// Now tap at a different location
|
||||||
ui::TouchEvent split_tap_press(
|
ui::TouchEvent split_tap_press(
|
||||||
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_press);
|
generator_->Dispatch(&split_tap_press);
|
||||||
simulated_clock_.Advance(gesture_detector_config_.longpress_timeout);
|
simulated_clock_.Advance(gesture_detector_config_.longpress_timeout);
|
||||||
|
|
||||||
@ -1110,22 +1110,22 @@ TEST_F(TouchExplorationTest, SplitTapMultiFinger) {
|
|||||||
// enter the wait state.
|
// enter the wait state.
|
||||||
ui::TouchEvent third_press(
|
ui::TouchEvent third_press(
|
||||||
ui::ET_TOUCH_PRESSED, third_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, third_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
generator_->Dispatch(&third_press);
|
generator_->Dispatch(&third_press);
|
||||||
|
|
||||||
// When all three fingers are released, no events should be captured.
|
// When all three fingers are released, no events should be captured.
|
||||||
// All fingers should then be up.
|
// All fingers should then be up.
|
||||||
ui::TouchEvent touch_explore_release(
|
ui::TouchEvent touch_explore_release(
|
||||||
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, initial_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&touch_explore_release);
|
generator_->Dispatch(&touch_explore_release);
|
||||||
ui::TouchEvent split_tap_release(
|
ui::TouchEvent split_tap_release(
|
||||||
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_release);
|
generator_->Dispatch(&split_tap_release);
|
||||||
ui::TouchEvent third_tap_release(
|
ui::TouchEvent third_tap_release(
|
||||||
ui::ET_TOUCH_RELEASED, third_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, third_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
generator_->Dispatch(&third_tap_release);
|
generator_->Dispatch(&third_tap_release);
|
||||||
|
|
||||||
std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents();
|
std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents();
|
||||||
@ -1151,22 +1151,22 @@ TEST_F(TouchExplorationTest, SplitTapLeaveSlop) {
|
|||||||
// Now tap at a different location for split tap.
|
// Now tap at a different location for split tap.
|
||||||
ui::TouchEvent split_tap_press(
|
ui::TouchEvent split_tap_press(
|
||||||
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_press);
|
generator_->Dispatch(&split_tap_press);
|
||||||
|
|
||||||
// Move the first finger out of slop and release both fingers. The split
|
// Move the first finger out of slop and release both fingers. The split
|
||||||
// tap should have been cancelled.
|
// tap should have been cancelled.
|
||||||
ui::TouchEvent first_touch_move(
|
ui::TouchEvent first_touch_move(
|
||||||
ui::ET_TOUCH_MOVED, first_move_location, Now(),
|
ui::ET_TOUCH_MOVED, first_move_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&first_touch_move);
|
generator_->Dispatch(&first_touch_move);
|
||||||
ui::TouchEvent first_touch_release(
|
ui::TouchEvent first_touch_release(
|
||||||
ui::ET_TOUCH_RELEASED, first_move_location, Now(),
|
ui::ET_TOUCH_RELEASED, first_move_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&first_touch_release);
|
generator_->Dispatch(&first_touch_release);
|
||||||
ui::TouchEvent second_touch_release(
|
ui::TouchEvent second_touch_release(
|
||||||
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&second_touch_release);
|
generator_->Dispatch(&second_touch_release);
|
||||||
|
|
||||||
std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents();
|
std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents();
|
||||||
@ -1178,22 +1178,22 @@ TEST_F(TouchExplorationTest, SplitTapLeaveSlop) {
|
|||||||
ClearCapturedEvents();
|
ClearCapturedEvents();
|
||||||
ui::TouchEvent split_tap_press2(
|
ui::TouchEvent split_tap_press2(
|
||||||
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
ui::ET_TOUCH_PRESSED, second_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&split_tap_press2);
|
generator_->Dispatch(&split_tap_press2);
|
||||||
|
|
||||||
// Move the second finger out of slop and release both fingers. The split
|
// Move the second finger out of slop and release both fingers. The split
|
||||||
// tap should have been cancelled.
|
// tap should have been cancelled.
|
||||||
ui::TouchEvent second_touch_move2(
|
ui::TouchEvent second_touch_move2(
|
||||||
ui::ET_TOUCH_MOVED, second_move_location, Now(),
|
ui::ET_TOUCH_MOVED, second_move_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&second_touch_move2);
|
generator_->Dispatch(&second_touch_move2);
|
||||||
ui::TouchEvent first_touch_release2(
|
ui::TouchEvent first_touch_release2(
|
||||||
ui::ET_TOUCH_RELEASED, first_touch_location, Now(),
|
ui::ET_TOUCH_RELEASED, first_touch_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&first_touch_release2);
|
generator_->Dispatch(&first_touch_release2);
|
||||||
ui::TouchEvent second_touch_release2(
|
ui::TouchEvent second_touch_release2(
|
||||||
ui::ET_TOUCH_RELEASED, second_move_location, Now(),
|
ui::ET_TOUCH_RELEASED, second_move_location, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&second_touch_release2);
|
generator_->Dispatch(&second_touch_release2);
|
||||||
|
|
||||||
captured_events = GetCapturedLocatedEvents();
|
captured_events = GetCapturedLocatedEvents();
|
||||||
@ -1213,7 +1213,7 @@ TEST_F(TouchExplorationTest, EnterGestureInProgressState) {
|
|||||||
float distance = gesture_detector_config_.touch_slop + 1;
|
float distance = gesture_detector_config_.touch_slop + 1;
|
||||||
ui::TouchEvent first_press(
|
ui::TouchEvent first_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(100, 101), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(100, 101), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
gfx::Point second_location(100 + distance / 2, 101);
|
gfx::Point second_location(100 + distance / 2, 101);
|
||||||
gfx::Point third_location(100 + distance, 101);
|
gfx::Point third_location(100 + distance, 101);
|
||||||
gfx::Point touch_exploration_location(120, 121);
|
gfx::Point touch_exploration_location(120, 121);
|
||||||
@ -1390,18 +1390,15 @@ TEST_F(TouchExplorationTest, DISABLED_AllFingerPermutations) {
|
|||||||
int y = 10 * touch_id + 102;
|
int y = 10 * touch_id + 102;
|
||||||
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(x++, y++), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(x++, y++), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch, touch_id)));
|
||||||
touch_id)));
|
|
||||||
queued_events.push_back(all_events.back().get());
|
queued_events.push_back(all_events.back().get());
|
||||||
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(x++, y++), Now(),
|
ui::ET_TOUCH_MOVED, gfx::Point(x++, y++), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch, touch_id)));
|
||||||
touch_id)));
|
|
||||||
queued_events.push_back(all_events.back().get());
|
queued_events.push_back(all_events.back().get());
|
||||||
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
all_events.push_back(std::make_unique<ui::TouchEvent>(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(x, y), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(x, y), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch, touch_id)));
|
||||||
touch_id)));
|
|
||||||
queued_events.push_back(all_events.back().get());
|
queued_events.push_back(all_events.back().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1506,7 +1503,7 @@ TEST_F(TouchExplorationTest, GestureAddedFinger) {
|
|||||||
float distance = gesture_detector_config_.touch_slop + 1;
|
float distance = gesture_detector_config_.touch_slop + 1;
|
||||||
ui::TouchEvent first_press(
|
ui::TouchEvent first_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&first_press);
|
generator_->Dispatch(&first_press);
|
||||||
simulated_clock_.Advance(base::TimeDelta::FromMilliseconds(10));
|
simulated_clock_.Advance(base::TimeDelta::FromMilliseconds(10));
|
||||||
gfx::Point second_location(100 + distance, 200);
|
gfx::Point second_location(100 + distance, 200);
|
||||||
@ -1520,7 +1517,7 @@ TEST_F(TouchExplorationTest, GestureAddedFinger) {
|
|||||||
// gestures are prevented from continuing to go through.
|
// gestures are prevented from continuing to go through.
|
||||||
ui::TouchEvent second_press(
|
ui::TouchEvent second_press(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(220, 221), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(220, 221), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator_->Dispatch(&second_press);
|
generator_->Dispatch(&second_press);
|
||||||
AdvanceSimulatedTimePastTapDelay();
|
AdvanceSimulatedTimePastTapDelay();
|
||||||
EXPECT_FALSE(IsInGestureInProgressState());
|
EXPECT_FALSE(IsInGestureInProgressState());
|
||||||
@ -1537,7 +1534,7 @@ TEST_F(TouchExplorationTest, InBoundariesTouchExploration) {
|
|||||||
gfx::Point initial_press(window.right() - (GetMaxDistanceFromEdge() + GetLeavingDistanceFromEdge()) / 2, GetLeavingDistanceFromEdge() + 1);
|
gfx::Point initial_press(window.right() - (GetMaxDistanceFromEdge() + GetLeavingDistanceFromEdge()) / 2, GetLeavingDistanceFromEdge() + 1);
|
||||||
ui::TouchEvent first_press(
|
ui::TouchEvent first_press(
|
||||||
ui::ET_TOUCH_PRESSED, initial_press, Now(),
|
ui::ET_TOUCH_PRESSED, initial_press, Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
generator_->Dispatch(&first_press);
|
generator_->Dispatch(&first_press);
|
||||||
EXPECT_FALSE(IsInGestureInProgressState());
|
EXPECT_FALSE(IsInGestureInProgressState());
|
||||||
EXPECT_FALSE(IsInTouchToMouseMode());
|
EXPECT_FALSE(IsInTouchToMouseMode());
|
||||||
@ -1600,24 +1597,24 @@ TEST_F(TouchExplorationTest, TwoFingerTapAndMoveFirstFinger) {
|
|||||||
// tap.
|
// tap.
|
||||||
ui::TouchEvent first_press_id_1(
|
ui::TouchEvent first_press_id_1(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent first_press_id_2(
|
ui::TouchEvent first_press_id_2(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
|
|
||||||
ui::TouchEvent slop_move_id_1(
|
ui::TouchEvent slop_move_id_1(
|
||||||
ui::ET_TOUCH_MOVED,
|
ui::ET_TOUCH_MOVED,
|
||||||
gfx::Point(100 + gesture_detector_config_.touch_slop, 200), Now(),
|
gfx::Point(100 + gesture_detector_config_.touch_slop, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent slop_move_id_2(
|
ui::TouchEvent slop_move_id_2(
|
||||||
ui::ET_TOUCH_MOVED,
|
ui::ET_TOUCH_MOVED,
|
||||||
gfx::Point(110 + gesture_detector_config_.touch_slop, 200), Now(),
|
gfx::Point(110 + gesture_detector_config_.touch_slop, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
|
|
||||||
ui::TouchEvent out_slop_id_1(
|
ui::TouchEvent out_slop_id_1(
|
||||||
ui::ET_TOUCH_MOVED,
|
ui::ET_TOUCH_MOVED,
|
||||||
gfx::Point(100 + gesture_detector_config_.touch_slop + 1, 200), Now(),
|
gfx::Point(100 + gesture_detector_config_.touch_slop + 1, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
|
|
||||||
// Dispatch the inital presses.
|
// Dispatch the inital presses.
|
||||||
generator_->Dispatch(&first_press_id_1);
|
generator_->Dispatch(&first_press_id_1);
|
||||||
@ -1650,15 +1647,15 @@ TEST_F(TouchExplorationTest, TwoFingerTapAndMoveSecondFinger) {
|
|||||||
// tap.
|
// tap.
|
||||||
ui::TouchEvent first_press_id_1(
|
ui::TouchEvent first_press_id_1(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent first_press_id_2(
|
ui::TouchEvent first_press_id_2(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
|
|
||||||
ui::TouchEvent out_slop_id_2(
|
ui::TouchEvent out_slop_id_2(
|
||||||
ui::ET_TOUCH_MOVED,
|
ui::ET_TOUCH_MOVED,
|
||||||
gfx::Point(100 + gesture_detector_config_.touch_slop + 1, 200), Now(),
|
gfx::Point(100 + gesture_detector_config_.touch_slop + 1, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
|
|
||||||
generator_->Dispatch(&first_press_id_1);
|
generator_->Dispatch(&first_press_id_1);
|
||||||
EXPECT_FALSE(IsInTwoFingerTapState());
|
EXPECT_FALSE(IsInTwoFingerTapState());
|
||||||
@ -1776,28 +1773,28 @@ TEST_F(TouchExplorationTest, ThreeOrFourFingerTap) {
|
|||||||
|
|
||||||
ui::TouchEvent press_id_1(
|
ui::TouchEvent press_id_1(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent release_id_1(
|
ui::TouchEvent release_id_1(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(100, 200), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(100, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent press_id_2(
|
ui::TouchEvent press_id_2(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(110, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
ui::TouchEvent release_id_2(
|
ui::TouchEvent release_id_2(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(110, 200), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(110, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
ui::TouchEvent press_id_3(
|
ui::TouchEvent press_id_3(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(120, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(120, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 3));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 3));
|
||||||
ui::TouchEvent release_id_3(
|
ui::TouchEvent release_id_3(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(120, 200), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(120, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 3));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 3));
|
||||||
ui::TouchEvent press_id_4(
|
ui::TouchEvent press_id_4(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(130, 200), Now(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(130, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 4));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 4));
|
||||||
ui::TouchEvent release_id_4(
|
ui::TouchEvent release_id_4(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(120, 200), Now(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(120, 200), Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 4));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 4));
|
||||||
|
|
||||||
// Three fingers down.
|
// Three fingers down.
|
||||||
generator_->Dispatch(&press_id_1);
|
generator_->Dispatch(&press_id_1);
|
||||||
|
@ -445,8 +445,7 @@ void WebviewClient::SendTouchInput(const Webview* webview,
|
|||||||
touch_input->set_y(y);
|
touch_input->set_y(y);
|
||||||
touch_input->set_root_x(x);
|
touch_input->set_root_x(x);
|
||||||
touch_input->set_root_y(y);
|
touch_input->set_root_y(y);
|
||||||
touch_input->set_pointer_type(
|
touch_input->set_pointer_type(static_cast<int>(ui::EventPointerType::kTouch));
|
||||||
static_cast<int>(ui::EventPointerType::POINTER_TYPE_TOUCH));
|
|
||||||
touch_input->set_pointer_id(id);
|
touch_input->set_pointer_id(id);
|
||||||
|
|
||||||
auto input_event = std::make_unique<InputEvent>();
|
auto input_event = std::make_unique<InputEvent>();
|
||||||
|
@ -71,16 +71,16 @@ class MultipleTapDetectorTest : public aura::test::AuraTestBase {
|
|||||||
|
|
||||||
// Simulate a tap event.
|
// Simulate a tap event.
|
||||||
void Tap(const gfx::Point& tap_point) {
|
void Tap(const gfx::Point& tap_point) {
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, tap_point,
|
||||||
ui::ET_TOUCH_PRESSED, tap_point, simulated_clock_.NowTicks(),
|
simulated_clock_.NowTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch,
|
||||||
ui::kPointerIdUnknown));
|
ui::kPointerIdUnknown));
|
||||||
generator_->Dispatch(&press);
|
generator_->Dispatch(&press);
|
||||||
simulated_clock_.Advance(base::TimeDelta::FromMilliseconds(kTapLengthMs));
|
simulated_clock_.Advance(base::TimeDelta::FromMilliseconds(kTapLengthMs));
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, tap_point,
|
||||||
ui::ET_TOUCH_RELEASED, tap_point, simulated_clock_.NowTicks(),
|
simulated_clock_.NowTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch,
|
||||||
ui::kPointerIdUnknown));
|
ui::kPointerIdUnknown));
|
||||||
generator_->Dispatch(&release);
|
generator_->Dispatch(&release);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,16 +99,14 @@ class SideSwipeDetectorTest : public aura::test::AuraTestBase {
|
|||||||
bool end_release = true) {
|
bool end_release = true) {
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(
|
||||||
ui::ET_TOUCH_PRESSED, start_point, mock_clock()->NowTicks(),
|
ui::ET_TOUCH_PRESSED, start_point, mock_clock()->NowTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch, pointer_id));
|
||||||
pointer_id));
|
|
||||||
GetEventGenerator().Dispatch(&press);
|
GetEventGenerator().Dispatch(&press);
|
||||||
mock_task_runner()->AdvanceMockTickClock(start_hold_time);
|
mock_task_runner()->AdvanceMockTickClock(start_hold_time);
|
||||||
mock_task_runner()->FastForwardBy(start_hold_time);
|
mock_task_runner()->FastForwardBy(start_hold_time);
|
||||||
|
|
||||||
ui::TouchEvent move(
|
ui::TouchEvent move(
|
||||||
ui::ET_TOUCH_MOVED, end_point, mock_clock()->NowTicks(),
|
ui::ET_TOUCH_MOVED, end_point, mock_clock()->NowTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch, pointer_id));
|
||||||
pointer_id));
|
|
||||||
GetEventGenerator().Dispatch(&move);
|
GetEventGenerator().Dispatch(&move);
|
||||||
mock_task_runner()->AdvanceMockTickClock(drag_time);
|
mock_task_runner()->AdvanceMockTickClock(drag_time);
|
||||||
mock_task_runner()->FastForwardBy(drag_time);
|
mock_task_runner()->FastForwardBy(drag_time);
|
||||||
@ -116,8 +114,7 @@ class SideSwipeDetectorTest : public aura::test::AuraTestBase {
|
|||||||
if (end_release) {
|
if (end_release) {
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(
|
||||||
ui::ET_TOUCH_RELEASED, end_point, mock_clock()->NowTicks(),
|
ui::ET_TOUCH_RELEASED, end_point, mock_clock()->NowTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch, pointer_id));
|
||||||
pointer_id));
|
|
||||||
GetEventGenerator().Dispatch(&release);
|
GetEventGenerator().Dispatch(&release);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ void Touch::OnTouchEvent(ui::TouchEvent* event) {
|
|||||||
delegate_->OnTouchDown(target, event->time_stamp(), touch_pointer_id,
|
delegate_->OnTouchDown(target, event->time_stamp(), touch_pointer_id,
|
||||||
location);
|
location);
|
||||||
if (stylus_delegate_ && event->pointer_details().pointer_type !=
|
if (stylus_delegate_ && event->pointer_details().pointer_type !=
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH) {
|
ui::EventPointerType::kTouch) {
|
||||||
stylus_delegate_->OnTouchTool(touch_pointer_id,
|
stylus_delegate_->OnTouchTool(touch_pointer_id,
|
||||||
event->pointer_details().pointer_type);
|
event->pointer_details().pointer_type);
|
||||||
}
|
}
|
||||||
@ -162,8 +162,8 @@ void Touch::OnTouchEvent(ui::TouchEvent* event) {
|
|||||||
minor = major;
|
minor = major;
|
||||||
delegate_->OnTouchShape(touch_pointer_id, major, minor);
|
delegate_->OnTouchShape(touch_pointer_id, major, minor);
|
||||||
|
|
||||||
if (stylus_delegate_ && event->pointer_details().pointer_type !=
|
if (stylus_delegate_ &&
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH) {
|
event->pointer_details().pointer_type != ui::EventPointerType::kTouch) {
|
||||||
if (!std::isnan(event->pointer_details().force)) {
|
if (!std::isnan(event->pointer_details().force)) {
|
||||||
stylus_delegate_->OnTouchForce(event->time_stamp(), touch_pointer_id,
|
stylus_delegate_->OnTouchForce(event->time_stamp(), touch_pointer_id,
|
||||||
event->pointer_details().force);
|
event->pointer_details().force);
|
||||||
|
@ -238,7 +238,7 @@ TEST_F(TouchTest, OnTouchCancel) {
|
|||||||
EXPECT_CALL(delegate, OnTouchFrame());
|
EXPECT_CALL(delegate, OnTouchFrame());
|
||||||
ui::TouchEvent cancel_event(
|
ui::TouchEvent cancel_event(
|
||||||
ui::ET_TOUCH_CANCELLED, gfx::Point(), ui::EventTimeForNow(),
|
ui::ET_TOUCH_CANCELLED, gfx::Point(), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
generator.Dispatch(&cancel_event);
|
generator.Dispatch(&cancel_event);
|
||||||
|
|
||||||
EXPECT_CALL(delegate, OnTouchDestroying(touch.get()));
|
EXPECT_CALL(delegate, OnTouchDestroying(touch.get()));
|
||||||
@ -411,14 +411,13 @@ TEST_F(TouchTest, OnTouchTool) {
|
|||||||
testing::InSequence sequence;
|
testing::InSequence sequence;
|
||||||
EXPECT_CALL(delegate, OnTouchDown(window.surface(), testing::_, testing::_,
|
EXPECT_CALL(delegate, OnTouchDown(window.surface(), testing::_, testing::_,
|
||||||
gfx::PointF()));
|
gfx::PointF()));
|
||||||
EXPECT_CALL(stylus_delegate,
|
EXPECT_CALL(stylus_delegate, OnTouchTool(0, ui::EventPointerType::kPen));
|
||||||
OnTouchTool(0, ui::EventPointerType::POINTER_TYPE_PEN));
|
|
||||||
EXPECT_CALL(delegate, OnTouchFrame());
|
EXPECT_CALL(delegate, OnTouchFrame());
|
||||||
EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_));
|
EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_));
|
||||||
EXPECT_CALL(delegate, OnTouchFrame());
|
EXPECT_CALL(delegate, OnTouchFrame());
|
||||||
}
|
}
|
||||||
generator.set_current_screen_location(window.origin());
|
generator.set_current_screen_location(window.origin());
|
||||||
generator.SetTouchPointerType(ui::EventPointerType::POINTER_TYPE_PEN);
|
generator.SetTouchPointerType(ui::EventPointerType::kPen);
|
||||||
generator.PressTouch();
|
generator.PressTouch();
|
||||||
generator.ReleaseTouch();
|
generator.ReleaseTouch();
|
||||||
|
|
||||||
@ -446,15 +445,14 @@ TEST_F(TouchTest, OnTouchForce) {
|
|||||||
testing::InSequence sequence;
|
testing::InSequence sequence;
|
||||||
EXPECT_CALL(delegate, OnTouchDown(window.surface(), testing::_, testing::_,
|
EXPECT_CALL(delegate, OnTouchDown(window.surface(), testing::_, testing::_,
|
||||||
gfx::PointF()));
|
gfx::PointF()));
|
||||||
EXPECT_CALL(stylus_delegate,
|
EXPECT_CALL(stylus_delegate, OnTouchTool(0, ui::EventPointerType::kPen));
|
||||||
OnTouchTool(0, ui::EventPointerType::POINTER_TYPE_PEN));
|
|
||||||
EXPECT_CALL(stylus_delegate, OnTouchForce(testing::_, 0, 1.0));
|
EXPECT_CALL(stylus_delegate, OnTouchForce(testing::_, 0, 1.0));
|
||||||
EXPECT_CALL(delegate, OnTouchFrame());
|
EXPECT_CALL(delegate, OnTouchFrame());
|
||||||
EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_));
|
EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_));
|
||||||
EXPECT_CALL(delegate, OnTouchFrame());
|
EXPECT_CALL(delegate, OnTouchFrame());
|
||||||
}
|
}
|
||||||
generator.set_current_screen_location(window.origin());
|
generator.set_current_screen_location(window.origin());
|
||||||
generator.SetTouchPointerType(ui::EventPointerType::POINTER_TYPE_PEN);
|
generator.SetTouchPointerType(ui::EventPointerType::kPen);
|
||||||
generator.SetTouchForce(1.0);
|
generator.SetTouchForce(1.0);
|
||||||
generator.PressTouch();
|
generator.PressTouch();
|
||||||
generator.ReleaseTouch();
|
generator.ReleaseTouch();
|
||||||
@ -483,8 +481,7 @@ TEST_F(TouchTest, OnTouchTilt) {
|
|||||||
testing::InSequence sequence;
|
testing::InSequence sequence;
|
||||||
EXPECT_CALL(delegate, OnTouchDown(window.surface(), testing::_, testing::_,
|
EXPECT_CALL(delegate, OnTouchDown(window.surface(), testing::_, testing::_,
|
||||||
gfx::PointF()));
|
gfx::PointF()));
|
||||||
EXPECT_CALL(stylus_delegate,
|
EXPECT_CALL(stylus_delegate, OnTouchTool(0, ui::EventPointerType::kPen));
|
||||||
OnTouchTool(0, ui::EventPointerType::POINTER_TYPE_PEN));
|
|
||||||
EXPECT_CALL(stylus_delegate,
|
EXPECT_CALL(stylus_delegate,
|
||||||
OnTouchTilt(testing::_, 0, gfx::Vector2dF(1.0, 2.0)));
|
OnTouchTilt(testing::_, 0, gfx::Vector2dF(1.0, 2.0)));
|
||||||
EXPECT_CALL(delegate, OnTouchFrame());
|
EXPECT_CALL(delegate, OnTouchFrame());
|
||||||
@ -492,7 +489,7 @@ TEST_F(TouchTest, OnTouchTilt) {
|
|||||||
EXPECT_CALL(delegate, OnTouchFrame());
|
EXPECT_CALL(delegate, OnTouchFrame());
|
||||||
}
|
}
|
||||||
generator.set_current_screen_location(window.origin());
|
generator.set_current_screen_location(window.origin());
|
||||||
generator.SetTouchPointerType(ui::EventPointerType::POINTER_TYPE_PEN);
|
generator.SetTouchPointerType(ui::EventPointerType::kPen);
|
||||||
generator.SetTouchTilt(1.0, 2.0);
|
generator.SetTouchTilt(1.0, 2.0);
|
||||||
generator.PressTouch();
|
generator.PressTouch();
|
||||||
generator.ReleaseTouch();
|
generator.ReleaseTouch();
|
||||||
|
@ -30,9 +30,9 @@ class WaylandTouchStylusDelegate : public TouchStylusDelegate {
|
|||||||
void OnTouchDestroying(Touch* touch) override { touch_ = nullptr; }
|
void OnTouchDestroying(Touch* touch) override { touch_ = nullptr; }
|
||||||
void OnTouchTool(int touch_id, ui::EventPointerType type) override {
|
void OnTouchTool(int touch_id, ui::EventPointerType type) override {
|
||||||
uint wayland_type = ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_TOUCH;
|
uint wayland_type = ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_TOUCH;
|
||||||
if (type == ui::EventPointerType::POINTER_TYPE_PEN)
|
if (type == ui::EventPointerType::kPen)
|
||||||
wayland_type = ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_PEN;
|
wayland_type = ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_PEN;
|
||||||
else if (type == ui::EventPointerType::POINTER_TYPE_ERASER)
|
else if (type == ui::EventPointerType::kEraser)
|
||||||
wayland_type = ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_ERASER;
|
wayland_type = ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_ERASER;
|
||||||
zcr_touch_stylus_v2_send_tool(resource_, touch_id, wayland_type);
|
zcr_touch_stylus_v2_send_tool(resource_, touch_id, wayland_type);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ class TouchSelectionControllerClientAura::EnvEventObserver
|
|||||||
// from touch as this can clear an active selection generated by the pen.
|
// from touch as this can clear an active selection generated by the pen.
|
||||||
if ((event.flags() & (ui::EF_IS_SYNTHESIZED | ui::EF_FROM_TOUCH)) ||
|
if ((event.flags() & (ui::EF_IS_SYNTHESIZED | ui::EF_FROM_TOUCH)) ||
|
||||||
event.AsMouseEvent()->pointer_details().pointer_type ==
|
event.AsMouseEvent()->pointer_details().pointer_type ==
|
||||||
ui::EventPointerType::POINTER_TYPE_PEN) {
|
ui::EventPointerType::kPen) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,9 +360,8 @@ class TouchSelectionControllerClientAuraSiteIsolationTest
|
|||||||
aura::Window* content_window = view->GetNativeView();
|
aura::Window* content_window = view->GetNativeView();
|
||||||
aura::Window::ConvertPointToTarget(content_window, shell_window, &point);
|
aura::Window::ConvertPointToTarget(content_window, shell_window, &point);
|
||||||
ui::EventSink* sink = content_window->GetHost()->event_sink();
|
ui::EventSink* sink = content_window->GetHost()->event_sink();
|
||||||
ui::TouchEvent touch(
|
ui::TouchEvent touch(type, point, ui::EventTimeForNow(),
|
||||||
type, point, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
ui::EventDispatchDetails details = sink->OnEventFromSource(&touch);
|
ui::EventDispatchDetails details = sink->OnEventFromSource(&touch);
|
||||||
ASSERT_FALSE(details.dispatcher_destroyed);
|
ASSERT_FALSE(details.dispatcher_destroyed);
|
||||||
}
|
}
|
||||||
@ -614,7 +613,7 @@ IN_PROC_BROWSER_TEST_P(TouchSelectionControllerClientAuraSiteIsolationTest,
|
|||||||
// 1) Send touch-down.
|
// 1) Send touch-down.
|
||||||
ui::TouchEvent touch_down(
|
ui::TouchEvent touch_down(
|
||||||
ui::ET_TOUCH_PRESSED, scroll_start_position, ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, scroll_start_position, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
parent_view->OnTouchEvent(&touch_down);
|
parent_view->OnTouchEvent(&touch_down);
|
||||||
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
|
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
|
||||||
selection_controller->active_status());
|
selection_controller->active_status());
|
||||||
@ -626,7 +625,7 @@ IN_PROC_BROWSER_TEST_P(TouchSelectionControllerClientAuraSiteIsolationTest,
|
|||||||
// 2) Send touch-move.
|
// 2) Send touch-move.
|
||||||
ui::TouchEvent touch_move(
|
ui::TouchEvent touch_move(
|
||||||
ui::ET_TOUCH_MOVED, scroll_end_position, ui::EventTimeForNow(),
|
ui::ET_TOUCH_MOVED, scroll_end_position, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
parent_view->OnTouchEvent(&touch_move);
|
parent_view->OnTouchEvent(&touch_move);
|
||||||
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
|
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
|
||||||
selection_controller->active_status());
|
selection_controller->active_status());
|
||||||
@ -683,9 +682,9 @@ IN_PROC_BROWSER_TEST_P(TouchSelectionControllerClientAuraSiteIsolationTest,
|
|||||||
EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning());
|
EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning());
|
||||||
|
|
||||||
// 3) Send touch-end.
|
// 3) Send touch-end.
|
||||||
ui::TouchEvent touch_up(
|
ui::TouchEvent touch_up(ui::ET_TOUCH_RELEASED, scroll_end_position,
|
||||||
ui::ET_TOUCH_RELEASED, scroll_end_position, ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
parent_view->OnTouchEvent(&touch_up);
|
parent_view->OnTouchEvent(&touch_up);
|
||||||
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
|
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
|
||||||
selection_controller->active_status());
|
selection_controller->active_status());
|
||||||
@ -856,7 +855,7 @@ IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraTest, HiddenOnScroll) {
|
|||||||
// there.
|
// there.
|
||||||
ui::TouchEvent touch_down(
|
ui::TouchEvent touch_down(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
rwhva->OnTouchEvent(&touch_down);
|
rwhva->OnTouchEvent(&touch_down);
|
||||||
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
|
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
|
||||||
rwhva->selection_controller()->active_status());
|
rwhva->selection_controller()->active_status());
|
||||||
@ -888,9 +887,9 @@ IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraTest, HiddenOnScroll) {
|
|||||||
EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning());
|
EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning());
|
||||||
|
|
||||||
// Lift the finger up: the quick menu should re-appear.
|
// Lift the finger up: the quick menu should re-appear.
|
||||||
ui::TouchEvent touch_up(
|
ui::TouchEvent touch_up(ui::ET_TOUCH_RELEASED, gfx::Point(10, 10),
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
rwhva->OnTouchEvent(&touch_up);
|
rwhva->OnTouchEvent(&touch_up);
|
||||||
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
|
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
|
||||||
rwhva->selection_controller()->active_status());
|
rwhva->selection_controller()->active_status());
|
||||||
@ -980,7 +979,7 @@ IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraScaleFactorTest,
|
|||||||
ui::SELECTION_HANDLE_DRAG_STARTED);
|
ui::SELECTION_HANDLE_DRAG_STARTED);
|
||||||
ui::TouchEvent touch_down(
|
ui::TouchEvent touch_down(
|
||||||
ui::ET_TOUCH_PRESSED, handle_point, ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, handle_point, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
rwhva->OnTouchEvent(&touch_down);
|
rwhva->OnTouchEvent(&touch_down);
|
||||||
selection_controller_client()->Wait();
|
selection_controller_client()->Wait();
|
||||||
|
|
||||||
@ -990,16 +989,16 @@ IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraScaleFactorTest,
|
|||||||
handle_point.Offset(10, 0);
|
handle_point.Offset(10, 0);
|
||||||
ui::TouchEvent touch_move(
|
ui::TouchEvent touch_move(
|
||||||
ui::ET_TOUCH_MOVED, handle_point, ui::EventTimeForNow(),
|
ui::ET_TOUCH_MOVED, handle_point, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
rwhva->OnTouchEvent(&touch_move);
|
rwhva->OnTouchEvent(&touch_move);
|
||||||
selection_controller_client()->Wait();
|
selection_controller_client()->Wait();
|
||||||
|
|
||||||
// Then release.
|
// Then release.
|
||||||
selection_controller_client()->InitWaitForSelectionEvent(
|
selection_controller_client()->InitWaitForSelectionEvent(
|
||||||
ui::SELECTION_HANDLE_DRAG_STOPPED);
|
ui::SELECTION_HANDLE_DRAG_STOPPED);
|
||||||
ui::TouchEvent touch_up(
|
ui::TouchEvent touch_up(ui::ET_TOUCH_RELEASED, handle_point,
|
||||||
ui::ET_TOUCH_RELEASED, handle_point, ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
rwhva->OnTouchEvent(&touch_up);
|
rwhva->OnTouchEvent(&touch_up);
|
||||||
selection_controller_client()->Wait();
|
selection_controller_client()->Wait();
|
||||||
|
|
||||||
@ -1058,7 +1057,7 @@ IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraScaleFactorTest,
|
|||||||
ui::INSERTION_HANDLE_DRAG_STARTED);
|
ui::INSERTION_HANDLE_DRAG_STARTED);
|
||||||
ui::TouchEvent touch_down(
|
ui::TouchEvent touch_down(
|
||||||
ui::ET_TOUCH_PRESSED, handle_point, ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, handle_point, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
rwhva->OnTouchEvent(&touch_down);
|
rwhva->OnTouchEvent(&touch_down);
|
||||||
selection_controller_client()->Wait();
|
selection_controller_client()->Wait();
|
||||||
|
|
||||||
@ -1068,16 +1067,16 @@ IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraScaleFactorTest,
|
|||||||
handle_point.Offset(10, 0);
|
handle_point.Offset(10, 0);
|
||||||
ui::TouchEvent touch_move(
|
ui::TouchEvent touch_move(
|
||||||
ui::ET_TOUCH_MOVED, handle_point, ui::EventTimeForNow(),
|
ui::ET_TOUCH_MOVED, handle_point, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
rwhva->OnTouchEvent(&touch_move);
|
rwhva->OnTouchEvent(&touch_move);
|
||||||
selection_controller_client()->Wait();
|
selection_controller_client()->Wait();
|
||||||
|
|
||||||
// Then release.
|
// Then release.
|
||||||
selection_controller_client()->InitWaitForSelectionEvent(
|
selection_controller_client()->InitWaitForSelectionEvent(
|
||||||
ui::INSERTION_HANDLE_DRAG_STOPPED);
|
ui::INSERTION_HANDLE_DRAG_STOPPED);
|
||||||
ui::TouchEvent touch_up(
|
ui::TouchEvent touch_up(ui::ET_TOUCH_RELEASED, handle_point,
|
||||||
ui::ET_TOUCH_RELEASED, handle_point, ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
rwhva->OnTouchEvent(&touch_up);
|
rwhva->OnTouchEvent(&touch_up);
|
||||||
selection_controller_client()->Wait();
|
selection_controller_client()->Wait();
|
||||||
|
|
||||||
|
@ -1354,11 +1354,11 @@ ui::TextInputClient::FocusReason RenderWidgetHostViewAura::GetFocusReason()
|
|||||||
return ui::TextInputClient::FOCUS_REASON_NONE;
|
return ui::TextInputClient::FOCUS_REASON_NONE;
|
||||||
|
|
||||||
switch (last_pointer_type_before_focus_) {
|
switch (last_pointer_type_before_focus_) {
|
||||||
case ui::EventPointerType::POINTER_TYPE_MOUSE:
|
case ui::EventPointerType::kMouse:
|
||||||
return ui::TextInputClient::FOCUS_REASON_MOUSE;
|
return ui::TextInputClient::FOCUS_REASON_MOUSE;
|
||||||
case ui::EventPointerType::POINTER_TYPE_PEN:
|
case ui::EventPointerType::kPen:
|
||||||
return ui::TextInputClient::FOCUS_REASON_PEN;
|
return ui::TextInputClient::FOCUS_REASON_PEN;
|
||||||
case ui::EventPointerType::POINTER_TYPE_TOUCH:
|
case ui::EventPointerType::kTouch:
|
||||||
return ui::TextInputClient::FOCUS_REASON_TOUCH;
|
return ui::TextInputClient::FOCUS_REASON_TOUCH;
|
||||||
default:
|
default:
|
||||||
return ui::TextInputClient::FOCUS_REASON_OTHER;
|
return ui::TextInputClient::FOCUS_REASON_OTHER;
|
||||||
@ -1718,7 +1718,7 @@ bool RenderWidgetHostViewAura::RequiresDoubleTapGestureEvents() const {
|
|||||||
// RenderWidgetHostViewAura, ui::EventHandler implementation:
|
// RenderWidgetHostViewAura, ui::EventHandler implementation:
|
||||||
|
|
||||||
void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) {
|
void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) {
|
||||||
last_pointer_type_ = ui::EventPointerType::POINTER_TYPE_UNKNOWN;
|
last_pointer_type_ = ui::EventPointerType::kUnknown;
|
||||||
event_handler_->OnKeyEvent(event);
|
event_handler_->OnKeyEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1733,7 +1733,7 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
|
|||||||
last_mouse_move_location_ = event->location();
|
last_mouse_move_location_ = event->location();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
last_pointer_type_ = ui::EventPointerType::POINTER_TYPE_MOUSE;
|
last_pointer_type_ = ui::EventPointerType::kMouse;
|
||||||
event_handler_->OnMouseEvent(event);
|
event_handler_->OnMouseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1785,7 +1785,7 @@ void RenderWidgetHostViewAura::FocusedNodeChanged(
|
|||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
bool dismiss_virtual_keyboard =
|
bool dismiss_virtual_keyboard =
|
||||||
last_pointer_type_ == ui::EventPointerType::POINTER_TYPE_TOUCH;
|
last_pointer_type_ == ui::EventPointerType::kTouch;
|
||||||
if (dismiss_virtual_keyboard && !editable && virtual_keyboard_requested_ &&
|
if (dismiss_virtual_keyboard && !editable && virtual_keyboard_requested_ &&
|
||||||
window_) {
|
window_) {
|
||||||
virtual_keyboard_requested_ = false;
|
virtual_keyboard_requested_ = false;
|
||||||
@ -2424,12 +2424,11 @@ void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled(
|
|||||||
state->mode != ui::TEXT_INPUT_MODE_NONE) {
|
state->mode != ui::TEXT_INPUT_MODE_NONE) {
|
||||||
bool show_virtual_keyboard = true;
|
bool show_virtual_keyboard = true;
|
||||||
#if defined(OS_FUCHSIA)
|
#if defined(OS_FUCHSIA)
|
||||||
show_virtual_keyboard =
|
show_virtual_keyboard = last_pointer_type_ == ui::EventPointerType::kTouch;
|
||||||
last_pointer_type_ == ui::EventPointerType::POINTER_TYPE_TOUCH;
|
|
||||||
#elif defined(OS_WIN)
|
#elif defined(OS_WIN)
|
||||||
show_virtual_keyboard =
|
show_virtual_keyboard =
|
||||||
last_pointer_type_ == ui::EventPointerType::POINTER_TYPE_TOUCH ||
|
last_pointer_type_ == ui::EventPointerType::kTouch ||
|
||||||
last_pointer_type_ == ui::EventPointerType::POINTER_TYPE_PEN;
|
last_pointer_type_ == ui::EventPointerType::kPen;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OS_WIN)
|
#if !defined(OS_WIN)
|
||||||
|
@ -672,12 +672,11 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
|
|||||||
uint32_t latest_capture_sequence_number_ = 0u;
|
uint32_t latest_capture_sequence_number_ = 0u;
|
||||||
|
|
||||||
// The pointer type of the most recent gesture/mouse/touch event.
|
// The pointer type of the most recent gesture/mouse/touch event.
|
||||||
ui::EventPointerType last_pointer_type_ =
|
ui::EventPointerType last_pointer_type_ = ui::EventPointerType::kUnknown;
|
||||||
ui::EventPointerType::POINTER_TYPE_UNKNOWN;
|
|
||||||
// The pointer type that caused the most recent focus. This value will be
|
// The pointer type that caused the most recent focus. This value will be
|
||||||
// incorrect if the focus was not triggered by a user gesture.
|
// incorrect if the focus was not triggered by a user gesture.
|
||||||
ui::EventPointerType last_pointer_type_before_focus_ =
|
ui::EventPointerType last_pointer_type_before_focus_ =
|
||||||
ui::EventPointerType::POINTER_TYPE_UNKNOWN;
|
ui::EventPointerType::kUnknown;
|
||||||
|
|
||||||
bool is_first_navigation_ = true;
|
bool is_first_navigation_ = true;
|
||||||
viz::LocalSurfaceIdAllocation inset_surface_id_allocation_;
|
viz::LocalSurfaceIdAllocation inset_surface_id_allocation_;
|
||||||
|
@ -1377,15 +1377,15 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventState) {
|
|||||||
widget_host_->OnMessageReceived(
|
widget_host_->OnMessageReceived(
|
||||||
WidgetHostMsg_HasTouchEventHandlers(0, false));
|
WidgetHostMsg_HasTouchEventHandlers(0, false));
|
||||||
|
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::TouchEvent move(
|
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(20, 20),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(20, 20), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20),
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
// The touch events should get forwarded from the view but only the discrete
|
// The touch events should get forwarded from the view but only the discrete
|
||||||
// events should make it all the way to the renderer.
|
// events should make it all the way to the renderer.
|
||||||
@ -1454,18 +1454,18 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventState) {
|
|||||||
events = GetAndResetDispatchedMessages();
|
events = GetAndResetDispatchedMessages();
|
||||||
EXPECT_EQ(0U, events.size());
|
EXPECT_EQ(0U, events.size());
|
||||||
|
|
||||||
ui::TouchEvent move2(
|
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(20, 20), base::TimeTicks::Now(),
|
base::TimeTicks::Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
view_->OnTouchEvent(&move2);
|
view_->OnTouchEvent(&move2);
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
EXPECT_TRUE(press.synchronous_handling_disabled());
|
EXPECT_TRUE(press.synchronous_handling_disabled());
|
||||||
EXPECT_EQ(ui::MotionEvent::Action::MOVE, pointer_state().GetAction());
|
EXPECT_EQ(ui::MotionEvent::Action::MOVE, pointer_state().GetAction());
|
||||||
EXPECT_EQ(1U, pointer_state().GetPointerCount());
|
EXPECT_EQ(1U, pointer_state().GetPointerCount());
|
||||||
|
|
||||||
ui::TouchEvent release2(
|
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20),
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), base::TimeTicks::Now(),
|
base::TimeTicks::Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
view_->OnTouchEvent(&release2);
|
view_->OnTouchEvent(&release2);
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
EXPECT_TRUE(press.synchronous_handling_disabled());
|
EXPECT_TRUE(press.synchronous_handling_disabled());
|
||||||
@ -2359,9 +2359,9 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
|
|||||||
view_->Show();
|
view_->Show();
|
||||||
view_->UseFakeDispatcher();
|
view_->UseFakeDispatcher();
|
||||||
|
|
||||||
ui::TouchEvent press0(
|
ui::TouchEvent press0(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
view_->OnTouchEvent(&press0);
|
view_->OnTouchEvent(&press0);
|
||||||
view_->GetFocusedWidget()->input_router()->OnSetTouchAction(
|
view_->GetFocusedWidget()->input_router()->OnSetTouchAction(
|
||||||
@ -2377,9 +2377,9 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
|
|||||||
EXPECT_EQ(1U, pointer_state().GetPointerCount());
|
EXPECT_EQ(1U, pointer_state().GetPointerCount());
|
||||||
EXPECT_EQ(1U, view_->dispatcher_->GetAndResetProcessedTouchEventCount());
|
EXPECT_EQ(1U, view_->dispatcher_->GetAndResetProcessedTouchEventCount());
|
||||||
|
|
||||||
ui::TouchEvent move0(
|
ui::TouchEvent move0(ui::ET_TOUCH_MOVED, gfx::Point(20, 20),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(20, 20), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
view_->OnTouchEvent(&move0);
|
view_->OnTouchEvent(&move0);
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
@ -2393,9 +2393,9 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
|
|||||||
|
|
||||||
// For the second touchstart, only the state of the second touch point is
|
// For the second touchstart, only the state of the second touch point is
|
||||||
// StatePressed, the state of the first touch point is StateStationary.
|
// StatePressed, the state of the first touch point is StateStationary.
|
||||||
ui::TouchEvent press1(
|
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
|
|
||||||
view_->OnTouchEvent(&press1);
|
view_->OnTouchEvent(&press1);
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
@ -2410,9 +2410,9 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
|
|||||||
|
|
||||||
// For the touchmove of second point, the state of the second touch point is
|
// For the touchmove of second point, the state of the second touch point is
|
||||||
// StateMoved, the state of the first touch point is StateStationary.
|
// StateMoved, the state of the first touch point is StateStationary.
|
||||||
ui::TouchEvent move1(
|
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(30, 30),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(30, 30), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
|
|
||||||
view_->OnTouchEvent(&move1);
|
view_->OnTouchEvent(&move1);
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
@ -2426,9 +2426,9 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
|
|||||||
|
|
||||||
// For the touchmove of first point, the state of the first touch point is
|
// For the touchmove of first point, the state of the first touch point is
|
||||||
// StateMoved, the state of the second touch point is StateStationary.
|
// StateMoved, the state of the second touch point is StateStationary.
|
||||||
ui::TouchEvent move2(
|
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(10, 10),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
view_->OnTouchEvent(&move2);
|
view_->OnTouchEvent(&move2);
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
@ -2440,9 +2440,9 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
|
|||||||
EXPECT_EQ(2U, pointer_state().GetPointerCount());
|
EXPECT_EQ(2U, pointer_state().GetPointerCount());
|
||||||
EXPECT_EQ(1U, view_->dispatcher_->GetAndResetProcessedTouchEventCount());
|
EXPECT_EQ(1U, view_->dispatcher_->GetAndResetProcessedTouchEventCount());
|
||||||
|
|
||||||
ui::TouchEvent cancel0(
|
ui::TouchEvent cancel0(ui::ET_TOUCH_CANCELLED, gfx::Point(10, 10),
|
||||||
ui::ET_TOUCH_CANCELLED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
// For the touchcancel, only the state of the current touch point is
|
// For the touchcancel, only the state of the current touch point is
|
||||||
// StateCancelled, the state of the other touch point is StateStationary.
|
// StateCancelled, the state of the other touch point is StateStationary.
|
||||||
@ -2453,9 +2453,9 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
|
|||||||
EXPECT_EQ(1U, pointer_state().GetPointerCount());
|
EXPECT_EQ(1U, pointer_state().GetPointerCount());
|
||||||
EXPECT_EQ(1U, view_->dispatcher_->GetAndResetProcessedTouchEventCount());
|
EXPECT_EQ(1U, view_->dispatcher_->GetAndResetProcessedTouchEventCount());
|
||||||
|
|
||||||
ui::TouchEvent cancel1(
|
ui::TouchEvent cancel1(ui::ET_TOUCH_CANCELLED, gfx::Point(30, 30),
|
||||||
ui::ET_TOUCH_CANCELLED, gfx::Point(30, 30), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
|
|
||||||
view_->OnTouchEvent(&cancel1);
|
view_->OnTouchEvent(&cancel1);
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
@ -2473,15 +2473,15 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventSyncAsync) {
|
|||||||
|
|
||||||
widget_host_->OnMessageReceived(WidgetHostMsg_HasTouchEventHandlers(0, true));
|
widget_host_->OnMessageReceived(WidgetHostMsg_HasTouchEventHandlers(0, true));
|
||||||
|
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::TouchEvent move(
|
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(20, 20),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(20, 20), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20),
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
view_->OnTouchEvent(&press);
|
view_->OnTouchEvent(&press);
|
||||||
EXPECT_TRUE(press.synchronous_handling_disabled());
|
EXPECT_TRUE(press.synchronous_handling_disabled());
|
||||||
@ -3352,15 +3352,15 @@ TEST_F(RenderWidgetHostViewAuraTest, SourceEventTypeExistsInLatencyInfo) {
|
|||||||
ui::SourceEventType::WHEEL);
|
ui::SourceEventType::WHEEL);
|
||||||
|
|
||||||
// TOUCH source exists.
|
// TOUCH source exists.
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::TouchEvent move(
|
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(20, 20),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(20, 20), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20),
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
view_->OnTouchEvent(&press);
|
view_->OnTouchEvent(&press);
|
||||||
view_->OnTouchEvent(&move);
|
view_->OnTouchEvent(&move);
|
||||||
EXPECT_EQ(widget_host_->lastWheelOrTouchEventLatencyInfo.source_event_type(),
|
EXPECT_EQ(widget_host_->lastWheelOrTouchEventLatencyInfo.source_event_type(),
|
||||||
@ -3429,9 +3429,9 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventPositionsArentRounded) {
|
|||||||
view_->InitAsChild(nullptr);
|
view_->InitAsChild(nullptr);
|
||||||
view_->Show();
|
view_->Show();
|
||||||
|
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
press.set_location_f(gfx::PointF(kX, kY));
|
press.set_location_f(gfx::PointF(kX, kY));
|
||||||
press.set_root_location_f(gfx::PointF(kX, kY));
|
press.set_root_location_f(gfx::PointF(kX, kY));
|
||||||
|
|
||||||
@ -4938,14 +4938,14 @@ TEST_F(RenderWidgetHostViewAuraTest,
|
|||||||
|
|
||||||
widget_host_->OnMessageReceived(WidgetHostMsg_HasTouchEventHandlers(0, true));
|
widget_host_->OnMessageReceived(WidgetHostMsg_HasTouchEventHandlers(0, true));
|
||||||
|
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
// Construct a move with a touch id which doesn't exist.
|
// Construct a move with a touch id which doesn't exist.
|
||||||
ui::TouchEvent invalid_move(
|
ui::TouchEvent invalid_move(
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(30, 30), ui::EventTimeForNow(),
|
ui::ET_TOUCH_MOVED, gfx::Point(30, 30), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
|
|
||||||
// Valid press is handled asynchronously.
|
// Valid press is handled asynchronously.
|
||||||
view_->OnTouchEvent(&press);
|
view_->OnTouchEvent(&press);
|
||||||
@ -5080,9 +5080,9 @@ TEST_F(RenderWidgetHostViewAuraTest, CorrectNumberOfAcksAreDispatched) {
|
|||||||
view_->Show();
|
view_->Show();
|
||||||
view_->UseFakeDispatcher();
|
view_->UseFakeDispatcher();
|
||||||
|
|
||||||
ui::TouchEvent press1(
|
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
view_->OnTouchEvent(&press1);
|
view_->OnTouchEvent(&press1);
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
@ -5092,9 +5092,9 @@ TEST_F(RenderWidgetHostViewAuraTest, CorrectNumberOfAcksAreDispatched) {
|
|||||||
events[1]->ToEvent()->CallCallback(
|
events[1]->ToEvent()->CallCallback(
|
||||||
blink::mojom::InputEventResultState::kConsumed);
|
blink::mojom::InputEventResultState::kConsumed);
|
||||||
|
|
||||||
ui::TouchEvent press2(
|
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
view_->OnTouchEvent(&press2);
|
view_->OnTouchEvent(&press2);
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
events = GetAndResetDispatchedMessages();
|
events = GetAndResetDispatchedMessages();
|
||||||
@ -6221,8 +6221,7 @@ TEST_F(RenderWidgetHostViewAuraTest, FocusReasonTouch) {
|
|||||||
|
|
||||||
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
||||||
tap_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHSCREEN);
|
tap_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHSCREEN);
|
||||||
tap_details.set_primary_pointer_type(
|
tap_details.set_primary_pointer_type(ui::EventPointerType::kTouch);
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH);
|
|
||||||
ui::GestureEvent touch_event(0, 0, 0, base::TimeTicks(), tap_details);
|
ui::GestureEvent touch_event(0, 0, 0, base::TimeTicks(), tap_details);
|
||||||
|
|
||||||
parent_view_->OnGestureEvent(&touch_event);
|
parent_view_->OnGestureEvent(&touch_event);
|
||||||
@ -6238,7 +6237,7 @@ TEST_F(RenderWidgetHostViewAuraTest, FocusReasonPen) {
|
|||||||
|
|
||||||
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
||||||
tap_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHSCREEN);
|
tap_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHSCREEN);
|
||||||
tap_details.set_primary_pointer_type(ui::EventPointerType::POINTER_TYPE_PEN);
|
tap_details.set_primary_pointer_type(ui::EventPointerType::kPen);
|
||||||
ui::GestureEvent pen_event(0, 0, 0, base::TimeTicks(), tap_details);
|
ui::GestureEvent pen_event(0, 0, 0, base::TimeTicks(), tap_details);
|
||||||
|
|
||||||
parent_view_->OnGestureEvent(&pen_event);
|
parent_view_->OnGestureEvent(&pen_event);
|
||||||
@ -6256,8 +6255,7 @@ TEST_F(RenderWidgetHostViewAuraTest, FocusReasonMultipleEventsOnSameNode) {
|
|||||||
{
|
{
|
||||||
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
||||||
tap_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHSCREEN);
|
tap_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHSCREEN);
|
||||||
tap_details.set_primary_pointer_type(
|
tap_details.set_primary_pointer_type(ui::EventPointerType::kTouch);
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH);
|
|
||||||
ui::GestureEvent touch_event(0, 0, 0, base::TimeTicks(), tap_details);
|
ui::GestureEvent touch_event(0, 0, 0, base::TimeTicks(), tap_details);
|
||||||
|
|
||||||
parent_view_->OnGestureEvent(&touch_event);
|
parent_view_->OnGestureEvent(&touch_event);
|
||||||
@ -6267,8 +6265,7 @@ TEST_F(RenderWidgetHostViewAuraTest, FocusReasonMultipleEventsOnSameNode) {
|
|||||||
{
|
{
|
||||||
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
||||||
tap_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHSCREEN);
|
tap_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHSCREEN);
|
||||||
tap_details.set_primary_pointer_type(
|
tap_details.set_primary_pointer_type(ui::EventPointerType::kPen);
|
||||||
ui::EventPointerType::POINTER_TYPE_PEN);
|
|
||||||
ui::GestureEvent pen_event(0, 0, 0, base::TimeTicks(), tap_details);
|
ui::GestureEvent pen_event(0, 0, 0, base::TimeTicks(), tap_details);
|
||||||
|
|
||||||
parent_view_->OnGestureEvent(&pen_event);
|
parent_view_->OnGestureEvent(&pen_event);
|
||||||
@ -6421,7 +6418,7 @@ class RenderWidgetHostViewAuraKeyboardTest
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(RenderWidgetHostViewAuraKeyboardTest, KeyboardObserverDestroyed) {
|
TEST_F(RenderWidgetHostViewAuraKeyboardTest, KeyboardObserverDestroyed) {
|
||||||
parent_view_->SetLastPointerType(ui::EventPointerType::POINTER_TYPE_TOUCH);
|
parent_view_->SetLastPointerType(ui::EventPointerType::kTouch);
|
||||||
ActivateViewForTextInputManager(parent_view_, ui::TEXT_INPUT_TYPE_TEXT);
|
ActivateViewForTextInputManager(parent_view_, ui::TEXT_INPUT_TYPE_TEXT);
|
||||||
EXPECT_NE(parent_view_->keyboard_observer_.get(), nullptr);
|
EXPECT_NE(parent_view_->keyboard_observer_.get(), nullptr);
|
||||||
EXPECT_EQ(keyboard_controller_observer_count(), 1u);
|
EXPECT_EQ(keyboard_controller_observer_count(), 1u);
|
||||||
@ -6438,7 +6435,7 @@ TEST_F(RenderWidgetHostViewAuraKeyboardTest, NoKeyboardObserverForMouseInput) {
|
|||||||
// removed after it has been registered with a touch input and we received a
|
// removed after it has been registered with a touch input and we received a
|
||||||
// mouse event.
|
// mouse event.
|
||||||
// Do not show virtual keyboard for mouse inputs.
|
// Do not show virtual keyboard for mouse inputs.
|
||||||
parent_view_->SetLastPointerType(ui::EventPointerType::POINTER_TYPE_MOUSE);
|
parent_view_->SetLastPointerType(ui::EventPointerType::kMouse);
|
||||||
ActivateViewForTextInputManager(parent_view_, ui::TEXT_INPUT_TYPE_TEXT);
|
ActivateViewForTextInputManager(parent_view_, ui::TEXT_INPUT_TYPE_TEXT);
|
||||||
EXPECT_EQ(parent_view_->keyboard_observer_.get(), nullptr);
|
EXPECT_EQ(parent_view_->keyboard_observer_.get(), nullptr);
|
||||||
EXPECT_EQ(keyboard_controller_observer_count(), 0u);
|
EXPECT_EQ(keyboard_controller_observer_count(), 0u);
|
||||||
@ -6448,7 +6445,7 @@ TEST_F(RenderWidgetHostViewAuraKeyboardTest, NoKeyboardObserverForMouseInput) {
|
|||||||
TEST_F(RenderWidgetHostViewAuraKeyboardTest,
|
TEST_F(RenderWidgetHostViewAuraKeyboardTest,
|
||||||
KeyboardObserverForOnlyTouchInput) {
|
KeyboardObserverForOnlyTouchInput) {
|
||||||
// Show virtual keyboard for touch inputs.
|
// Show virtual keyboard for touch inputs.
|
||||||
parent_view_->SetLastPointerType(ui::EventPointerType::POINTER_TYPE_TOUCH);
|
parent_view_->SetLastPointerType(ui::EventPointerType::kTouch);
|
||||||
ActivateViewForTextInputManager(parent_view_, ui::TEXT_INPUT_TYPE_TEXT);
|
ActivateViewForTextInputManager(parent_view_, ui::TEXT_INPUT_TYPE_TEXT);
|
||||||
EXPECT_NE(parent_view_->keyboard_observer_.get(), nullptr);
|
EXPECT_NE(parent_view_->keyboard_observer_.get(), nullptr);
|
||||||
EXPECT_EQ(keyboard_controller_observer_count(), 1u);
|
EXPECT_EQ(keyboard_controller_observer_count(), 1u);
|
||||||
@ -6458,7 +6455,7 @@ TEST_F(RenderWidgetHostViewAuraKeyboardTest,
|
|||||||
TEST_F(RenderWidgetHostViewAuraKeyboardTest,
|
TEST_F(RenderWidgetHostViewAuraKeyboardTest,
|
||||||
KeyboardObserverForFocusedNodeChanged) {
|
KeyboardObserverForFocusedNodeChanged) {
|
||||||
// Show virtual keyboard for touch inputs.
|
// Show virtual keyboard for touch inputs.
|
||||||
parent_view_->SetLastPointerType(ui::EventPointerType::POINTER_TYPE_TOUCH);
|
parent_view_->SetLastPointerType(ui::EventPointerType::kTouch);
|
||||||
ActivateViewForTextInputManager(parent_view_, ui::TEXT_INPUT_TYPE_TEXT);
|
ActivateViewForTextInputManager(parent_view_, ui::TEXT_INPUT_TYPE_TEXT);
|
||||||
EXPECT_EQ(IsKeyboardVisible(), true);
|
EXPECT_EQ(IsKeyboardVisible(), true);
|
||||||
EXPECT_NE(parent_view_->keyboard_observer_.get(), nullptr);
|
EXPECT_NE(parent_view_->keyboard_observer_.get(), nullptr);
|
||||||
@ -6478,7 +6475,7 @@ TEST_F(RenderWidgetHostViewAuraKeyboardTest,
|
|||||||
|
|
||||||
TEST_F(RenderWidgetHostViewAuraKeyboardTest, KeyboardObserverForPenInput) {
|
TEST_F(RenderWidgetHostViewAuraKeyboardTest, KeyboardObserverForPenInput) {
|
||||||
// Show virtual keyboard for pen inputs.
|
// Show virtual keyboard for pen inputs.
|
||||||
parent_view_->SetLastPointerType(ui::EventPointerType::POINTER_TYPE_PEN);
|
parent_view_->SetLastPointerType(ui::EventPointerType::kPen);
|
||||||
ActivateViewForTextInputManager(parent_view_, ui::TEXT_INPUT_TYPE_TEXT);
|
ActivateViewForTextInputManager(parent_view_, ui::TEXT_INPUT_TYPE_TEXT);
|
||||||
EXPECT_NE(parent_view_->keyboard_observer_.get(), nullptr);
|
EXPECT_NE(parent_view_->keyboard_observer_.get(), nullptr);
|
||||||
EXPECT_EQ(keyboard_controller_observer_count(), 1u);
|
EXPECT_EQ(keyboard_controller_observer_count(), 1u);
|
||||||
|
@ -78,7 +78,7 @@ bool MakeUITouchEventsFromWebTouchEvents(
|
|||||||
location = point.PositionInScreen();
|
location = point.PositionInScreen();
|
||||||
auto uievent = std::make_unique<ui::TouchEvent>(
|
auto uievent = std::make_unique<ui::TouchEvent>(
|
||||||
type, gfx::Point(), timestamp,
|
type, gfx::Point(), timestamp,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, point.id,
|
ui::PointerDetails(ui::EventPointerType::kTouch, point.id,
|
||||||
point.radius_x, point.radius_y, point.force,
|
point.radius_x, point.radius_y, point.force,
|
||||||
point.rotation_angle),
|
point.rotation_angle),
|
||||||
flags);
|
flags);
|
||||||
|
@ -2465,7 +2465,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessHitTestBrowserTest,
|
|||||||
.ExtractInt();
|
.ExtractInt();
|
||||||
const int inset_height = 200;
|
const int inset_height = 200;
|
||||||
parent_render_widget_host_aura->SetLastPointerType(
|
parent_render_widget_host_aura->SetLastPointerType(
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH);
|
ui::EventPointerType::kTouch);
|
||||||
parent_render_widget_host_aura->SetInsets(gfx::Insets(0, 0, inset_height, 0));
|
parent_render_widget_host_aura->SetInsets(gfx::Insets(0, 0, inset_height, 0));
|
||||||
|
|
||||||
// After focus on editable element, we expect element to be scrolled
|
// After focus on editable element, we expect element to be scrolled
|
||||||
@ -4725,13 +4725,13 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessHitTestBrowserTest,
|
|||||||
observer.Wait();
|
observer.Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
ui::TouchEvent touch_event(
|
ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center,
|
||||||
ui::ET_TOUCH_PRESSED, child_center, ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 30.0f,
|
/* radius_x */ 30.0f,
|
||||||
/* radius_y */ 30.0f,
|
/* radius_y */ 30.0f,
|
||||||
/* force */ 0.0f));
|
/* force */ 0.0f));
|
||||||
UpdateEventRootLocation(&touch_event, rwhv);
|
UpdateEventRootLocation(&touch_event, rwhv);
|
||||||
rwhv->OnTouchEvent(&touch_event);
|
rwhv->OnTouchEvent(&touch_event);
|
||||||
waiter.Wait();
|
waiter.Wait();
|
||||||
@ -4796,13 +4796,13 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessHitTestBrowserTest,
|
|||||||
observer->Wait();
|
observer->Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
ui::TouchEvent touch_event(
|
ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, frame_center,
|
||||||
ui::ET_TOUCH_PRESSED, frame_center, ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 30.0f,
|
/* radius_x */ 30.0f,
|
||||||
/* radius_y */ 30.0f,
|
/* radius_y */ 30.0f,
|
||||||
/* force */ 0.0f));
|
/* force */ 0.0f));
|
||||||
UpdateEventRootLocation(&touch_event, rwhv);
|
UpdateEventRootLocation(&touch_event, rwhv);
|
||||||
rwhv->OnTouchEvent(&touch_event);
|
rwhv->OnTouchEvent(&touch_event);
|
||||||
{
|
{
|
||||||
@ -4906,7 +4906,7 @@ uint32_t SendTouchTapWithExpectedTarget(
|
|||||||
}
|
}
|
||||||
ui::TouchEvent touch_event_pressed(
|
ui::TouchEvent touch_event_pressed(
|
||||||
ui::ET_TOUCH_PRESSED, touch_point, ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, touch_point, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 30.0f,
|
/* radius_x */ 30.0f,
|
||||||
/* radius_y */ 30.0f,
|
/* radius_y */ 30.0f,
|
||||||
@ -4923,7 +4923,7 @@ uint32_t SendTouchTapWithExpectedTarget(
|
|||||||
EXPECT_EQ(expected_target, router_touch_target);
|
EXPECT_EQ(expected_target, router_touch_target);
|
||||||
ui::TouchEvent touch_event_released(
|
ui::TouchEvent touch_event_released(
|
||||||
ui::ET_TOUCH_RELEASED, touch_point, ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, touch_point, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 30.0f,
|
/* radius_x */ 30.0f,
|
||||||
/* radius_y */ 30.0f,
|
/* radius_y */ 30.0f,
|
||||||
@ -6069,7 +6069,7 @@ class SitePerProcessGestureHitTestBrowserTest
|
|||||||
// will crash in the renderer otherwise.
|
// will crash in the renderer otherwise.
|
||||||
ui::TouchEvent touch_pressed(
|
ui::TouchEvent touch_pressed(
|
||||||
ui::ET_TOUCH_PRESSED, position, ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, position, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 1.0f,
|
/* radius_x */ 1.0f,
|
||||||
/* radius_y */ 1.0f,
|
/* radius_y */ 1.0f,
|
||||||
@ -6134,7 +6134,7 @@ class SitePerProcessGestureHitTestBrowserTest
|
|||||||
// after pinch gestures.
|
// after pinch gestures.
|
||||||
ui::TouchEvent touch_released(
|
ui::TouchEvent touch_released(
|
||||||
ui::ET_TOUCH_RELEASED, position, ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, position, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 1.0f,
|
/* radius_x */ 1.0f,
|
||||||
/* radius_y */ 1.0f,
|
/* radius_y */ 1.0f,
|
||||||
|
@ -473,7 +473,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
|
|||||||
ui::TouchEvent press(
|
ui::TouchEvent press(
|
||||||
ui::ET_TOUCH_PRESSED,
|
ui::ET_TOUCH_PRESSED,
|
||||||
gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5), timestamp,
|
gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5), timestamp,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::EventDispatchDetails details = sink->OnEventFromSource(&press);
|
ui::EventDispatchDetails details = sink->OnEventFromSource(&press);
|
||||||
ASSERT_FALSE(details.dispatcher_destroyed);
|
ASSERT_FALSE(details.dispatcher_destroyed);
|
||||||
EXPECT_EQ(1, GetCurrentIndex());
|
EXPECT_EQ(1, GetCurrentIndex());
|
||||||
@ -481,8 +481,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
|
|||||||
timestamp += base::TimeDelta::FromMilliseconds(10);
|
timestamp += base::TimeDelta::FromMilliseconds(10);
|
||||||
ui::TouchEvent move1(
|
ui::TouchEvent move1(
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(bounds.right() - 10, bounds.y() + 5),
|
ui::ET_TOUCH_MOVED, gfx::Point(bounds.right() - 10, bounds.y() + 5),
|
||||||
timestamp,
|
timestamp, ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
details = sink->OnEventFromSource(&move1);
|
details = sink->OnEventFromSource(&move1);
|
||||||
ASSERT_FALSE(details.dispatcher_destroyed);
|
ASSERT_FALSE(details.dispatcher_destroyed);
|
||||||
EXPECT_EQ(1, GetCurrentIndex());
|
EXPECT_EQ(1, GetCurrentIndex());
|
||||||
@ -492,9 +491,9 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
|
|||||||
|
|
||||||
for (int x = bounds.right() - 10; x >= bounds.x() + 10; x-= 10) {
|
for (int x = bounds.right() - 10; x >= bounds.x() + 10; x-= 10) {
|
||||||
timestamp += base::TimeDelta::FromMilliseconds(10);
|
timestamp += base::TimeDelta::FromMilliseconds(10);
|
||||||
ui::TouchEvent inc(
|
ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5), timestamp,
|
timestamp,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
details = sink->OnEventFromSource(&inc);
|
details = sink->OnEventFromSource(&inc);
|
||||||
ASSERT_FALSE(details.dispatcher_destroyed);
|
ASSERT_FALSE(details.dispatcher_destroyed);
|
||||||
EXPECT_EQ(1, GetCurrentIndex());
|
EXPECT_EQ(1, GetCurrentIndex());
|
||||||
@ -502,9 +501,9 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
|
|||||||
|
|
||||||
for (int x = bounds.x() + 10; x <= bounds.width() - 10; x+= 10) {
|
for (int x = bounds.x() + 10; x <= bounds.width() - 10; x+= 10) {
|
||||||
timestamp += base::TimeDelta::FromMilliseconds(10);
|
timestamp += base::TimeDelta::FromMilliseconds(10);
|
||||||
ui::TouchEvent inc(
|
ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5), timestamp,
|
timestamp,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
details = sink->OnEventFromSource(&inc);
|
details = sink->OnEventFromSource(&inc);
|
||||||
ASSERT_FALSE(details.dispatcher_destroyed);
|
ASSERT_FALSE(details.dispatcher_destroyed);
|
||||||
EXPECT_EQ(1, GetCurrentIndex());
|
EXPECT_EQ(1, GetCurrentIndex());
|
||||||
@ -512,9 +511,9 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
|
|||||||
|
|
||||||
for (int x = bounds.width() - 10; x >= bounds.x() + 10; x-= 10) {
|
for (int x = bounds.width() - 10; x >= bounds.x() + 10; x-= 10) {
|
||||||
timestamp += base::TimeDelta::FromMilliseconds(10);
|
timestamp += base::TimeDelta::FromMilliseconds(10);
|
||||||
ui::TouchEvent inc(
|
ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5), timestamp,
|
timestamp,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
details = sink->OnEventFromSource(&inc);
|
details = sink->OnEventFromSource(&inc);
|
||||||
ASSERT_FALSE(details.dispatcher_destroyed);
|
ASSERT_FALSE(details.dispatcher_destroyed);
|
||||||
EXPECT_EQ(1, GetCurrentIndex());
|
EXPECT_EQ(1, GetCurrentIndex());
|
||||||
|
@ -1148,9 +1148,8 @@ void SimulateTapWithModifiersAt(WebContents* web_contents,
|
|||||||
|
|
||||||
#if defined(USE_AURA)
|
#if defined(USE_AURA)
|
||||||
void SimulateTouchPressAt(WebContents* web_contents, const gfx::Point& point) {
|
void SimulateTouchPressAt(WebContents* web_contents, const gfx::Point& point) {
|
||||||
ui::TouchEvent touch(
|
ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, point, base::TimeTicks(),
|
||||||
ui::ET_TOUCH_PRESSED, point, base::TimeTicks(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
static_cast<RenderWidgetHostViewAura*>(
|
static_cast<RenderWidgetHostViewAura*>(
|
||||||
web_contents->GetRenderWidgetHostView())
|
web_contents->GetRenderWidgetHostView())
|
||||||
->OnTouchEvent(&touch);
|
->OnTouchEvent(&touch);
|
||||||
@ -1162,7 +1161,7 @@ void SimulateLongTapAt(WebContents* web_contents, const gfx::Point& point) {
|
|||||||
|
|
||||||
ui::TouchEvent touch_start(
|
ui::TouchEvent touch_start(
|
||||||
ui::ET_TOUCH_PRESSED, point, base::TimeTicks(),
|
ui::ET_TOUCH_PRESSED, point, base::TimeTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
rwhva->OnTouchEvent(&touch_start);
|
rwhva->OnTouchEvent(&touch_start);
|
||||||
|
|
||||||
ui::GestureEventDetails tap_down_details(ui::ET_GESTURE_TAP_DOWN);
|
ui::GestureEventDetails tap_down_details(ui::ET_GESTURE_TAP_DOWN);
|
||||||
@ -1178,9 +1177,8 @@ void SimulateLongTapAt(WebContents* web_contents, const gfx::Point& point) {
|
|||||||
touch_start.unique_event_id());
|
touch_start.unique_event_id());
|
||||||
rwhva->OnGestureEvent(&long_press);
|
rwhva->OnGestureEvent(&long_press);
|
||||||
|
|
||||||
ui::TouchEvent touch_end(
|
ui::TouchEvent touch_end(ui::ET_TOUCH_RELEASED, point, base::TimeTicks(),
|
||||||
ui::ET_TOUCH_RELEASED, point, base::TimeTicks(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
rwhva->OnTouchEvent(&touch_end);
|
rwhva->OnTouchEvent(&touch_end);
|
||||||
|
|
||||||
ui::GestureEventDetails long_tap_details(ui::ET_GESTURE_LONG_TAP);
|
ui::GestureEventDetails long_tap_details(ui::ET_GESTURE_LONG_TAP);
|
||||||
@ -2285,11 +2283,10 @@ void SendRoutedTouchTapSequence(content::WebContents* web_contents,
|
|||||||
web_contents->GetRenderWidgetHostView());
|
web_contents->GetRenderWidgetHostView());
|
||||||
ui::TouchEvent touch_start(
|
ui::TouchEvent touch_start(
|
||||||
ui::ET_TOUCH_PRESSED, point, base::TimeTicks::Now(),
|
ui::ET_TOUCH_PRESSED, point, base::TimeTicks::Now(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
rwhva->OnTouchEvent(&touch_start);
|
rwhva->OnTouchEvent(&touch_start);
|
||||||
ui::TouchEvent touch_end(
|
ui::TouchEvent touch_end(ui::ET_TOUCH_RELEASED, point, base::TimeTicks::Now(),
|
||||||
ui::ET_TOUCH_RELEASED, point, base::TimeTicks::Now(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
rwhva->OnTouchEvent(&touch_end);
|
rwhva->OnTouchEvent(&touch_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -313,8 +313,8 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
|
|||||||
int id,
|
int id,
|
||||||
int64_t display_id,
|
int64_t display_id,
|
||||||
base::OnceClosure closure) {
|
base::OnceClosure closure) {
|
||||||
ui::PointerDetails details(ui::EventPointerType::POINTER_TYPE_TOUCH, id,
|
ui::PointerDetails details(ui::EventPointerType::kTouch, id, 1.0f, 1.0f,
|
||||||
1.0f, 1.0f, 0.0f);
|
0.0f);
|
||||||
ui::TouchEvent touch_event(type, host_location, host_location,
|
ui::TouchEvent touch_event(type, host_location, host_location,
|
||||||
ui::EventTimeForNow(), details);
|
ui::EventTimeForNow(), details);
|
||||||
SendEventToSink(&touch_event, display_id, std::move(closure));
|
SendEventToSink(&touch_event, display_id, std::move(closure));
|
||||||
|
@ -166,7 +166,7 @@ TEST_F(WindowEventDispatcherTest, RepostEvent) {
|
|||||||
|
|
||||||
ui::TouchEvent touch_pressed_event(
|
ui::TouchEvent touch_pressed_event(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
host()->dispatcher()->RepostEvent(&touch_pressed_event);
|
host()->dispatcher()->RepostEvent(&touch_pressed_event);
|
||||||
RunAllPendingInMessageLoop();
|
RunAllPendingInMessageLoop();
|
||||||
EXPECT_TRUE(Env::GetInstance()->is_touch_down());
|
EXPECT_TRUE(Env::GetInstance()->is_touch_down());
|
||||||
@ -182,16 +182,16 @@ TEST_F(WindowEventDispatcherTest, TouchDownState) {
|
|||||||
|
|
||||||
ui::TouchEvent touch_pressed_event1(
|
ui::TouchEvent touch_pressed_event1(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent touch_pressed_event2(
|
ui::TouchEvent touch_pressed_event2(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
ui::TouchEvent touch_released_event1(
|
ui::TouchEvent touch_released_event1(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::TouchEvent touch_released_event2(
|
ui::TouchEvent touch_released_event2(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
|
|
||||||
EXPECT_FALSE(Env::GetInstance()->is_touch_down());
|
EXPECT_FALSE(Env::GetInstance()->is_touch_down());
|
||||||
host()->dispatcher()->OnEventFromSource(&touch_pressed_event1);
|
host()->dispatcher()->OnEventFromSource(&touch_pressed_event1);
|
||||||
@ -438,18 +438,16 @@ TEST_F(WindowEventDispatcherTest, TouchEventsOutsideBounds) {
|
|||||||
|
|
||||||
gfx::Point position = root_window()->bounds().origin();
|
gfx::Point position = root_window()->bounds().origin();
|
||||||
position.Offset(-10, -10);
|
position.Offset(-10, -10);
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position, ui::EventTimeForNow(),
|
||||||
ui::ET_TOUCH_PRESSED, position, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&press);
|
DispatchEventUsingWindowDispatcher(&press);
|
||||||
EXPECT_EQ(1, handler.num_touch_events());
|
EXPECT_EQ(1, handler.num_touch_events());
|
||||||
|
|
||||||
position = root_window()->bounds().origin();
|
position = root_window()->bounds().origin();
|
||||||
position.Offset(root_window()->bounds().width() + 10,
|
position.Offset(root_window()->bounds().width() + 10,
|
||||||
root_window()->bounds().height() + 10);
|
root_window()->bounds().height() + 10);
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, position, ui::EventTimeForNow(),
|
||||||
ui::ET_TOUCH_RELEASED, position, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&release);
|
DispatchEventUsingWindowDispatcher(&release);
|
||||||
EXPECT_EQ(2, handler.num_touch_events());
|
EXPECT_EQ(2, handler.num_touch_events());
|
||||||
root_window()->RemovePreTargetHandler(&handler);
|
root_window()->RemovePreTargetHandler(&handler);
|
||||||
@ -837,7 +835,7 @@ TEST_F(WindowEventDispatcherTest, TouchMovesHeld) {
|
|||||||
// test.
|
// test.
|
||||||
ui::TouchEvent touch_pressed_event(
|
ui::TouchEvent touch_pressed_event(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
DispatchEventUsingWindowDispatcher(&touch_pressed_event);
|
DispatchEventUsingWindowDispatcher(&touch_pressed_event);
|
||||||
recorder.WaitUntilReceivedEvent(ui::ET_GESTURE_SHOW_PRESS);
|
recorder.WaitUntilReceivedEvent(ui::ET_GESTURE_SHOW_PRESS);
|
||||||
recorder.Reset();
|
recorder.Reset();
|
||||||
@ -847,13 +845,13 @@ TEST_F(WindowEventDispatcherTest, TouchMovesHeld) {
|
|||||||
// Check that we don't immediately dispatch the TOUCH_MOVED event.
|
// Check that we don't immediately dispatch the TOUCH_MOVED event.
|
||||||
ui::TouchEvent touch_moved_event(
|
ui::TouchEvent touch_moved_event(
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::ET_TOUCH_MOVED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::TouchEvent touch_moved_event2(
|
ui::TouchEvent touch_moved_event2(
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(11, 10), ui::EventTimeForNow(),
|
ui::ET_TOUCH_MOVED, gfx::Point(11, 10), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::TouchEvent touch_moved_event3(
|
ui::TouchEvent touch_moved_event3(
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(12, 10), ui::EventTimeForNow(),
|
ui::ET_TOUCH_MOVED, gfx::Point(12, 10), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
DispatchEventUsingWindowDispatcher(&touch_moved_event);
|
DispatchEventUsingWindowDispatcher(&touch_moved_event);
|
||||||
EXPECT_TRUE(recorder.events().empty());
|
EXPECT_TRUE(recorder.events().empty());
|
||||||
@ -872,7 +870,7 @@ TEST_F(WindowEventDispatcherTest, TouchMovesHeld) {
|
|||||||
// immediately before it.
|
// immediately before it.
|
||||||
ui::TouchEvent touch_released_event(
|
ui::TouchEvent touch_released_event(
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
recorder.Reset();
|
recorder.Reset();
|
||||||
host()->dispatcher()->HoldPointerMoves();
|
host()->dispatcher()->HoldPointerMoves();
|
||||||
DispatchEventUsingWindowDispatcher(&touch_moved_event3);
|
DispatchEventUsingWindowDispatcher(&touch_moved_event3);
|
||||||
@ -1058,19 +1056,17 @@ TEST_F(WindowEventDispatcherTest, HeldTouchMoveContributesToGesture) {
|
|||||||
root_window()->AddPreTargetHandler(&recorder);
|
root_window()->AddPreTargetHandler(&recorder);
|
||||||
|
|
||||||
const gfx::Point location(20, 20);
|
const gfx::Point location(20, 20);
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(),
|
||||||
ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&press);
|
DispatchEventUsingWindowDispatcher(&press);
|
||||||
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_PRESSED));
|
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_PRESSED));
|
||||||
recorder.Reset();
|
recorder.Reset();
|
||||||
|
|
||||||
host()->dispatcher()->HoldPointerMoves();
|
host()->dispatcher()->HoldPointerMoves();
|
||||||
|
|
||||||
ui::TouchEvent move(
|
ui::TouchEvent move(ui::ET_TOUCH_MOVED, location + gfx::Vector2d(100, 100),
|
||||||
ui::ET_TOUCH_MOVED, location + gfx::Vector2d(100, 100),
|
ui::EventTimeForNow(),
|
||||||
ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&move);
|
DispatchEventUsingWindowDispatcher(&move);
|
||||||
EXPECT_FALSE(recorder.HasReceivedEvent(ui::ET_TOUCH_MOVED));
|
EXPECT_FALSE(recorder.HasReceivedEvent(ui::ET_TOUCH_MOVED));
|
||||||
EXPECT_FALSE(recorder.HasReceivedEvent(ui::ET_GESTURE_SCROLL_BEGIN));
|
EXPECT_FALSE(recorder.HasReceivedEvent(ui::ET_GESTURE_SCROLL_BEGIN));
|
||||||
@ -1997,9 +1993,8 @@ TEST_F(WindowEventDispatcherTest, WindowHideCancelsActiveTouches) {
|
|||||||
&delegate, 1, gfx::Rect(0, 0, 100, 100), root_window()));
|
&delegate, 1, gfx::Rect(0, 0, 100, 100), root_window()));
|
||||||
|
|
||||||
gfx::Point position1 = root_window()->bounds().origin();
|
gfx::Point position1 = root_window()->bounds().origin();
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position1, ui::EventTimeForNow(),
|
||||||
ui::ET_TOUCH_PRESSED, position1, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&press);
|
DispatchEventUsingWindowDispatcher(&press);
|
||||||
|
|
||||||
EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN",
|
EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN",
|
||||||
@ -2024,19 +2019,16 @@ TEST_F(WindowEventDispatcherTest, WindowHideCancelsActiveGestures) {
|
|||||||
|
|
||||||
gfx::Point position1 = root_window()->bounds().origin();
|
gfx::Point position1 = root_window()->bounds().origin();
|
||||||
gfx::Point position2 = root_window()->bounds().CenterPoint();
|
gfx::Point position2 = root_window()->bounds().CenterPoint();
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position1, ui::EventTimeForNow(),
|
||||||
ui::ET_TOUCH_PRESSED, position1, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&press);
|
DispatchEventUsingWindowDispatcher(&press);
|
||||||
|
|
||||||
ui::TouchEvent move(
|
ui::TouchEvent move(ui::ET_TOUCH_MOVED, position2, ui::EventTimeForNow(),
|
||||||
ui::ET_TOUCH_MOVED, position2, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&move);
|
DispatchEventUsingWindowDispatcher(&move);
|
||||||
|
|
||||||
ui::TouchEvent press2(
|
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, position1, ui::EventTimeForNow(),
|
||||||
ui::ET_TOUCH_PRESSED, position1, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
DispatchEventUsingWindowDispatcher(&press2);
|
DispatchEventUsingWindowDispatcher(&press2);
|
||||||
|
|
||||||
// TODO(tdresser): once the unified Gesture Recognizer has stuck, remove the
|
// TODO(tdresser): once the unified Gesture Recognizer has stuck, remove the
|
||||||
@ -2132,15 +2124,13 @@ TEST_F(WindowEventDispatcherTest, EndingEventDoesntRetarget) {
|
|||||||
window2->AddPreTargetHandler(&recorder2);
|
window2->AddPreTargetHandler(&recorder2);
|
||||||
|
|
||||||
gfx::Point position = window1->bounds().origin();
|
gfx::Point position = window1->bounds().origin();
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position, ui::EventTimeForNow(),
|
||||||
ui::ET_TOUCH_PRESSED, position, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&press);
|
DispatchEventUsingWindowDispatcher(&press);
|
||||||
|
|
||||||
gfx::Point position2 = window1->bounds().CenterPoint();
|
gfx::Point position2 = window1->bounds().CenterPoint();
|
||||||
ui::TouchEvent move(
|
ui::TouchEvent move(ui::ET_TOUCH_MOVED, position2, ui::EventTimeForNow(),
|
||||||
ui::ET_TOUCH_MOVED, position2, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&move);
|
DispatchEventUsingWindowDispatcher(&move);
|
||||||
|
|
||||||
window2->SetCapture();
|
window2->SetCapture();
|
||||||
@ -2886,7 +2876,7 @@ TEST_F(WindowEventDispatcherTest, GestureEventCoordinates) {
|
|||||||
|
|
||||||
ui::TouchEvent touch_pressed_event(
|
ui::TouchEvent touch_pressed_event(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
touch_pressed_event.set_location_f(gfx::PointF(kX, kY));
|
touch_pressed_event.set_location_f(gfx::PointF(kX, kY));
|
||||||
touch_pressed_event.set_root_location_f(gfx::PointF(kX, kY));
|
touch_pressed_event.set_root_location_f(gfx::PointF(kX, kY));
|
||||||
|
|
||||||
@ -2909,18 +2899,16 @@ TEST_F(WindowEventDispatcherTest, TouchMovesMarkedWhenCausingScroll) {
|
|||||||
root_window()->AddPreTargetHandler(&recorder);
|
root_window()->AddPreTargetHandler(&recorder);
|
||||||
|
|
||||||
const gfx::Point location(20, 20);
|
const gfx::Point location(20, 20);
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(),
|
||||||
ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&press);
|
DispatchEventUsingWindowDispatcher(&press);
|
||||||
EXPECT_FALSE(recorder.LastTouchMayCauseScrolling());
|
EXPECT_FALSE(recorder.LastTouchMayCauseScrolling());
|
||||||
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_PRESSED));
|
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_PRESSED));
|
||||||
recorder.Reset();
|
recorder.Reset();
|
||||||
|
|
||||||
ui::TouchEvent move(
|
ui::TouchEvent move(ui::ET_TOUCH_MOVED, location + gfx::Vector2d(100, 100),
|
||||||
ui::ET_TOUCH_MOVED, location + gfx::Vector2d(100, 100),
|
ui::EventTimeForNow(),
|
||||||
ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&move);
|
DispatchEventUsingWindowDispatcher(&move);
|
||||||
EXPECT_TRUE(recorder.LastTouchMayCauseScrolling());
|
EXPECT_TRUE(recorder.LastTouchMayCauseScrolling());
|
||||||
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_MOVED));
|
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_MOVED));
|
||||||
@ -2928,10 +2916,9 @@ TEST_F(WindowEventDispatcherTest, TouchMovesMarkedWhenCausingScroll) {
|
|||||||
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_GESTURE_SCROLL_UPDATE));
|
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_GESTURE_SCROLL_UPDATE));
|
||||||
recorder.Reset();
|
recorder.Reset();
|
||||||
|
|
||||||
ui::TouchEvent move2(
|
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, location + gfx::Vector2d(200, 200),
|
||||||
ui::ET_TOUCH_MOVED, location + gfx::Vector2d(200, 200),
|
ui::EventTimeForNow(),
|
||||||
ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&move2);
|
DispatchEventUsingWindowDispatcher(&move2);
|
||||||
EXPECT_TRUE(recorder.LastTouchMayCauseScrolling());
|
EXPECT_TRUE(recorder.LastTouchMayCauseScrolling());
|
||||||
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_MOVED));
|
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_MOVED));
|
||||||
@ -2942,7 +2929,7 @@ TEST_F(WindowEventDispatcherTest, TouchMovesMarkedWhenCausingScroll) {
|
|||||||
ui::TouchEvent release(
|
ui::TouchEvent release(
|
||||||
ui::ET_TOUCH_RELEASED, location + gfx::Vector2d(200, 200),
|
ui::ET_TOUCH_RELEASED, location + gfx::Vector2d(200, 200),
|
||||||
ui::EventTimeForNow() + base::TimeDelta::FromSeconds(1),
|
ui::EventTimeForNow() + base::TimeDelta::FromSeconds(1),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
DispatchEventUsingWindowDispatcher(&release);
|
DispatchEventUsingWindowDispatcher(&release);
|
||||||
EXPECT_TRUE(recorder.LastTouchMayCauseScrolling());
|
EXPECT_TRUE(recorder.LastTouchMayCauseScrolling());
|
||||||
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_RELEASED));
|
EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_RELEASED));
|
||||||
@ -3060,10 +3047,10 @@ TEST_F(WindowEventDispatcherTest, TouchEventWithScaledWindow) {
|
|||||||
const gfx::Point touch_position(-5, -5);
|
const gfx::Point touch_position(-5, -5);
|
||||||
ui::TouchEvent pressed_event(
|
ui::TouchEvent pressed_event(
|
||||||
ui::ET_TOUCH_PRESSED, touch_position, ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, touch_position, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::TouchEvent released_event(
|
ui::TouchEvent released_event(
|
||||||
ui::ET_TOUCH_RELEASED, touch_position, ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, touch_position, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
dispatcher->OnEventFromSource(&pressed_event);
|
dispatcher->OnEventFromSource(&pressed_event);
|
||||||
dispatcher->OnEventFromSource(&released_event);
|
dispatcher->OnEventFromSource(&released_event);
|
||||||
EXPECT_EQ(expected_events, EventTypesToString(root_recorder.events()));
|
EXPECT_EQ(expected_events, EventTypesToString(root_recorder.events()));
|
||||||
@ -3078,10 +3065,10 @@ TEST_F(WindowEventDispatcherTest, TouchEventWithScaledWindow) {
|
|||||||
const gfx::Point touch_position(5, 5);
|
const gfx::Point touch_position(5, 5);
|
||||||
ui::TouchEvent pressed_event(
|
ui::TouchEvent pressed_event(
|
||||||
ui::ET_TOUCH_PRESSED, touch_position, ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, touch_position, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::TouchEvent released_event(
|
ui::TouchEvent released_event(
|
||||||
ui::ET_TOUCH_RELEASED, touch_position, ui::EventTimeForNow(),
|
ui::ET_TOUCH_RELEASED, touch_position, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
dispatcher->OnEventFromSource(&pressed_event);
|
dispatcher->OnEventFromSource(&pressed_event);
|
||||||
dispatcher->OnEventFromSource(&released_event);
|
dispatcher->OnEventFromSource(&released_event);
|
||||||
EXPECT_EQ(expected_events, EventTypesToString(root_recorder.events()));
|
EXPECT_EQ(expected_events, EventTypesToString(root_recorder.events()));
|
||||||
|
@ -817,9 +817,8 @@ TEST_F(WindowTest, CaptureTests) {
|
|||||||
EXPECT_EQ(2, delegate.mouse_event_count());
|
EXPECT_EQ(2, delegate.mouse_event_count());
|
||||||
delegate.ResetCounts();
|
delegate.ResetCounts();
|
||||||
|
|
||||||
ui::TouchEvent touchev(
|
ui::TouchEvent touchev(ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), getTime(),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&touchev);
|
DispatchEventUsingWindowDispatcher(&touchev);
|
||||||
EXPECT_EQ(1, delegate.touch_event_count());
|
EXPECT_EQ(1, delegate.touch_event_count());
|
||||||
delegate.ResetCounts();
|
delegate.ResetCounts();
|
||||||
@ -834,9 +833,8 @@ TEST_F(WindowTest, CaptureTests) {
|
|||||||
generator.PressLeftButton();
|
generator.PressLeftButton();
|
||||||
EXPECT_EQ(1, delegate.mouse_event_count());
|
EXPECT_EQ(1, delegate.mouse_event_count());
|
||||||
|
|
||||||
ui::TouchEvent touchev2(
|
ui::TouchEvent touchev2(ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), getTime(),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
DispatchEventUsingWindowDispatcher(&touchev2);
|
DispatchEventUsingWindowDispatcher(&touchev2);
|
||||||
EXPECT_EQ(0, delegate.touch_event_count());
|
EXPECT_EQ(0, delegate.touch_event_count());
|
||||||
|
|
||||||
@ -858,9 +856,8 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
|
|||||||
&delegate2, 0, gfx::Rect(50, 50, 50, 50), root_window()));
|
&delegate2, 0, gfx::Rect(50, 50, 50, 50), root_window()));
|
||||||
|
|
||||||
// Press on w1.
|
// Press on w1.
|
||||||
ui::TouchEvent press1(
|
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), getTime(),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&press1);
|
DispatchEventUsingWindowDispatcher(&press1);
|
||||||
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
|
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
|
||||||
EXPECT_EQ(2, delegate1.gesture_event_count());
|
EXPECT_EQ(2, delegate1.gesture_event_count());
|
||||||
@ -873,27 +870,24 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
|
|||||||
delegate1.ResetCounts();
|
delegate1.ResetCounts();
|
||||||
delegate2.ResetCounts();
|
delegate2.ResetCounts();
|
||||||
|
|
||||||
// Events are now untargetted.
|
// Events are now untargeted.
|
||||||
ui::TouchEvent move(
|
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), getTime(),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(10, 20), getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&move);
|
DispatchEventUsingWindowDispatcher(&move);
|
||||||
EXPECT_EQ(0, delegate1.gesture_event_count());
|
EXPECT_EQ(0, delegate1.gesture_event_count());
|
||||||
EXPECT_EQ(0, delegate1.touch_event_count());
|
EXPECT_EQ(0, delegate1.touch_event_count());
|
||||||
EXPECT_EQ(0, delegate2.gesture_event_count());
|
EXPECT_EQ(0, delegate2.gesture_event_count());
|
||||||
EXPECT_EQ(0, delegate2.touch_event_count());
|
EXPECT_EQ(0, delegate2.touch_event_count());
|
||||||
|
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), getTime(),
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&release);
|
DispatchEventUsingWindowDispatcher(&release);
|
||||||
EXPECT_EQ(0, delegate1.gesture_event_count());
|
EXPECT_EQ(0, delegate1.gesture_event_count());
|
||||||
EXPECT_EQ(0, delegate2.gesture_event_count());
|
EXPECT_EQ(0, delegate2.gesture_event_count());
|
||||||
|
|
||||||
// A new press is captured by w2.
|
// A new press is captured by w2.
|
||||||
ui::TouchEvent press2(
|
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), getTime(),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&press2);
|
DispatchEventUsingWindowDispatcher(&press2);
|
||||||
EXPECT_EQ(0, delegate1.gesture_event_count());
|
EXPECT_EQ(0, delegate1.gesture_event_count());
|
||||||
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
|
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
|
||||||
@ -916,9 +910,8 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
|
|||||||
base::TimeTicks time = getTime();
|
base::TimeTicks time = getTime();
|
||||||
const int kTimeDelta = 100;
|
const int kTimeDelta = 100;
|
||||||
|
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&press);
|
DispatchEventUsingWindowDispatcher(&press);
|
||||||
|
|
||||||
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
|
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
|
||||||
@ -934,9 +927,8 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
|
|||||||
// On move We will get TOUCH_MOVED, GESTURE_TAP_CANCEL,
|
// On move We will get TOUCH_MOVED, GESTURE_TAP_CANCEL,
|
||||||
// GESTURE_SCROLL_START and GESTURE_SCROLL_UPDATE.
|
// GESTURE_SCROLL_START and GESTURE_SCROLL_UPDATE.
|
||||||
time += base::TimeDelta::FromMilliseconds(kTimeDelta);
|
time += base::TimeDelta::FromMilliseconds(kTimeDelta);
|
||||||
ui::TouchEvent move(
|
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), time,
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(10, 20), time,
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&move);
|
DispatchEventUsingWindowDispatcher(&move);
|
||||||
EXPECT_EQ(1, delegate.touch_event_count());
|
EXPECT_EQ(1, delegate.touch_event_count());
|
||||||
EXPECT_EQ(3, delegate.gesture_event_count());
|
EXPECT_EQ(3, delegate.gesture_event_count());
|
||||||
@ -950,9 +942,8 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
|
|||||||
|
|
||||||
// On move we still get TOUCH_MOVED and GESTURE_SCROLL_UPDATE.
|
// On move we still get TOUCH_MOVED and GESTURE_SCROLL_UPDATE.
|
||||||
time += base::TimeDelta::FromMilliseconds(kTimeDelta);
|
time += base::TimeDelta::FromMilliseconds(kTimeDelta);
|
||||||
ui::TouchEvent move2(
|
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(10, 30), time,
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(10, 30), time,
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&move2);
|
DispatchEventUsingWindowDispatcher(&move2);
|
||||||
EXPECT_EQ(1, delegate.touch_event_count());
|
EXPECT_EQ(1, delegate.touch_event_count());
|
||||||
EXPECT_EQ(1, delegate.gesture_event_count());
|
EXPECT_EQ(1, delegate.gesture_event_count());
|
||||||
@ -960,9 +951,8 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
|
|||||||
|
|
||||||
// And on release we get TOUCH_RELEASED, GESTURE_SCROLL_END, GESTURE_END
|
// And on release we get TOUCH_RELEASED, GESTURE_SCROLL_END, GESTURE_END
|
||||||
time += base::TimeDelta::FromMilliseconds(kTimeDelta);
|
time += base::TimeDelta::FromMilliseconds(kTimeDelta);
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), time,
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), time,
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&release);
|
DispatchEventUsingWindowDispatcher(&release);
|
||||||
EXPECT_EQ(1, delegate.touch_event_count());
|
EXPECT_EQ(1, delegate.touch_event_count());
|
||||||
EXPECT_EQ(2, delegate.gesture_event_count());
|
EXPECT_EQ(2, delegate.gesture_event_count());
|
||||||
@ -974,9 +964,8 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
|
|||||||
CaptureWindowDelegateImpl d1;
|
CaptureWindowDelegateImpl d1;
|
||||||
std::unique_ptr<Window> w1(CreateTestWindowWithDelegate(
|
std::unique_ptr<Window> w1(CreateTestWindowWithDelegate(
|
||||||
&d1, 0, gfx::Rect(0, 0, 20, 20), root_window()));
|
&d1, 0, gfx::Rect(0, 0, 20, 20), root_window()));
|
||||||
ui::TouchEvent p1(
|
ui::TouchEvent p1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), getTime(),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
DispatchEventUsingWindowDispatcher(&p1);
|
DispatchEventUsingWindowDispatcher(&p1);
|
||||||
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
|
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
|
||||||
EXPECT_EQ(1, d1.touch_event_count());
|
EXPECT_EQ(1, d1.touch_event_count());
|
||||||
@ -987,9 +976,8 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
|
|||||||
CaptureWindowDelegateImpl d2;
|
CaptureWindowDelegateImpl d2;
|
||||||
std::unique_ptr<Window> w2(CreateTestWindowWithDelegate(
|
std::unique_ptr<Window> w2(CreateTestWindowWithDelegate(
|
||||||
&d2, 0, gfx::Rect(40, 0, 40, 20), root_window()));
|
&d2, 0, gfx::Rect(40, 0, 40, 20), root_window()));
|
||||||
ui::TouchEvent p2(
|
ui::TouchEvent p2(ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), getTime(),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
DispatchEventUsingWindowDispatcher(&p2);
|
DispatchEventUsingWindowDispatcher(&p2);
|
||||||
EXPECT_EQ(0, d1.touch_event_count());
|
EXPECT_EQ(0, d1.touch_event_count());
|
||||||
EXPECT_EQ(0, d1.gesture_event_count());
|
EXPECT_EQ(0, d1.gesture_event_count());
|
||||||
@ -1024,9 +1012,8 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
|
|||||||
|
|
||||||
// Move touch id originally associated with |w2|. The touch has been
|
// Move touch id originally associated with |w2|. The touch has been
|
||||||
// cancelled, so no events should be dispatched.
|
// cancelled, so no events should be dispatched.
|
||||||
ui::TouchEvent m3(
|
ui::TouchEvent m3(ui::ET_TOUCH_MOVED, gfx::Point(110, 105), getTime(),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(110, 105), getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
DispatchEventUsingWindowDispatcher(&m3);
|
DispatchEventUsingWindowDispatcher(&m3);
|
||||||
EXPECT_EQ(0, d1.touch_event_count());
|
EXPECT_EQ(0, d1.touch_event_count());
|
||||||
EXPECT_EQ(0, d1.gesture_event_count());
|
EXPECT_EQ(0, d1.gesture_event_count());
|
||||||
@ -1045,9 +1032,8 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
|
|||||||
EXPECT_EQ(0, d3.gesture_event_count());
|
EXPECT_EQ(0, d3.gesture_event_count());
|
||||||
|
|
||||||
// The touch has been cancelled, so no events are dispatched.
|
// The touch has been cancelled, so no events are dispatched.
|
||||||
ui::TouchEvent m4(
|
ui::TouchEvent m4(ui::ET_TOUCH_MOVED, gfx::Point(120, 105), getTime(),
|
||||||
ui::ET_TOUCH_MOVED, gfx::Point(120, 105), getTime(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
DispatchEventUsingWindowDispatcher(&m4);
|
DispatchEventUsingWindowDispatcher(&m4);
|
||||||
EXPECT_EQ(0, d1.touch_event_count());
|
EXPECT_EQ(0, d1.touch_event_count());
|
||||||
EXPECT_EQ(0, d1.gesture_event_count());
|
EXPECT_EQ(0, d1.gesture_event_count());
|
||||||
@ -1688,9 +1674,9 @@ TEST_F(WindowTest, TransformGesture) {
|
|||||||
host()->SetRootTransform(OverlayTransformToTransform(
|
host()->SetRootTransform(OverlayTransformToTransform(
|
||||||
gfx::OVERLAY_TRANSFORM_ROTATE_90, gfx::SizeF(size)));
|
gfx::OVERLAY_TRANSFORM_ROTATE_90, gfx::SizeF(size)));
|
||||||
|
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), getTime(),
|
getTime(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
DispatchEventUsingWindowDispatcher(&press);
|
DispatchEventUsingWindowDispatcher(&press);
|
||||||
EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString());
|
EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString());
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ TEST_F(UserActivityDetectorTest, Basic) {
|
|||||||
AdvanceTime(advance_delta);
|
AdvanceTime(advance_delta);
|
||||||
ui::TouchEvent touch_event(
|
ui::TouchEvent touch_event(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(), base::TimeTicks(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(), base::TimeTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
OnEvent(&touch_event);
|
OnEvent(&touch_event);
|
||||||
EXPECT_FALSE(touch_event.handled());
|
EXPECT_FALSE(touch_event.handled());
|
||||||
EXPECT_EQ(now_, detector_->last_activity_time());
|
EXPECT_EQ(now_, detector_->last_activity_time());
|
||||||
|
@ -127,15 +127,15 @@ WebPointerProperties::PointerType ToWebPointerType(
|
|||||||
WebPointerProperties::PointerType ToWebPointerType(
|
WebPointerProperties::PointerType ToWebPointerType(
|
||||||
EventPointerType event_pointer_type) {
|
EventPointerType event_pointer_type) {
|
||||||
switch (event_pointer_type) {
|
switch (event_pointer_type) {
|
||||||
case EventPointerType::POINTER_TYPE_UNKNOWN:
|
case EventPointerType::kUnknown:
|
||||||
return WebPointerProperties::PointerType::kUnknown;
|
return WebPointerProperties::PointerType::kUnknown;
|
||||||
case EventPointerType::POINTER_TYPE_MOUSE:
|
case EventPointerType::kMouse:
|
||||||
return WebPointerProperties::PointerType::kMouse;
|
return WebPointerProperties::PointerType::kMouse;
|
||||||
case EventPointerType::POINTER_TYPE_PEN:
|
case EventPointerType::kPen:
|
||||||
return WebPointerProperties::PointerType::kPen;
|
return WebPointerProperties::PointerType::kPen;
|
||||||
case EventPointerType::POINTER_TYPE_TOUCH:
|
case EventPointerType::kTouch:
|
||||||
return WebPointerProperties::PointerType::kTouch;
|
return WebPointerProperties::PointerType::kTouch;
|
||||||
case EventPointerType::POINTER_TYPE_ERASER:
|
case EventPointerType::kEraser:
|
||||||
return WebPointerProperties::PointerType::kEraser;
|
return WebPointerProperties::PointerType::kEraser;
|
||||||
default:
|
default:
|
||||||
NOTREACHED() << "Invalid EventPointerType = "
|
NOTREACHED() << "Invalid EventPointerType = "
|
||||||
@ -1225,18 +1225,18 @@ EventPointerType WebPointerTypeToEventPointerType(
|
|||||||
WebPointerProperties::PointerType type) {
|
WebPointerProperties::PointerType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case WebPointerProperties::PointerType::kMouse:
|
case WebPointerProperties::PointerType::kMouse:
|
||||||
return EventPointerType::POINTER_TYPE_MOUSE;
|
return EventPointerType::kMouse;
|
||||||
case WebPointerProperties::PointerType::kPen:
|
case WebPointerProperties::PointerType::kPen:
|
||||||
return EventPointerType::POINTER_TYPE_PEN;
|
return EventPointerType::kPen;
|
||||||
case WebPointerProperties::PointerType::kEraser:
|
case WebPointerProperties::PointerType::kEraser:
|
||||||
return EventPointerType::POINTER_TYPE_ERASER;
|
return EventPointerType::kEraser;
|
||||||
case WebPointerProperties::PointerType::kTouch:
|
case WebPointerProperties::PointerType::kTouch:
|
||||||
return EventPointerType::POINTER_TYPE_TOUCH;
|
return EventPointerType::kTouch;
|
||||||
case WebPointerProperties::PointerType::kUnknown:
|
case WebPointerProperties::PointerType::kUnknown:
|
||||||
return EventPointerType::POINTER_TYPE_UNKNOWN;
|
return EventPointerType::kUnknown;
|
||||||
}
|
}
|
||||||
NOTREACHED() << "Invalid pointer type";
|
NOTREACHED() << "Invalid pointer type";
|
||||||
return EventPointerType::POINTER_TYPE_UNKNOWN;
|
return EventPointerType::kUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
blink::WebGestureEvent ScrollBeginFromScrollUpdate(
|
blink::WebGestureEvent ScrollBeginFromScrollUpdate(
|
||||||
|
@ -32,15 +32,15 @@ gfx::PointF GetScreenLocationFromEvent(const LocatedEvent& event) {
|
|||||||
blink::WebPointerProperties::PointerType EventPointerTypeToWebPointerType(
|
blink::WebPointerProperties::PointerType EventPointerTypeToWebPointerType(
|
||||||
EventPointerType pointer_type) {
|
EventPointerType pointer_type) {
|
||||||
switch (pointer_type) {
|
switch (pointer_type) {
|
||||||
case EventPointerType::POINTER_TYPE_UNKNOWN:
|
case EventPointerType::kUnknown:
|
||||||
return blink::WebPointerProperties::PointerType::kUnknown;
|
return blink::WebPointerProperties::PointerType::kUnknown;
|
||||||
case EventPointerType::POINTER_TYPE_MOUSE:
|
case EventPointerType::kMouse:
|
||||||
return blink::WebPointerProperties::PointerType::kMouse;
|
return blink::WebPointerProperties::PointerType::kMouse;
|
||||||
case EventPointerType::POINTER_TYPE_PEN:
|
case EventPointerType::kPen:
|
||||||
return blink::WebPointerProperties::PointerType::kPen;
|
return blink::WebPointerProperties::PointerType::kPen;
|
||||||
case EventPointerType::POINTER_TYPE_ERASER:
|
case EventPointerType::kEraser:
|
||||||
return blink::WebPointerProperties::PointerType::kEraser;
|
return blink::WebPointerProperties::PointerType::kEraser;
|
||||||
case EventPointerType::POINTER_TYPE_TOUCH:
|
case EventPointerType::kTouch:
|
||||||
return blink::WebPointerProperties::PointerType::kTouch;
|
return blink::WebPointerProperties::PointerType::kTouch;
|
||||||
}
|
}
|
||||||
NOTREACHED() << "Unexpected EventPointerType";
|
NOTREACHED() << "Unexpected EventPointerType";
|
||||||
|
@ -405,7 +405,7 @@ TEST(WebInputEventTest, TestMakeWebMouseEvent) {
|
|||||||
{
|
{
|
||||||
// Stylus values for PointerDetails.
|
// Stylus values for PointerDetails.
|
||||||
base::TimeTicks timestamp = EventTimeForNow();
|
base::TimeTicks timestamp = EventTimeForNow();
|
||||||
PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN,
|
PointerDetails pointer_details(EventPointerType::kPen,
|
||||||
/* id */ 63,
|
/* id */ 63,
|
||||||
/* radius_x */ 0.0f,
|
/* radius_x */ 0.0f,
|
||||||
/* radius_y */ 0.0f,
|
/* radius_y */ 0.0f,
|
||||||
|
@ -126,7 +126,7 @@ int GetChangedMouseButtonFlagsFromNative(const PlatformEvent& native_event) {
|
|||||||
|
|
||||||
PointerDetails GetMousePointerDetailsFromNative(
|
PointerDetails GetMousePointerDetailsFromNative(
|
||||||
const PlatformEvent& native_event) {
|
const PlatformEvent& native_event) {
|
||||||
return PointerDetails(EventPointerType::POINTER_TYPE_MOUSE);
|
return PointerDetails(EventPointerType::kMouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Vector2d GetMouseWheelOffset(const PlatformEvent& event) {
|
gfx::Vector2d GetMouseWheelOffset(const PlatformEvent& event) {
|
||||||
@ -165,7 +165,7 @@ void ClearTouchIdIfReleased(const PlatformEvent& native_event) {
|
|||||||
PointerDetails GetTouchPointerDetailsFromNative(
|
PointerDetails GetTouchPointerDetailsFromNative(
|
||||||
const PlatformEvent& native_event) {
|
const PlatformEvent& native_event) {
|
||||||
NOTIMPLEMENTED();
|
NOTIMPLEMENTED();
|
||||||
return PointerDetails(EventPointerType::POINTER_TYPE_UNKNOWN,
|
return PointerDetails(EventPointerType::kUnknown,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 1.0,
|
/* radius_x */ 1.0,
|
||||||
/* radius_y */ 1.0,
|
/* radius_y */ 1.0,
|
||||||
|
@ -72,10 +72,10 @@ void TouchFactory::SetTouchDeviceListFromCommandLine() {
|
|||||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
AddPointerDevicesFromString(
|
AddPointerDevicesFromString(
|
||||||
command_line->GetSwitchValueASCII(switches::kTouchDevices),
|
command_line->GetSwitchValueASCII(switches::kTouchDevices),
|
||||||
EventPointerType::POINTER_TYPE_TOUCH, &devices);
|
EventPointerType::kTouch, &devices);
|
||||||
AddPointerDevicesFromString(
|
AddPointerDevicesFromString(
|
||||||
command_line->GetSwitchValueASCII(switches::kPenDevices),
|
command_line->GetSwitchValueASCII(switches::kPenDevices),
|
||||||
EventPointerType::POINTER_TYPE_PEN, &devices);
|
EventPointerType::kPen, &devices);
|
||||||
if (!devices.empty())
|
if (!devices.empty())
|
||||||
ui::TouchFactory::GetInstance()->SetTouchDeviceList(devices);
|
ui::TouchFactory::GetInstance()->SetTouchDeviceList(devices);
|
||||||
}
|
}
|
||||||
@ -126,8 +126,7 @@ void TouchFactory::UpdateDeviceList(XDisplay* display) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
touch_device_lookup_[master_id] = true;
|
touch_device_lookup_[master_id] = true;
|
||||||
touch_device_list_[master_id] = {true,
|
touch_device_list_[master_id] = {true, EventPointerType::kTouch};
|
||||||
EventPointerType::POINTER_TYPE_TOUCH};
|
|
||||||
|
|
||||||
if (devinfo.use != XIMasterPointer)
|
if (devinfo.use != XIMasterPointer)
|
||||||
CacheTouchscreenIds(devinfo.deviceid);
|
CacheTouchscreenIds(devinfo.deviceid);
|
||||||
@ -135,8 +134,8 @@ void TouchFactory::UpdateDeviceList(XDisplay* display) {
|
|||||||
if (devinfo.use == XISlavePointer) {
|
if (devinfo.use == XISlavePointer) {
|
||||||
device_master_id_list_[devinfo.deviceid] = master_id;
|
device_master_id_list_[devinfo.deviceid] = master_id;
|
||||||
touch_device_lookup_[devinfo.deviceid] = true;
|
touch_device_lookup_[devinfo.deviceid] = true;
|
||||||
touch_device_list_[devinfo.deviceid] = {
|
touch_device_list_[devinfo.deviceid] = {false,
|
||||||
false, EventPointerType::POINTER_TYPE_TOUCH};
|
EventPointerType::kTouch};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pointer_device_lookup_[devinfo.deviceid] =
|
pointer_device_lookup_[devinfo.deviceid] =
|
||||||
@ -318,7 +317,7 @@ void TouchFactory::SetTouchDeviceForTest(
|
|||||||
for (auto iter = devices.begin(); iter != devices.end(); ++iter) {
|
for (auto iter = devices.begin(); iter != devices.end(); ++iter) {
|
||||||
DCHECK(IsValidDevice(*iter));
|
DCHECK(IsValidDevice(*iter));
|
||||||
touch_device_lookup_[*iter] = true;
|
touch_device_lookup_[*iter] = true;
|
||||||
touch_device_list_[*iter] = {true, EventPointerType::POINTER_TYPE_TOUCH};
|
touch_device_list_[*iter] = {true, EventPointerType::kTouch};
|
||||||
}
|
}
|
||||||
SetTouchscreensEnabled(true);
|
SetTouchscreensEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ class EVENTS_DEVICES_X11_EXPORT TouchFactory {
|
|||||||
// device is master and multi-touch capable).
|
// device is master and multi-touch capable).
|
||||||
struct TouchDeviceDetails {
|
struct TouchDeviceDetails {
|
||||||
bool is_master = false;
|
bool is_master = false;
|
||||||
EventPointerType pointer_type = EventPointerType::POINTER_TYPE_TOUCH;
|
EventPointerType pointer_type = EventPointerType::kTouch;
|
||||||
};
|
};
|
||||||
std::map<int, TouchDeviceDetails> touch_device_list_;
|
std::map<int, TouchDeviceDetails> touch_device_list_;
|
||||||
|
|
||||||
|
@ -470,8 +470,7 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
|
|||||||
int flags,
|
int flags,
|
||||||
int changed_button_flags,
|
int changed_button_flags,
|
||||||
const PointerDetails& pointer_details =
|
const PointerDetails& pointer_details =
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE,
|
PointerDetails(EventPointerType::kMouse, kPointerIdMouse));
|
||||||
kPointerIdMouse));
|
|
||||||
|
|
||||||
// DEPRECATED: Prefer constructor that takes gfx::PointF.
|
// DEPRECATED: Prefer constructor that takes gfx::PointF.
|
||||||
MouseEvent(EventType type,
|
MouseEvent(EventType type,
|
||||||
@ -481,8 +480,7 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
|
|||||||
int flags,
|
int flags,
|
||||||
int changed_button_flags,
|
int changed_button_flags,
|
||||||
const PointerDetails& pointer_details =
|
const PointerDetails& pointer_details =
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE,
|
PointerDetails(EventPointerType::kMouse, kPointerIdMouse));
|
||||||
kPointerIdMouse));
|
|
||||||
|
|
||||||
MouseEvent(const MouseEvent& copy);
|
MouseEvent(const MouseEvent& copy);
|
||||||
~MouseEvent() override;
|
~MouseEvent() override;
|
||||||
@ -641,7 +639,7 @@ class EVENTS_EXPORT MouseWheelEvent : public MouseEvent {
|
|||||||
gfx::Vector2d offset_;
|
gfx::Vector2d offset_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// NOTE: Pen (stylus) events use TouchEvent with POINTER_TYPE_PEN. They were
|
// NOTE: Pen (stylus) events use TouchEvent with kPen. They were
|
||||||
// originally implemented as MouseEvent but switched to TouchEvent when UX
|
// originally implemented as MouseEvent but switched to TouchEvent when UX
|
||||||
// decided not to show hover effects for pen.
|
// decided not to show hover effects for pen.
|
||||||
class EVENTS_EXPORT TouchEvent : public LocatedEvent {
|
class EVENTS_EXPORT TouchEvent : public LocatedEvent {
|
||||||
|
@ -174,11 +174,12 @@ enum EventDeviceId {
|
|||||||
|
|
||||||
// Pointing device type.
|
// Pointing device type.
|
||||||
enum class EventPointerType : int {
|
enum class EventPointerType : int {
|
||||||
POINTER_TYPE_UNKNOWN = 0,
|
kUnknown,
|
||||||
POINTER_TYPE_MOUSE,
|
kMouse,
|
||||||
POINTER_TYPE_PEN,
|
kPen,
|
||||||
POINTER_TYPE_TOUCH,
|
kTouch,
|
||||||
POINTER_TYPE_ERASER,
|
kEraser,
|
||||||
|
kMaxValue = kEraser,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Device type for gesture events.
|
// Device type for gesture events.
|
||||||
|
@ -560,7 +560,7 @@ TEST(EventTest, TouchEventRadiusDefaultsToOtherAxis) {
|
|||||||
const float non_zero_length2 = 46;
|
const float non_zero_length2 = 46;
|
||||||
|
|
||||||
TouchEvent event1(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
TouchEvent event1(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ non_zero_length1,
|
/* radius_x */ non_zero_length1,
|
||||||
/* radius_y */ 0.0f,
|
/* radius_y */ 0.0f,
|
||||||
@ -569,7 +569,7 @@ TEST(EventTest, TouchEventRadiusDefaultsToOtherAxis) {
|
|||||||
EXPECT_EQ(non_zero_length1, event1.pointer_details().radius_y);
|
EXPECT_EQ(non_zero_length1, event1.pointer_details().radius_y);
|
||||||
|
|
||||||
TouchEvent event2(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
TouchEvent event2(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 0.0f,
|
/* radius_x */ 0.0f,
|
||||||
/* radius_y */ non_zero_length2,
|
/* radius_y */ non_zero_length2,
|
||||||
@ -586,7 +586,7 @@ TEST(EventTest, TouchEventRotationAngleFixing) {
|
|||||||
{
|
{
|
||||||
const float angle_in_range = 0;
|
const float angle_in_range = 0;
|
||||||
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0, radius_x, radius_y,
|
/* pointer_id*/ 0, radius_x, radius_y,
|
||||||
/* force */ 0, angle_in_range),
|
/* force */ 0, angle_in_range),
|
||||||
0);
|
0);
|
||||||
@ -596,7 +596,7 @@ TEST(EventTest, TouchEventRotationAngleFixing) {
|
|||||||
{
|
{
|
||||||
const float angle_in_range = 179.9f;
|
const float angle_in_range = 179.9f;
|
||||||
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0, radius_x, radius_y,
|
/* pointer_id*/ 0, radius_x, radius_y,
|
||||||
/* force */ 0, angle_in_range),
|
/* force */ 0, angle_in_range),
|
||||||
0);
|
0);
|
||||||
@ -606,7 +606,7 @@ TEST(EventTest, TouchEventRotationAngleFixing) {
|
|||||||
{
|
{
|
||||||
const float angle_negative = -0.1f;
|
const float angle_negative = -0.1f;
|
||||||
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0, radius_x, radius_y,
|
/* pointer_id*/ 0, radius_x, radius_y,
|
||||||
/* force */ 0, angle_negative),
|
/* force */ 0, angle_negative),
|
||||||
0);
|
0);
|
||||||
@ -616,7 +616,7 @@ TEST(EventTest, TouchEventRotationAngleFixing) {
|
|||||||
{
|
{
|
||||||
const float angle_negative = -200;
|
const float angle_negative = -200;
|
||||||
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0, radius_x, radius_y,
|
/* pointer_id*/ 0, radius_x, radius_y,
|
||||||
/* force */ 0, angle_negative),
|
/* force */ 0, angle_negative),
|
||||||
0);
|
0);
|
||||||
@ -626,7 +626,7 @@ TEST(EventTest, TouchEventRotationAngleFixing) {
|
|||||||
{
|
{
|
||||||
const float angle_too_big = 180;
|
const float angle_too_big = 180;
|
||||||
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0, radius_x, radius_y,
|
/* pointer_id*/ 0, radius_x, radius_y,
|
||||||
/* force */ 0, angle_too_big),
|
/* force */ 0, angle_too_big),
|
||||||
0);
|
0);
|
||||||
@ -636,7 +636,7 @@ TEST(EventTest, TouchEventRotationAngleFixing) {
|
|||||||
{
|
{
|
||||||
const float angle_too_big = 400;
|
const float angle_too_big = 400;
|
||||||
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), time,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0, radius_x, radius_y,
|
/* pointer_id*/ 0, radius_x, radius_y,
|
||||||
/* force */ 0, angle_too_big),
|
/* force */ 0, angle_too_big),
|
||||||
0);
|
0);
|
||||||
@ -647,9 +647,9 @@ TEST(EventTest, TouchEventRotationAngleFixing) {
|
|||||||
TEST(EventTest, PointerDetailsTouch) {
|
TEST(EventTest, PointerDetailsTouch) {
|
||||||
ui::TouchEvent touch_event_plain(
|
ui::TouchEvent touch_event_plain(
|
||||||
ET_TOUCH_PRESSED, gfx::Point(0, 0), ui::EventTimeForNow(),
|
ET_TOUCH_PRESSED, gfx::Point(0, 0), ui::EventTimeForNow(),
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
|
EXPECT_EQ(EventPointerType::kTouch,
|
||||||
touch_event_plain.pointer_details().pointer_type);
|
touch_event_plain.pointer_details().pointer_type);
|
||||||
EXPECT_EQ(0.0f, touch_event_plain.pointer_details().radius_x);
|
EXPECT_EQ(0.0f, touch_event_plain.pointer_details().radius_x);
|
||||||
EXPECT_EQ(0.0f, touch_event_plain.pointer_details().radius_y);
|
EXPECT_EQ(0.0f, touch_event_plain.pointer_details().radius_y);
|
||||||
@ -659,13 +659,13 @@ TEST(EventTest, PointerDetailsTouch) {
|
|||||||
|
|
||||||
ui::TouchEvent touch_event_with_details(
|
ui::TouchEvent touch_event_with_details(
|
||||||
ET_TOUCH_PRESSED, gfx::Point(0, 0), ui::EventTimeForNow(),
|
ET_TOUCH_PRESSED, gfx::Point(0, 0), ui::EventTimeForNow(),
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 10.0f,
|
/* radius_x */ 10.0f,
|
||||||
/* radius_y */ 5.0f,
|
/* radius_y */ 5.0f,
|
||||||
/* force */ 15.0f));
|
/* force */ 15.0f));
|
||||||
|
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
|
EXPECT_EQ(EventPointerType::kTouch,
|
||||||
touch_event_with_details.pointer_details().pointer_type);
|
touch_event_with_details.pointer_details().pointer_type);
|
||||||
EXPECT_EQ(10.0f, touch_event_with_details.pointer_details().radius_x);
|
EXPECT_EQ(10.0f, touch_event_with_details.pointer_details().radius_x);
|
||||||
EXPECT_EQ(5.0f, touch_event_with_details.pointer_details().radius_y);
|
EXPECT_EQ(5.0f, touch_event_with_details.pointer_details().radius_y);
|
||||||
@ -682,7 +682,7 @@ TEST(EventTest, PointerDetailsMouse) {
|
|||||||
ui::MouseEvent mouse_event(ET_MOUSE_PRESSED, gfx::Point(0, 0),
|
ui::MouseEvent mouse_event(ET_MOUSE_PRESSED, gfx::Point(0, 0),
|
||||||
gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0);
|
gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0);
|
||||||
|
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_MOUSE,
|
EXPECT_EQ(EventPointerType::kMouse,
|
||||||
mouse_event.pointer_details().pointer_type);
|
mouse_event.pointer_details().pointer_type);
|
||||||
EXPECT_EQ(0.0f, mouse_event.pointer_details().radius_x);
|
EXPECT_EQ(0.0f, mouse_event.pointer_details().radius_x);
|
||||||
EXPECT_EQ(0.0f, mouse_event.pointer_details().radius_y);
|
EXPECT_EQ(0.0f, mouse_event.pointer_details().radius_y);
|
||||||
@ -695,7 +695,7 @@ TEST(EventTest, PointerDetailsMouse) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(EventTest, PointerDetailsStylus) {
|
TEST(EventTest, PointerDetailsStylus) {
|
||||||
ui::PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN,
|
ui::PointerDetails pointer_details(EventPointerType::kPen,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 0.0f,
|
/* radius_x */ 0.0f,
|
||||||
/* radius_y */ 0.0f,
|
/* radius_y */ 0.0f,
|
||||||
@ -708,7 +708,7 @@ TEST(EventTest, PointerDetailsStylus) {
|
|||||||
ui::MouseEvent stylus_event(ET_MOUSE_PRESSED, gfx::Point(0, 0),
|
ui::MouseEvent stylus_event(ET_MOUSE_PRESSED, gfx::Point(0, 0),
|
||||||
gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0,
|
gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0,
|
||||||
pointer_details);
|
pointer_details);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen,
|
||||||
stylus_event.pointer_details().pointer_type);
|
stylus_event.pointer_details().pointer_type);
|
||||||
EXPECT_EQ(21.0f, stylus_event.pointer_details().force);
|
EXPECT_EQ(21.0f, stylus_event.pointer_details().force);
|
||||||
EXPECT_EQ(45.0f, stylus_event.pointer_details().tilt_x);
|
EXPECT_EQ(45.0f, stylus_event.pointer_details().tilt_x);
|
||||||
@ -724,11 +724,11 @@ TEST(EventTest, PointerDetailsStylus) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(EventTest, PointerDetailsCustomTouch) {
|
TEST(EventTest, PointerDetailsCustomTouch) {
|
||||||
ui::TouchEvent touch_event(
|
ui::TouchEvent touch_event(ET_TOUCH_PRESSED, gfx::Point(0, 0),
|
||||||
ET_TOUCH_PRESSED, gfx::Point(0, 0), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
|
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
|
EXPECT_EQ(EventPointerType::kTouch,
|
||||||
touch_event.pointer_details().pointer_type);
|
touch_event.pointer_details().pointer_type);
|
||||||
EXPECT_EQ(0.0f, touch_event.pointer_details().radius_x);
|
EXPECT_EQ(0.0f, touch_event.pointer_details().radius_x);
|
||||||
EXPECT_EQ(0.0f, touch_event.pointer_details().radius_y);
|
EXPECT_EQ(0.0f, touch_event.pointer_details().radius_y);
|
||||||
@ -736,7 +736,7 @@ TEST(EventTest, PointerDetailsCustomTouch) {
|
|||||||
EXPECT_EQ(0.0f, touch_event.pointer_details().tilt_x);
|
EXPECT_EQ(0.0f, touch_event.pointer_details().tilt_x);
|
||||||
EXPECT_EQ(0.0f, touch_event.pointer_details().tilt_y);
|
EXPECT_EQ(0.0f, touch_event.pointer_details().tilt_y);
|
||||||
|
|
||||||
ui::PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN,
|
ui::PointerDetails pointer_details(EventPointerType::kPen,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 5.0f,
|
/* radius_x */ 5.0f,
|
||||||
/* radius_y */ 6.0f,
|
/* radius_y */ 6.0f,
|
||||||
@ -747,8 +747,7 @@ TEST(EventTest, PointerDetailsCustomTouch) {
|
|||||||
/* tangential_pressure */ 0.7f);
|
/* tangential_pressure */ 0.7f);
|
||||||
touch_event.SetPointerDetailsForTest(pointer_details);
|
touch_event.SetPointerDetailsForTest(pointer_details);
|
||||||
|
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen, touch_event.pointer_details().pointer_type);
|
||||||
touch_event.pointer_details().pointer_type);
|
|
||||||
EXPECT_EQ(21.0f, touch_event.pointer_details().force);
|
EXPECT_EQ(21.0f, touch_event.pointer_details().force);
|
||||||
EXPECT_EQ(45.0f, touch_event.pointer_details().tilt_x);
|
EXPECT_EQ(45.0f, touch_event.pointer_details().tilt_x);
|
||||||
EXPECT_EQ(-45.0f, touch_event.pointer_details().tilt_y);
|
EXPECT_EQ(-45.0f, touch_event.pointer_details().tilt_y);
|
||||||
|
@ -54,7 +54,7 @@ int GetChangedMouseButtonFlagsFromNative(const PlatformEvent& native_event) {
|
|||||||
|
|
||||||
PointerDetails GetMousePointerDetailsFromNative(
|
PointerDetails GetMousePointerDetailsFromNative(
|
||||||
const PlatformEvent& native_event) {
|
const PlatformEvent& native_event) {
|
||||||
return PointerDetails(EventPointerType::POINTER_TYPE_MOUSE);
|
return PointerDetails(EventPointerType::kMouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Vector2d GetMouseWheelOffset(const PlatformEvent& native_event) {
|
gfx::Vector2d GetMouseWheelOffset(const PlatformEvent& native_event) {
|
||||||
@ -72,7 +72,7 @@ void ReleaseCopiedNativeEvent(const PlatformEvent& event) {}
|
|||||||
PointerDetails GetTouchPointerDetailsFromNative(
|
PointerDetails GetTouchPointerDetailsFromNative(
|
||||||
const PlatformEvent& native_event) {
|
const PlatformEvent& native_event) {
|
||||||
NOTIMPLEMENTED();
|
NOTIMPLEMENTED();
|
||||||
return PointerDetails(EventPointerType::POINTER_TYPE_UNKNOWN,
|
return PointerDetails(EventPointerType::kUnknown,
|
||||||
/* radius_x */ 1.0,
|
/* radius_x */ 1.0,
|
||||||
/* radius_y */ 1.0,
|
/* radius_y */ 1.0,
|
||||||
/* force */ 0.f,
|
/* force */ 0.f,
|
||||||
|
@ -133,7 +133,7 @@ bool InputEventDispatcher::ProcessTouchEvent(
|
|||||||
|
|
||||||
// TODO(crbug.com/876933): Add more detailed fields such as
|
// TODO(crbug.com/876933): Add more detailed fields such as
|
||||||
// force/orientation/tilt once they are added to PointerEvent.
|
// force/orientation/tilt once they are added to PointerEvent.
|
||||||
ui::PointerDetails pointer_details(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails pointer_details(ui::EventPointerType::kTouch,
|
||||||
event.pointer_id);
|
event.pointer_id);
|
||||||
|
|
||||||
ui::TouchEvent touch_event(event_type, gfx::Point(),
|
ui::TouchEvent touch_event(event_type, gfx::Point(),
|
||||||
|
@ -13,18 +13,18 @@ namespace {
|
|||||||
EventPointerType ToEventPointerType(MotionEvent::ToolType tool_type) {
|
EventPointerType ToEventPointerType(MotionEvent::ToolType tool_type) {
|
||||||
switch (tool_type) {
|
switch (tool_type) {
|
||||||
case MotionEvent::ToolType::UNKNOWN:
|
case MotionEvent::ToolType::UNKNOWN:
|
||||||
return EventPointerType::POINTER_TYPE_UNKNOWN;
|
return EventPointerType::kUnknown;
|
||||||
case MotionEvent::ToolType::FINGER:
|
case MotionEvent::ToolType::FINGER:
|
||||||
return EventPointerType::POINTER_TYPE_TOUCH;
|
return EventPointerType::kTouch;
|
||||||
case MotionEvent::ToolType::STYLUS:
|
case MotionEvent::ToolType::STYLUS:
|
||||||
return EventPointerType::POINTER_TYPE_PEN;
|
return EventPointerType::kPen;
|
||||||
case MotionEvent::ToolType::MOUSE:
|
case MotionEvent::ToolType::MOUSE:
|
||||||
return EventPointerType::POINTER_TYPE_MOUSE;
|
return EventPointerType::kMouse;
|
||||||
case MotionEvent::ToolType::ERASER:
|
case MotionEvent::ToolType::ERASER:
|
||||||
return EventPointerType::POINTER_TYPE_ERASER;
|
return EventPointerType::kEraser;
|
||||||
default:
|
default:
|
||||||
NOTREACHED() << "Invalid ToolType = " << tool_type;
|
NOTREACHED() << "Invalid ToolType = " << tool_type;
|
||||||
return EventPointerType::POINTER_TYPE_UNKNOWN;
|
return EventPointerType::kUnknown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,8 +227,7 @@ struct EVENTS_BASE_EXPORT GestureEventDetails {
|
|||||||
bool is_source_touch_event_set_non_blocking_ = false;
|
bool is_source_touch_event_set_non_blocking_ = false;
|
||||||
|
|
||||||
// The pointer type for the first touch point in the gesture.
|
// The pointer type for the first touch point in the gesture.
|
||||||
EventPointerType primary_pointer_type_ =
|
EventPointerType primary_pointer_type_ = EventPointerType::kUnknown;
|
||||||
EventPointerType::POINTER_TYPE_UNKNOWN;
|
|
||||||
|
|
||||||
int touch_points_; // Number of active touch points in the gesture.
|
int touch_points_; // Number of active touch points in the gesture.
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ GestureProviderAura::GetAndResetPendingGestures() {
|
|||||||
void GestureProviderAura::OnTouchEnter(int pointer_id, float x, float y) {
|
void GestureProviderAura::OnTouchEnter(int pointer_id, float x, float y) {
|
||||||
auto touch_event = std::make_unique<TouchEvent>(
|
auto touch_event = std::make_unique<TouchEvent>(
|
||||||
ET_TOUCH_PRESSED, gfx::Point(), ui::EventTimeForNow(),
|
ET_TOUCH_PRESSED, gfx::Point(), ui::EventTimeForNow(),
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, pointer_id),
|
PointerDetails(ui::EventPointerType::kTouch, pointer_id),
|
||||||
EF_IS_SYNTHESIZED);
|
EF_IS_SYNTHESIZED);
|
||||||
gfx::PointF point(x, y);
|
gfx::PointF point(x, y);
|
||||||
touch_event->set_location_f(point);
|
touch_event->set_location_f(point);
|
||||||
|
@ -42,40 +42,35 @@ class GestureProviderAuraTest : public testing::Test,
|
|||||||
|
|
||||||
TEST_F(GestureProviderAuraTest, IgnoresExtraPressEvents) {
|
TEST_F(GestureProviderAuraTest, IgnoresExtraPressEvents) {
|
||||||
base::TimeTicks time = ui::EventTimeForNow();
|
base::TimeTicks time = ui::EventTimeForNow();
|
||||||
TouchEvent press1(
|
TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
||||||
ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&press1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&press1));
|
||||||
|
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
TouchEvent press2(
|
TouchEvent press2(ET_TOUCH_PRESSED, gfx::Point(30, 40), time,
|
||||||
ET_TOUCH_PRESSED, gfx::Point(30, 40), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_FALSE(provider()->OnTouchEvent(&press2));
|
EXPECT_FALSE(provider()->OnTouchEvent(&press2));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GestureProviderAuraTest, IgnoresExtraMoveOrReleaseEvents) {
|
TEST_F(GestureProviderAuraTest, IgnoresExtraMoveOrReleaseEvents) {
|
||||||
base::TimeTicks time = ui::EventTimeForNow();
|
base::TimeTicks time = ui::EventTimeForNow();
|
||||||
TouchEvent press1(
|
TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
||||||
ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&press1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&press1));
|
||||||
|
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
TouchEvent release1(
|
TouchEvent release1(ET_TOUCH_RELEASED, gfx::Point(30, 40), time,
|
||||||
ET_TOUCH_RELEASED, gfx::Point(30, 40), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&release1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&release1));
|
||||||
|
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
TouchEvent release2(
|
TouchEvent release2(ET_TOUCH_RELEASED, gfx::Point(30, 45), time,
|
||||||
ET_TOUCH_RELEASED, gfx::Point(30, 45), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_FALSE(provider()->OnTouchEvent(&release1));
|
EXPECT_FALSE(provider()->OnTouchEvent(&release1));
|
||||||
|
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
TouchEvent move1(ET_TOUCH_MOVED, gfx::Point(70, 75), time,
|
TouchEvent move1(ET_TOUCH_MOVED, gfx::Point(70, 75), time,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
EXPECT_FALSE(provider()->OnTouchEvent(&move1));
|
EXPECT_FALSE(provider()->OnTouchEvent(&move1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,39 +78,33 @@ TEST_F(GestureProviderAuraTest, DoesntStallOnCancelAndRelease) {
|
|||||||
GestureConfiguration::GetInstance()->set_single_pointer_cancel_enabled(false);
|
GestureConfiguration::GetInstance()->set_single_pointer_cancel_enabled(false);
|
||||||
base::TimeTicks time = ui::EventTimeForNow();
|
base::TimeTicks time = ui::EventTimeForNow();
|
||||||
|
|
||||||
TouchEvent touch_press(
|
TouchEvent touch_press(ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
||||||
ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent pen_press1(
|
TouchEvent pen_press1(ET_TOUCH_PRESSED, gfx::Point(20, 20), time,
|
||||||
ET_TOUCH_PRESSED, gfx::Point(20, 20), time,
|
PointerDetails(ui::EventPointerType::kPen, 1));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_PEN, 1));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&pen_press1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&pen_press1));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_cancel(
|
TouchEvent touch_cancel(ET_TOUCH_CANCELLED, gfx::Point(30, 30), time,
|
||||||
ET_TOUCH_CANCELLED, gfx::Point(30, 30), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_cancel));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_cancel));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent pen_release1(
|
TouchEvent pen_release1(ET_TOUCH_RELEASED, gfx::Point(40, 40), time,
|
||||||
ET_TOUCH_RELEASED, gfx::Point(40, 40), time,
|
PointerDetails(ui::EventPointerType::kPen, 1));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_PEN, 1));
|
|
||||||
EXPECT_FALSE(provider()->OnTouchEvent(&pen_release1));
|
EXPECT_FALSE(provider()->OnTouchEvent(&pen_release1));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent pen_press2(
|
TouchEvent pen_press2(ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
||||||
ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
PointerDetails(ui::EventPointerType::kPen, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_PEN, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&pen_press2));
|
EXPECT_TRUE(provider()->OnTouchEvent(&pen_press2));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent pen_release2(
|
TouchEvent pen_release2(ET_TOUCH_RELEASED, gfx::Point(10, 10), time,
|
||||||
ET_TOUCH_RELEASED, gfx::Point(10, 10), time,
|
PointerDetails(ui::EventPointerType::kPen, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_PEN, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&pen_release2));
|
EXPECT_TRUE(provider()->OnTouchEvent(&pen_release2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,45 +112,38 @@ TEST_F(GestureProviderAuraTest, ContinueGestureDetectionAfterCancel) {
|
|||||||
GestureConfiguration::GetInstance()->set_single_pointer_cancel_enabled(true);
|
GestureConfiguration::GetInstance()->set_single_pointer_cancel_enabled(true);
|
||||||
base::TimeTicks time = ui::EventTimeForNow();
|
base::TimeTicks time = ui::EventTimeForNow();
|
||||||
|
|
||||||
TouchEvent touch_press1(
|
TouchEvent touch_press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
||||||
ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press1));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_press2(
|
TouchEvent touch_press2(ET_TOUCH_PRESSED, gfx::Point(20, 20), time,
|
||||||
ET_TOUCH_PRESSED, gfx::Point(20, 20), time,
|
PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press2));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press2));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_move1(
|
TouchEvent touch_move1(ET_TOUCH_MOVED, gfx::Point(30, 30), time,
|
||||||
ET_TOUCH_MOVED, gfx::Point(30, 30), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move1));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_move2(
|
TouchEvent touch_move2(ET_TOUCH_MOVED, gfx::Point(40, 40), time,
|
||||||
ET_TOUCH_MOVED, gfx::Point(40, 40), time,
|
PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move2));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move2));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_cancel(
|
TouchEvent touch_cancel(ET_TOUCH_CANCELLED, gfx::Point(50, 50), time,
|
||||||
ET_TOUCH_CANCELLED, gfx::Point(50, 50), time,
|
PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_cancel));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_cancel));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_move3(
|
TouchEvent touch_move3(ET_TOUCH_MOVED, gfx::Point(60, 60), time,
|
||||||
ET_TOUCH_MOVED, gfx::Point(60, 60), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move3));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move3));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_release(
|
TouchEvent touch_release(ET_TOUCH_RELEASED, gfx::Point(70, 70), time,
|
||||||
ET_TOUCH_RELEASED, gfx::Point(70, 70), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_release));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_release));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
}
|
}
|
||||||
@ -170,75 +152,63 @@ TEST_F(GestureProviderAuraTest, ContinueGestureDetectionAfterMultipleCancel) {
|
|||||||
GestureConfiguration::GetInstance()->set_single_pointer_cancel_enabled(true);
|
GestureConfiguration::GetInstance()->set_single_pointer_cancel_enabled(true);
|
||||||
base::TimeTicks time = ui::EventTimeForNow();
|
base::TimeTicks time = ui::EventTimeForNow();
|
||||||
|
|
||||||
TouchEvent touch_press1(
|
TouchEvent touch_press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
||||||
ET_TOUCH_PRESSED, gfx::Point(10, 10), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press1));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_press2(
|
TouchEvent touch_press2(ET_TOUCH_PRESSED, gfx::Point(20, 20), time,
|
||||||
ET_TOUCH_PRESSED, gfx::Point(20, 20), time,
|
PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press2));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press2));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_press3(
|
TouchEvent touch_press3(ET_TOUCH_PRESSED, gfx::Point(30, 30), time,
|
||||||
ET_TOUCH_PRESSED, gfx::Point(30, 30), time,
|
PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press3));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_press3));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_move1(
|
TouchEvent touch_move1(ET_TOUCH_MOVED, gfx::Point(40, 40), time,
|
||||||
ET_TOUCH_MOVED, gfx::Point(40, 40), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move1));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_move2(
|
TouchEvent touch_move2(ET_TOUCH_MOVED, gfx::Point(50, 50), time,
|
||||||
ET_TOUCH_MOVED, gfx::Point(50, 50), time,
|
PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move2));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move2));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_move3(
|
TouchEvent touch_move3(ET_TOUCH_MOVED, gfx::Point(60, 60), time,
|
||||||
ET_TOUCH_MOVED, gfx::Point(60, 60), time,
|
PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move3));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move3));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_cancel1(
|
TouchEvent touch_cancel1(ET_TOUCH_CANCELLED, gfx::Point(70, 70), time,
|
||||||
ET_TOUCH_CANCELLED, gfx::Point(70, 70), time,
|
PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_cancel1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_cancel1));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_move4(
|
TouchEvent touch_move4(ET_TOUCH_MOVED, gfx::Point(80, 80), time,
|
||||||
ET_TOUCH_MOVED, gfx::Point(80, 80), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move4));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move4));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_move5(
|
TouchEvent touch_move5(ET_TOUCH_MOVED, gfx::Point(90, 90), time,
|
||||||
ET_TOUCH_MOVED, gfx::Point(90, 90), time,
|
PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move5));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move5));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_cancel2(
|
TouchEvent touch_cancel2(ET_TOUCH_CANCELLED, gfx::Point(100, 100), time,
|
||||||
ET_TOUCH_CANCELLED, gfx::Point(100, 100), time,
|
PointerDetails(ui::EventPointerType::kTouch, 2));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_cancel2));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_cancel2));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_move6(
|
TouchEvent touch_move6(ET_TOUCH_MOVED, gfx::Point(110, 110), time,
|
||||||
ET_TOUCH_MOVED, gfx::Point(110, 110), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move6));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_move6));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
|
|
||||||
TouchEvent touch_release(
|
TouchEvent touch_release(ET_TOUCH_RELEASED, gfx::Point(120, 120), time,
|
||||||
ET_TOUCH_RELEASED, gfx::Point(120, 120), time,
|
PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&touch_release));
|
EXPECT_TRUE(provider()->OnTouchEvent(&touch_release));
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
}
|
}
|
||||||
@ -251,30 +221,26 @@ TEST_F(GestureProviderAuraTest, IgnoresIdenticalMoveEvents) {
|
|||||||
const int kTouchId0 = 5;
|
const int kTouchId0 = 5;
|
||||||
const int kTouchId1 = 3;
|
const int kTouchId1 = 3;
|
||||||
|
|
||||||
PointerDetails pointer_details1(EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails pointer_details1(EventPointerType::kTouch, kTouchId0);
|
||||||
kTouchId0);
|
|
||||||
base::TimeTicks time = ui::EventTimeForNow();
|
base::TimeTicks time = ui::EventTimeForNow();
|
||||||
TouchEvent press0_1(ET_TOUCH_PRESSED, gfx::Point(9, 10), time,
|
TouchEvent press0_1(ET_TOUCH_PRESSED, gfx::Point(9, 10), time,
|
||||||
pointer_details1);
|
pointer_details1);
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&press0_1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&press0_1));
|
||||||
|
|
||||||
PointerDetails pointer_details2(EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails pointer_details2(EventPointerType::kTouch, kTouchId1);
|
||||||
kTouchId1);
|
|
||||||
TouchEvent press1_1(ET_TOUCH_PRESSED, gfx::Point(40, 40), time,
|
TouchEvent press1_1(ET_TOUCH_PRESSED, gfx::Point(40, 40), time,
|
||||||
pointer_details2);
|
pointer_details2);
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&press1_1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&press1_1));
|
||||||
|
|
||||||
time += base::TimeDelta::FromMilliseconds(10);
|
time += base::TimeDelta::FromMilliseconds(10);
|
||||||
pointer_details1 =
|
pointer_details1 = PointerDetails(EventPointerType::kTouch, kTouchId0,
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_TOUCH, kTouchId0, kRadiusX,
|
kRadiusX, kRadiusY, kForce, kAngle);
|
||||||
kRadiusY, kForce, kAngle);
|
|
||||||
TouchEvent move0_1(ET_TOUCH_MOVED, gfx::Point(10, 10), time, pointer_details1,
|
TouchEvent move0_1(ET_TOUCH_MOVED, gfx::Point(10, 10), time, pointer_details1,
|
||||||
0);
|
0);
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&move0_1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&move0_1));
|
||||||
|
|
||||||
pointer_details2 =
|
pointer_details2 = PointerDetails(EventPointerType::kTouch, kTouchId1,
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_TOUCH, kTouchId1, kRadiusX,
|
kRadiusX, kRadiusY, kForce, kAngle);
|
||||||
kRadiusY, kForce, kAngle);
|
|
||||||
TouchEvent move1_1(ET_TOUCH_MOVED, gfx::Point(100, 200), time,
|
TouchEvent move1_1(ET_TOUCH_MOVED, gfx::Point(100, 200), time,
|
||||||
pointer_details2, 0);
|
pointer_details2, 0);
|
||||||
EXPECT_TRUE(provider()->OnTouchEvent(&move1_1));
|
EXPECT_TRUE(provider()->OnTouchEvent(&move1_1));
|
||||||
|
@ -230,7 +230,7 @@ GestureRecognizerImpl::GetEventPerPointForConsumer(GestureConsumer* consumer,
|
|||||||
for (size_t i = 0; i < pointer_state.GetPointerCount(); ++i) {
|
for (size_t i = 0; i < pointer_state.GetPointerCount(); ++i) {
|
||||||
auto touch_event = std::make_unique<TouchEvent>(
|
auto touch_event = std::make_unique<TouchEvent>(
|
||||||
type, gfx::Point(), EventTimeForNow(),
|
type, gfx::Point(), EventTimeForNow(),
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
pointer_state.GetPointerId(i)),
|
pointer_state.GetPointerId(i)),
|
||||||
EF_IS_SYNTHESIZED);
|
EF_IS_SYNTHESIZED);
|
||||||
gfx::PointF point(pointer_state.GetX(i), pointer_state.GetY(i));
|
gfx::PointF point(pointer_state.GetX(i), pointer_state.GetY(i));
|
||||||
|
@ -13,15 +13,15 @@ namespace {
|
|||||||
MotionEvent::ToolType EventPointerTypeToMotionEventToolType(
|
MotionEvent::ToolType EventPointerTypeToMotionEventToolType(
|
||||||
EventPointerType type) {
|
EventPointerType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EventPointerType::POINTER_TYPE_UNKNOWN:
|
case EventPointerType::kUnknown:
|
||||||
return MotionEvent::ToolType::UNKNOWN;
|
return MotionEvent::ToolType::UNKNOWN;
|
||||||
case EventPointerType::POINTER_TYPE_MOUSE:
|
case EventPointerType::kMouse:
|
||||||
return MotionEvent::ToolType::MOUSE;
|
return MotionEvent::ToolType::MOUSE;
|
||||||
case EventPointerType::POINTER_TYPE_PEN:
|
case EventPointerType::kPen:
|
||||||
return MotionEvent::ToolType::STYLUS;
|
return MotionEvent::ToolType::STYLUS;
|
||||||
case EventPointerType::POINTER_TYPE_TOUCH:
|
case EventPointerType::kTouch:
|
||||||
return MotionEvent::ToolType::FINGER;
|
return MotionEvent::ToolType::FINGER;
|
||||||
case EventPointerType::POINTER_TYPE_ERASER:
|
case EventPointerType::kEraser:
|
||||||
return MotionEvent::ToolType::ERASER;
|
return MotionEvent::ToolType::ERASER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,8 +49,8 @@ PointerProperties GetPointerPropertiesFromTouchEvent(const TouchEvent& touch) {
|
|||||||
if (!pointer_properties.touch_major) {
|
if (!pointer_properties.touch_major) {
|
||||||
float default_size;
|
float default_size;
|
||||||
switch (touch.pointer_details().pointer_type) {
|
switch (touch.pointer_details().pointer_type) {
|
||||||
case EventPointerType::POINTER_TYPE_PEN:
|
case EventPointerType::kPen:
|
||||||
case EventPointerType::POINTER_TYPE_ERASER:
|
case EventPointerType::kEraser:
|
||||||
// Default size for stylus events is 1x1.
|
// Default size for stylus events is 1x1.
|
||||||
default_size = 1;
|
default_size = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -12,9 +12,8 @@
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
ui::TouchEvent TouchWithType(ui::EventType type, int id) {
|
ui::TouchEvent TouchWithType(ui::EventType type, int id) {
|
||||||
return ui::TouchEvent(
|
return ui::TouchEvent(type, gfx::Point(0, 0), base::TimeTicks(),
|
||||||
type, gfx::Point(0, 0), base::TimeTicks(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, id));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui::TouchEvent TouchWithPosition(ui::EventType type,
|
ui::TouchEvent TouchWithPosition(ui::EventType type,
|
||||||
@ -23,9 +22,8 @@ ui::TouchEvent TouchWithPosition(ui::EventType type,
|
|||||||
float y,
|
float y,
|
||||||
float raw_x,
|
float raw_x,
|
||||||
float raw_y) {
|
float raw_y) {
|
||||||
ui::TouchEvent event(
|
ui::TouchEvent event(type, gfx::Point(), base::TimeTicks(),
|
||||||
type, gfx::Point(), base::TimeTicks(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, id));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, id));
|
|
||||||
event.set_location_f(gfx::PointF(x, y));
|
event.set_location_f(gfx::PointF(x, y));
|
||||||
event.set_root_location_f(gfx::PointF(raw_x, raw_y));
|
event.set_root_location_f(gfx::PointF(raw_x, raw_y));
|
||||||
return event;
|
return event;
|
||||||
@ -39,8 +37,8 @@ ui::TouchEvent TouchWithTapParams(ui::EventType type,
|
|||||||
float pressure) {
|
float pressure) {
|
||||||
ui::TouchEvent event(
|
ui::TouchEvent event(
|
||||||
type, gfx::Point(1, 1), base::TimeTicks(),
|
type, gfx::Point(1, 1), base::TimeTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, id, radius_x,
|
ui::PointerDetails(ui::EventPointerType::kTouch, id, radius_x, radius_y,
|
||||||
radius_y, pressure, rotation_angle),
|
pressure, rotation_angle),
|
||||||
0);
|
0);
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
@ -50,9 +48,8 @@ base::TimeTicks MsToTicks(int ms) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui::TouchEvent TouchWithTime(ui::EventType type, int id, int ms) {
|
ui::TouchEvent TouchWithTime(ui::EventType type, int id, int ms) {
|
||||||
return ui::TouchEvent(
|
return ui::TouchEvent(type, gfx::Point(0, 0), MsToTicks(ms),
|
||||||
type, gfx::Point(0, 0), MsToTicks(ms),
|
ui::PointerDetails(ui::EventPointerType::kTouch, id));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -434,7 +431,7 @@ TEST(MotionEventAuraTest, ToolType) {
|
|||||||
EXPECT_EQ(MotionEvent::ToolType::FINGER, event.GetToolType(0));
|
EXPECT_EQ(MotionEvent::ToolType::FINGER, event.GetToolType(0));
|
||||||
|
|
||||||
touch_event = TouchWithType(ET_TOUCH_RELEASED, 7);
|
touch_event = TouchWithType(ET_TOUCH_RELEASED, 7);
|
||||||
PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN,
|
PointerDetails pointer_details(EventPointerType::kPen,
|
||||||
/* pointer_id*/ 7,
|
/* pointer_id*/ 7,
|
||||||
/* radius_x */ 5.0f,
|
/* radius_x */ 5.0f,
|
||||||
/* radius_y */ 5.0f,
|
/* radius_y */ 5.0f,
|
||||||
@ -539,9 +536,9 @@ TEST(MotionEventAuraTest, IgnoresTouchesOverCapacity) {
|
|||||||
|
|
||||||
TEST(MotionEventAuraTest, PenRadiusDefault) {
|
TEST(MotionEventAuraTest, PenRadiusDefault) {
|
||||||
MotionEventAura event;
|
MotionEventAura event;
|
||||||
TouchEvent touch_event = ui::TouchEvent(
|
TouchEvent touch_event =
|
||||||
ET_TOUCH_PRESSED, gfx::Point(0, 0), base::TimeTicks(),
|
ui::TouchEvent(ET_TOUCH_PRESSED, gfx::Point(0, 0), base::TimeTicks(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_PEN, 7));
|
ui::PointerDetails(ui::EventPointerType::kPen, 7));
|
||||||
EXPECT_TRUE(event.OnTouch(touch_event));
|
EXPECT_TRUE(event.OnTouch(touch_event));
|
||||||
EXPECT_EQ(MotionEvent::ToolType::STYLUS, event.GetToolType(0));
|
EXPECT_EQ(MotionEvent::ToolType::STYLUS, event.GetToolType(0));
|
||||||
EXPECT_EQ(1u, event.GetTouchMajor(0));
|
EXPECT_EQ(1u, event.GetTouchMajor(0));
|
||||||
|
@ -104,15 +104,15 @@ template <>
|
|||||||
struct EnumTraits<ui::mojom::PointerKind, ui::EventPointerType> {
|
struct EnumTraits<ui::mojom::PointerKind, ui::EventPointerType> {
|
||||||
static ui::mojom::PointerKind ToMojom(ui::EventPointerType input) {
|
static ui::mojom::PointerKind ToMojom(ui::EventPointerType input) {
|
||||||
switch (input) {
|
switch (input) {
|
||||||
case ui::EventPointerType::POINTER_TYPE_UNKNOWN:
|
case ui::EventPointerType::kUnknown:
|
||||||
return ui::mojom::PointerKind::UNKNOWN;
|
return ui::mojom::PointerKind::UNKNOWN;
|
||||||
case ui::EventPointerType::POINTER_TYPE_MOUSE:
|
case ui::EventPointerType::kMouse:
|
||||||
return ui::mojom::PointerKind::MOUSE;
|
return ui::mojom::PointerKind::MOUSE;
|
||||||
case ui::EventPointerType::POINTER_TYPE_PEN:
|
case ui::EventPointerType::kPen:
|
||||||
return ui::mojom::PointerKind::PEN;
|
return ui::mojom::PointerKind::PEN;
|
||||||
case ui::EventPointerType::POINTER_TYPE_TOUCH:
|
case ui::EventPointerType::kTouch:
|
||||||
return ui::mojom::PointerKind::TOUCH;
|
return ui::mojom::PointerKind::TOUCH;
|
||||||
case ui::EventPointerType::POINTER_TYPE_ERASER:
|
case ui::EventPointerType::kEraser:
|
||||||
return ui::mojom::PointerKind::ERASER;
|
return ui::mojom::PointerKind::ERASER;
|
||||||
}
|
}
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
@ -123,19 +123,19 @@ struct EnumTraits<ui::mojom::PointerKind, ui::EventPointerType> {
|
|||||||
ui::EventPointerType* out) {
|
ui::EventPointerType* out) {
|
||||||
switch (input) {
|
switch (input) {
|
||||||
case ui::mojom::PointerKind::UNKNOWN:
|
case ui::mojom::PointerKind::UNKNOWN:
|
||||||
*out = ui::EventPointerType::POINTER_TYPE_UNKNOWN;
|
*out = ui::EventPointerType::kUnknown;
|
||||||
return true;
|
return true;
|
||||||
case ui::mojom::PointerKind::MOUSE:
|
case ui::mojom::PointerKind::MOUSE:
|
||||||
*out = ui::EventPointerType::POINTER_TYPE_MOUSE;
|
*out = ui::EventPointerType::kMouse;
|
||||||
return true;
|
return true;
|
||||||
case ui::mojom::PointerKind::PEN:
|
case ui::mojom::PointerKind::PEN:
|
||||||
*out = ui::EventPointerType::POINTER_TYPE_PEN;
|
*out = ui::EventPointerType::kPen;
|
||||||
return true;
|
return true;
|
||||||
case ui::mojom::PointerKind::TOUCH:
|
case ui::mojom::PointerKind::TOUCH:
|
||||||
*out = ui::EventPointerType::POINTER_TYPE_TOUCH;
|
*out = ui::EventPointerType::kTouch;
|
||||||
return true;
|
return true;
|
||||||
case ui::mojom::PointerKind::ERASER:
|
case ui::mojom::PointerKind::ERASER:
|
||||||
*out = ui::EventPointerType::POINTER_TYPE_ERASER;
|
*out = ui::EventPointerType::kEraser;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "mojo/public/cpp/test_support/test_utils.h"
|
#include "mojo/public/cpp/test_support/test_utils.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
#include "ui/events/event.h"
|
#include "ui/events/event.h"
|
||||||
|
#include "ui/events/ipc/ui_events_param_traits_macros.h"
|
||||||
#include "ui/events/keycodes/dom/dom_code.h"
|
#include "ui/events/keycodes/dom/dom_code.h"
|
||||||
#include "ui/events/mojom/event.mojom.h"
|
#include "ui/events/mojom/event.mojom.h"
|
||||||
#include "ui/events/mojom/event_mojom_traits.h"
|
#include "ui/events/mojom/event_mojom_traits.h"
|
||||||
@ -125,30 +126,29 @@ TEST(StructTraitsTest, MouseEvent) {
|
|||||||
const MouseEvent kTestData[] = {
|
const MouseEvent kTestData[] = {
|
||||||
{ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(20, 30),
|
{ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(20, 30),
|
||||||
base::TimeTicks() + base::TimeDelta::FromMicroseconds(201), EF_NONE, 0,
|
base::TimeTicks() + base::TimeDelta::FromMicroseconds(201), EF_NONE, 0,
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, kPointerIdMouse)},
|
PointerDetails(EventPointerType::kMouse, kPointerIdMouse)},
|
||||||
{ET_MOUSE_DRAGGED, gfx::Point(1, 5), gfx::Point(5, 1),
|
{ET_MOUSE_DRAGGED, gfx::Point(1, 5), gfx::Point(5, 1),
|
||||||
base::TimeTicks() + base::TimeDelta::FromMicroseconds(202),
|
base::TimeTicks() + base::TimeDelta::FromMicroseconds(202),
|
||||||
EF_LEFT_MOUSE_BUTTON, EF_LEFT_MOUSE_BUTTON,
|
EF_LEFT_MOUSE_BUTTON, EF_LEFT_MOUSE_BUTTON,
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, kPointerIdMouse)},
|
PointerDetails(EventPointerType::kMouse, kPointerIdMouse)},
|
||||||
{ET_MOUSE_RELEASED, gfx::Point(411, 130), gfx::Point(20, 30),
|
{ET_MOUSE_RELEASED, gfx::Point(411, 130), gfx::Point(20, 30),
|
||||||
base::TimeTicks() + base::TimeDelta::FromMicroseconds(203),
|
base::TimeTicks() + base::TimeDelta::FromMicroseconds(203),
|
||||||
EF_MIDDLE_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON, EF_RIGHT_MOUSE_BUTTON,
|
EF_MIDDLE_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON, EF_RIGHT_MOUSE_BUTTON,
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, kPointerIdMouse)},
|
PointerDetails(EventPointerType::kMouse, kPointerIdMouse)},
|
||||||
{ET_MOUSE_MOVED, gfx::Point(0, 1), gfx::Point(2, 3),
|
{ET_MOUSE_MOVED, gfx::Point(0, 1), gfx::Point(2, 3),
|
||||||
base::TimeTicks() + base::TimeDelta::FromMicroseconds(204), EF_ALT_DOWN,
|
base::TimeTicks() + base::TimeDelta::FromMicroseconds(204), EF_ALT_DOWN,
|
||||||
0,
|
0, PointerDetails(EventPointerType::kMouse, kPointerIdMouse)},
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, kPointerIdMouse)},
|
|
||||||
{ET_MOUSE_ENTERED, gfx::Point(6, 7), gfx::Point(8, 9),
|
{ET_MOUSE_ENTERED, gfx::Point(6, 7), gfx::Point(8, 9),
|
||||||
base::TimeTicks() + base::TimeDelta::FromMicroseconds(205), EF_NONE, 0,
|
base::TimeTicks() + base::TimeDelta::FromMicroseconds(205), EF_NONE, 0,
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, kPointerIdMouse)},
|
PointerDetails(EventPointerType::kMouse, kPointerIdMouse)},
|
||||||
{ET_MOUSE_EXITED, gfx::Point(10, 10), gfx::Point(20, 30),
|
{ET_MOUSE_EXITED, gfx::Point(10, 10), gfx::Point(20, 30),
|
||||||
base::TimeTicks() + base::TimeDelta::FromMicroseconds(206),
|
base::TimeTicks() + base::TimeDelta::FromMicroseconds(206),
|
||||||
EF_BACK_MOUSE_BUTTON, 0,
|
EF_BACK_MOUSE_BUTTON, 0,
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, kPointerIdMouse)},
|
PointerDetails(EventPointerType::kMouse, kPointerIdMouse)},
|
||||||
{ET_MOUSE_CAPTURE_CHANGED, gfx::Point(99, 99), gfx::Point(99, 99),
|
{ET_MOUSE_CAPTURE_CHANGED, gfx::Point(99, 99), gfx::Point(99, 99),
|
||||||
base::TimeTicks() + base::TimeDelta::FromMicroseconds(207),
|
base::TimeTicks() + base::TimeDelta::FromMicroseconds(207),
|
||||||
EF_CONTROL_DOWN, 0,
|
EF_CONTROL_DOWN, 0,
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, kPointerIdMouse)},
|
PointerDetails(EventPointerType::kMouse, kPointerIdMouse)},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(kTestData); i++) {
|
for (size_t i = 0; i < base::size(kTestData); i++) {
|
||||||
@ -332,13 +332,11 @@ TEST(StructTraitsTest, ScrollEvent) {
|
|||||||
|
|
||||||
TEST(StructTraitsTest, PointerDetails) {
|
TEST(StructTraitsTest, PointerDetails) {
|
||||||
const PointerDetails kTestData[] = {
|
const PointerDetails kTestData[] = {
|
||||||
{EventPointerType::POINTER_TYPE_UNKNOWN, 1, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f},
|
{EventPointerType::kUnknown, 1, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f},
|
||||||
{EventPointerType::POINTER_TYPE_MOUSE, 1, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f},
|
{EventPointerType::kMouse, 1, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f},
|
||||||
{EventPointerType::POINTER_TYPE_PEN, 11, 12.f, 13.f, 14.f, 15.f, 16.f,
|
{EventPointerType::kPen, 11, 12.f, 13.f, 14.f, 15.f, 16.f, 17.f},
|
||||||
17.f},
|
{EventPointerType::kTouch, 1, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f},
|
||||||
{EventPointerType::POINTER_TYPE_TOUCH, 1, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f},
|
{EventPointerType::kEraser, 21, 22.f, 23.f, 24.f, 25.f, 26.f, 27.f},
|
||||||
{EventPointerType::POINTER_TYPE_ERASER, 21, 22.f, 23.f, 24.f, 25.f, 26.f,
|
|
||||||
27.f},
|
|
||||||
};
|
};
|
||||||
for (size_t i = 0; i < base::size(kTestData); i++) {
|
for (size_t i = 0; i < base::size(kTestData); i++) {
|
||||||
// Set |offset| as the constructor used above does not modify it.
|
// Set |offset| as the constructor used above does not modify it.
|
||||||
@ -358,8 +356,7 @@ TEST(StructTraitsTest, TouchEvent) {
|
|||||||
{ET_TOUCH_RELEASED,
|
{ET_TOUCH_RELEASED,
|
||||||
{1, 2},
|
{1, 2},
|
||||||
base::TimeTicks::Now(),
|
base::TimeTicks::Now(),
|
||||||
{EventPointerType::POINTER_TYPE_UNKNOWN, 1, 2.f, 3.f, 4.f, 5.f, 6.f,
|
{EventPointerType::kUnknown, 1, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f},
|
||||||
7.f},
|
|
||||||
EF_SHIFT_DOWN},
|
EF_SHIFT_DOWN},
|
||||||
{ET_TOUCH_PRESSED, {1, 2}, base::TimeTicks::Now(), {}, EF_CONTROL_DOWN},
|
{ET_TOUCH_PRESSED, {1, 2}, base::TimeTicks::Now(), {}, EF_CONTROL_DOWN},
|
||||||
{ET_TOUCH_MOVED, {1, 2}, base::TimeTicks::Now(), {}, EF_NONE},
|
{ET_TOUCH_MOVED, {1, 2}, base::TimeTicks::Now(), {}, EF_NONE},
|
||||||
|
@ -239,8 +239,8 @@ void EventConverterEvdevImpl::OnButtonChange(int code,
|
|||||||
|
|
||||||
dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
|
dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
|
||||||
input_device_.id, EF_NONE, cursor_->GetLocation(), code, down,
|
input_device_.id, EF_NONE, cursor_->GetLocation(), code, down,
|
||||||
/* allow_remap */ true,
|
/* allow_remap */ true, PointerDetails(EventPointerType::kMouse),
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), timestamp));
|
timestamp));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventConverterEvdevImpl::FlushEvents(const input_event& input) {
|
void EventConverterEvdevImpl::FlushEvents(const input_event& input) {
|
||||||
@ -251,7 +251,7 @@ void EventConverterEvdevImpl::FlushEvents(const input_event& input) {
|
|||||||
|
|
||||||
dispatcher_->DispatchMouseMoveEvent(
|
dispatcher_->DispatchMouseMoveEvent(
|
||||||
MouseMoveEventParams(input_device_.id, EF_NONE, cursor_->GetLocation(),
|
MouseMoveEventParams(input_device_.id, EF_NONE, cursor_->GetLocation(),
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE),
|
PointerDetails(EventPointerType::kMouse),
|
||||||
TimeTicksFromInputEvent(input)));
|
TimeTicksFromInputEvent(input)));
|
||||||
|
|
||||||
x_offset_ = 0;
|
x_offset_ = 0;
|
||||||
|
@ -465,12 +465,12 @@ void EventFactoryEvdev::WarpCursorTo(gfx::AcceleratedWidget widget,
|
|||||||
|
|
||||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::BindOnce(&EventFactoryEvdev::DispatchMouseMoveEvent,
|
base::BindOnce(
|
||||||
weak_ptr_factory_.GetWeakPtr(),
|
&EventFactoryEvdev::DispatchMouseMoveEvent,
|
||||||
MouseMoveEventParams(
|
weak_ptr_factory_.GetWeakPtr(),
|
||||||
-1 /* device_id */, EF_NONE, cursor_->GetLocation(),
|
MouseMoveEventParams(
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE),
|
-1 /* device_id */, EF_NONE, cursor_->GetLocation(),
|
||||||
EventTimeForNow())));
|
PointerDetails(EventPointerType::kMouse), EventTimeForNow())));
|
||||||
}
|
}
|
||||||
|
|
||||||
int EventFactoryEvdev::NextDeviceId() {
|
int EventFactoryEvdev::NextDeviceId() {
|
||||||
|
@ -50,8 +50,8 @@ void InputInjectorEvdev::InjectMouseButton(EventFlags button, bool down) {
|
|||||||
|
|
||||||
dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
|
dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
|
||||||
kDeviceIdForInjection, EF_NONE, cursor_->GetLocation(), code, down,
|
kDeviceIdForInjection, EF_NONE, cursor_->GetLocation(), code, down,
|
||||||
false /* allow_remap */,
|
false /* allow_remap */, PointerDetails(EventPointerType::kMouse),
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), EventTimeForNow()));
|
EventTimeForNow()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputInjectorEvdev::InjectMouseWheel(int delta_x, int delta_y) {
|
void InputInjectorEvdev::InjectMouseWheel(int delta_x, int delta_y) {
|
||||||
@ -68,7 +68,7 @@ void InputInjectorEvdev::MoveCursorTo(const gfx::PointF& location) {
|
|||||||
|
|
||||||
dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams(
|
dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams(
|
||||||
kDeviceIdForInjection, EF_NONE, cursor_->GetLocation(),
|
kDeviceIdForInjection, EF_NONE, cursor_->GetLocation(),
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), EventTimeForNow()));
|
PointerDetails(EventPointerType::kMouse), EventTimeForNow()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputInjectorEvdev::InjectKeyEvent(DomCode physical_key,
|
void InputInjectorEvdev::InjectKeyEvent(DomCode physical_key,
|
||||||
|
@ -295,7 +295,7 @@ void GestureInterpreterLibevdevCros::OnGestureMove(const Gesture* gesture,
|
|||||||
// TODO(spang): Use move->ordinal_dx, move->ordinal_dy
|
// TODO(spang): Use move->ordinal_dx, move->ordinal_dy
|
||||||
dispatcher_->DispatchMouseMoveEvent(
|
dispatcher_->DispatchMouseMoveEvent(
|
||||||
MouseMoveEventParams(id_, EF_NONE, cursor_->GetLocation(),
|
MouseMoveEventParams(id_, EF_NONE, cursor_->GetLocation(),
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE),
|
PointerDetails(EventPointerType::kMouse),
|
||||||
StimeToTimeTicks(gesture->end_time)));
|
StimeToTimeTicks(gesture->end_time)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,8 +500,7 @@ void GestureInterpreterLibevdevCros::DispatchMouseButton(unsigned int button,
|
|||||||
bool allow_remap = is_mouse_;
|
bool allow_remap = is_mouse_;
|
||||||
dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
|
dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
|
||||||
id_, EF_NONE, cursor_->GetLocation(), button, down, allow_remap,
|
id_, EF_NONE, cursor_->GetLocation(), button, down, allow_remap,
|
||||||
PointerDetails(EventPointerType::POINTER_TYPE_MOUSE),
|
PointerDetails(EventPointerType::kMouse), StimeToTimeTicks(time)));
|
||||||
StimeToTimeTicks(time)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GestureInterpreterLibevdevCros::DispatchChangedKeys(
|
void GestureInterpreterLibevdevCros::DispatchChangedKeys(
|
||||||
|
@ -23,8 +23,8 @@ float ScaleTilt(int value, int min_value, int num_values) {
|
|||||||
|
|
||||||
EventPointerType GetToolType(int button_tool) {
|
EventPointerType GetToolType(int button_tool) {
|
||||||
if (button_tool == BTN_TOOL_RUBBER)
|
if (button_tool == BTN_TOOL_RUBBER)
|
||||||
return EventPointerType::POINTER_TYPE_ERASER;
|
return EventPointerType::kEraser;
|
||||||
return EventPointerType::POINTER_TYPE_PEN;
|
return EventPointerType::kPen;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -458,19 +458,16 @@ TEST_F(TabletEventConverterEvdevTest, Tap) {
|
|||||||
|
|
||||||
ui::MouseEvent* event = dispatched_event(0);
|
ui::MouseEvent* event = dispatched_event(0);
|
||||||
EXPECT_EQ(ui::ET_MOUSE_MOVED, event->type());
|
EXPECT_EQ(ui::ET_MOUSE_MOVED, event->type());
|
||||||
EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(ui::EventPointerType::kPen, event->pointer_details().pointer_type);
|
||||||
event->pointer_details().pointer_type);
|
|
||||||
EXPECT_FLOAT_EQ(5.625f, event->pointer_details().tilt_x);
|
EXPECT_FLOAT_EQ(5.625f, event->pointer_details().tilt_x);
|
||||||
EXPECT_FLOAT_EQ(0.f, event->pointer_details().tilt_y);
|
EXPECT_FLOAT_EQ(0.f, event->pointer_details().tilt_y);
|
||||||
event = dispatched_event(1);
|
event = dispatched_event(1);
|
||||||
EXPECT_EQ(ui::ET_MOUSE_PRESSED, event->type());
|
EXPECT_EQ(ui::ET_MOUSE_PRESSED, event->type());
|
||||||
EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(ui::EventPointerType::kPen, event->pointer_details().pointer_type);
|
||||||
event->pointer_details().pointer_type);
|
|
||||||
EXPECT_FLOAT_EQ((float)992 / 2047, event->pointer_details().force);
|
EXPECT_FLOAT_EQ((float)992 / 2047, event->pointer_details().force);
|
||||||
EXPECT_EQ(true, event->IsLeftMouseButton());
|
EXPECT_EQ(true, event->IsLeftMouseButton());
|
||||||
event = dispatched_event(2);
|
event = dispatched_event(2);
|
||||||
EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(ui::EventPointerType::kPen, event->pointer_details().pointer_type);
|
||||||
event->pointer_details().pointer_type);
|
|
||||||
EXPECT_EQ(ui::ET_MOUSE_RELEASED, event->type());
|
EXPECT_EQ(ui::ET_MOUSE_RELEASED, event->type());
|
||||||
EXPECT_FLOAT_EQ(0.0f, event->pointer_details().force);
|
EXPECT_FLOAT_EQ(0.0f, event->pointer_details().force);
|
||||||
EXPECT_EQ(true, event->IsLeftMouseButton());
|
EXPECT_EQ(true, event->IsLeftMouseButton());
|
||||||
|
@ -65,8 +65,7 @@ struct COMPONENT_EXPORT(EVDEV) InProgressTouchEvdev {
|
|||||||
int tool_code = 0;
|
int tool_code = 0;
|
||||||
float tilt_x = 0;
|
float tilt_x = 0;
|
||||||
float tilt_y = 0;
|
float tilt_y = 0;
|
||||||
ui::EventPointerType reported_tool_type =
|
ui::EventPointerType reported_tool_type = ui::EventPointerType::kTouch;
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH;
|
|
||||||
bool stylus_button = false;
|
bool stylus_button = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,11 +68,11 @@ int32_t AbsCodeToMtCode(int32_t code) {
|
|||||||
ui::EventPointerType GetEventPointerType(int tool_code) {
|
ui::EventPointerType GetEventPointerType(int tool_code) {
|
||||||
switch (tool_code) {
|
switch (tool_code) {
|
||||||
case BTN_TOOL_PEN:
|
case BTN_TOOL_PEN:
|
||||||
return ui::EventPointerType::POINTER_TYPE_PEN;
|
return ui::EventPointerType::kPen;
|
||||||
case BTN_TOOL_RUBBER:
|
case BTN_TOOL_RUBBER:
|
||||||
return ui::EventPointerType::POINTER_TYPE_ERASER;
|
return ui::EventPointerType::kEraser;
|
||||||
default:
|
default:
|
||||||
return ui::EventPointerType::POINTER_TYPE_TOUCH;
|
return ui::EventPointerType::kTouch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,8 +391,7 @@ TEST_F(TouchEventConverterEvdevTest, TouchMove) {
|
|||||||
EXPECT_EQ(295, event.location.x());
|
EXPECT_EQ(295, event.location.x());
|
||||||
EXPECT_EQ(421, event.location.y());
|
EXPECT_EQ(421, event.location.y());
|
||||||
EXPECT_EQ(0, event.slot);
|
EXPECT_EQ(0, event.slot);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
|
EXPECT_EQ(EventPointerType::kTouch, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
EXPECT_FLOAT_EQ(58.f, event.pointer_details.radius_x);
|
EXPECT_FLOAT_EQ(58.f, event.pointer_details.radius_x);
|
||||||
EXPECT_FLOAT_EQ(0.13333334f, event.pointer_details.force);
|
EXPECT_FLOAT_EQ(0.13333334f, event.pointer_details.force);
|
||||||
|
|
||||||
@ -407,8 +406,7 @@ TEST_F(TouchEventConverterEvdevTest, TouchMove) {
|
|||||||
EXPECT_EQ(312, event.location.x());
|
EXPECT_EQ(312, event.location.x());
|
||||||
EXPECT_EQ(432, event.location.y());
|
EXPECT_EQ(432, event.location.y());
|
||||||
EXPECT_EQ(0, event.slot);
|
EXPECT_EQ(0, event.slot);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
|
EXPECT_EQ(EventPointerType::kTouch, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
EXPECT_FLOAT_EQ(50.f, event.pointer_details.radius_x);
|
EXPECT_FLOAT_EQ(50.f, event.pointer_details.radius_x);
|
||||||
EXPECT_FLOAT_EQ(0.16862745f, event.pointer_details.force);
|
EXPECT_FLOAT_EQ(0.16862745f, event.pointer_details.force);
|
||||||
|
|
||||||
@ -423,8 +421,7 @@ TEST_F(TouchEventConverterEvdevTest, TouchMove) {
|
|||||||
EXPECT_EQ(312, event.location.x());
|
EXPECT_EQ(312, event.location.x());
|
||||||
EXPECT_EQ(432, event.location.y());
|
EXPECT_EQ(432, event.location.y());
|
||||||
EXPECT_EQ(0, event.slot);
|
EXPECT_EQ(0, event.slot);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
|
EXPECT_EQ(EventPointerType::kTouch, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
EXPECT_FLOAT_EQ(50.f, event.pointer_details.radius_x);
|
EXPECT_FLOAT_EQ(50.f, event.pointer_details.radius_x);
|
||||||
EXPECT_FLOAT_EQ(0.16862745f, event.pointer_details.force);
|
EXPECT_FLOAT_EQ(0.16862745f, event.pointer_details.force);
|
||||||
}
|
}
|
||||||
@ -1725,16 +1722,14 @@ TEST_F(TouchEventConverterEvdevTest, ActiveStylusTouchAndRelease) {
|
|||||||
EXPECT_EQ(ET_TOUCH_PRESSED, down_event.type);
|
EXPECT_EQ(ET_TOUCH_PRESSED, down_event.type);
|
||||||
EXPECT_EQ(9170, down_event.location.x());
|
EXPECT_EQ(9170, down_event.location.x());
|
||||||
EXPECT_EQ(3658, down_event.location.y());
|
EXPECT_EQ(3658, down_event.location.y());
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen, down_event.pointer_details.pointer_type);
|
||||||
down_event.pointer_details.pointer_type);
|
|
||||||
EXPECT_EQ(60.f / 1024, down_event.pointer_details.force);
|
EXPECT_EQ(60.f / 1024, down_event.pointer_details.force);
|
||||||
|
|
||||||
auto up_event = dispatched_touch_event(1);
|
auto up_event = dispatched_touch_event(1);
|
||||||
EXPECT_EQ(ET_TOUCH_RELEASED, up_event.type);
|
EXPECT_EQ(ET_TOUCH_RELEASED, up_event.type);
|
||||||
EXPECT_EQ(9173, up_event.location.x());
|
EXPECT_EQ(9173, up_event.location.x());
|
||||||
EXPECT_EQ(3906, up_event.location.y());
|
EXPECT_EQ(3906, up_event.location.y());
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen, up_event.pointer_details.pointer_type);
|
||||||
up_event.pointer_details.pointer_type);
|
|
||||||
EXPECT_EQ(0.f, up_event.pointer_details.force);
|
EXPECT_EQ(0.f, up_event.pointer_details.force);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1775,32 +1770,28 @@ TEST_F(TouchEventConverterEvdevTest, ActiveStylusMotion) {
|
|||||||
EXPECT_EQ(ET_TOUCH_PRESSED, event.type);
|
EXPECT_EQ(ET_TOUCH_PRESSED, event.type);
|
||||||
EXPECT_EQ(8921, event.location.x());
|
EXPECT_EQ(8921, event.location.x());
|
||||||
EXPECT_EQ(1072, event.location.y());
|
EXPECT_EQ(1072, event.location.y());
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
EXPECT_EQ(35.f / 1024, event.pointer_details.force);
|
EXPECT_EQ(35.f / 1024, event.pointer_details.force);
|
||||||
|
|
||||||
event = dispatched_touch_event(1);
|
event = dispatched_touch_event(1);
|
||||||
EXPECT_EQ(ET_TOUCH_MOVED, event.type);
|
EXPECT_EQ(ET_TOUCH_MOVED, event.type);
|
||||||
EXPECT_EQ(8934, event.location.x());
|
EXPECT_EQ(8934, event.location.x());
|
||||||
EXPECT_EQ(981, event.location.y());
|
EXPECT_EQ(981, event.location.y());
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
EXPECT_EQ(184.f / 1024, event.pointer_details.force);
|
EXPECT_EQ(184.f / 1024, event.pointer_details.force);
|
||||||
|
|
||||||
event = dispatched_touch_event(2);
|
event = dispatched_touch_event(2);
|
||||||
EXPECT_EQ(ET_TOUCH_MOVED, event.type);
|
EXPECT_EQ(ET_TOUCH_MOVED, event.type);
|
||||||
EXPECT_EQ(8930, event.location.x());
|
EXPECT_EQ(8930, event.location.x());
|
||||||
EXPECT_EQ(980, event.location.y());
|
EXPECT_EQ(980, event.location.y());
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
EXPECT_EQ(348.f / 1024, event.pointer_details.force);
|
EXPECT_EQ(348.f / 1024, event.pointer_details.force);
|
||||||
|
|
||||||
event = dispatched_touch_event(3);
|
event = dispatched_touch_event(3);
|
||||||
EXPECT_EQ(ET_TOUCH_RELEASED, event.type);
|
EXPECT_EQ(ET_TOUCH_RELEASED, event.type);
|
||||||
EXPECT_EQ(8930, event.location.x());
|
EXPECT_EQ(8930, event.location.x());
|
||||||
EXPECT_EQ(980, event.location.y());
|
EXPECT_EQ(980, event.location.y());
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
EXPECT_EQ(0.f / 1024, event.pointer_details.force);
|
EXPECT_EQ(0.f / 1024, event.pointer_details.force);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1834,23 +1825,19 @@ TEST_F(TouchEventConverterEvdevTest, ActiveStylusDrallionRubberSequence) {
|
|||||||
|
|
||||||
ui::TouchEventParams event = dispatched_touch_event(0);
|
ui::TouchEventParams event = dispatched_touch_event(0);
|
||||||
EXPECT_EQ(ET_TOUCH_PRESSED, event.type);
|
EXPECT_EQ(ET_TOUCH_PRESSED, event.type);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_ERASER,
|
EXPECT_EQ(EventPointerType::kEraser, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
|
|
||||||
event = dispatched_touch_event(1);
|
event = dispatched_touch_event(1);
|
||||||
EXPECT_EQ(ET_TOUCH_MOVED, event.type);
|
EXPECT_EQ(ET_TOUCH_MOVED, event.type);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_ERASER,
|
EXPECT_EQ(EventPointerType::kEraser, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
|
|
||||||
event = dispatched_touch_event(2);
|
event = dispatched_touch_event(2);
|
||||||
EXPECT_EQ(ET_TOUCH_MOVED, event.type);
|
EXPECT_EQ(ET_TOUCH_MOVED, event.type);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_ERASER,
|
EXPECT_EQ(EventPointerType::kEraser, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
|
|
||||||
event = dispatched_touch_event(3);
|
event = dispatched_touch_event(3);
|
||||||
EXPECT_EQ(ET_TOUCH_RELEASED, event.type);
|
EXPECT_EQ(ET_TOUCH_RELEASED, event.type);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_ERASER,
|
EXPECT_EQ(EventPointerType::kEraser, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TouchEventConverterEvdevTest, ActiveStylusBarrelButtonWhileHovering) {
|
TEST_F(TouchEventConverterEvdevTest, ActiveStylusBarrelButtonWhileHovering) {
|
||||||
@ -1892,14 +1879,12 @@ TEST_F(TouchEventConverterEvdevTest, ActiveStylusBarrelButtonWhileHovering) {
|
|||||||
auto down_event = dispatched_touch_event(0);
|
auto down_event = dispatched_touch_event(0);
|
||||||
EXPECT_EQ(ET_TOUCH_PRESSED, down_event.type);
|
EXPECT_EQ(ET_TOUCH_PRESSED, down_event.type);
|
||||||
EXPECT_TRUE(down_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
EXPECT_TRUE(down_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen, down_event.pointer_details.pointer_type);
|
||||||
down_event.pointer_details.pointer_type);
|
|
||||||
|
|
||||||
auto up_event = dispatched_touch_event(1);
|
auto up_event = dispatched_touch_event(1);
|
||||||
EXPECT_EQ(ET_TOUCH_RELEASED, up_event.type);
|
EXPECT_EQ(ET_TOUCH_RELEASED, up_event.type);
|
||||||
EXPECT_TRUE(down_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
EXPECT_TRUE(down_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen, up_event.pointer_details.pointer_type);
|
||||||
up_event.pointer_details.pointer_type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TouchEventConverterEvdevTest, ActiveStylusBarrelButton) {
|
TEST_F(TouchEventConverterEvdevTest, ActiveStylusBarrelButton) {
|
||||||
@ -1941,26 +1926,24 @@ TEST_F(TouchEventConverterEvdevTest, ActiveStylusBarrelButton) {
|
|||||||
auto down_event = dispatched_touch_event(0);
|
auto down_event = dispatched_touch_event(0);
|
||||||
EXPECT_EQ(ET_TOUCH_PRESSED, down_event.type);
|
EXPECT_EQ(ET_TOUCH_PRESSED, down_event.type);
|
||||||
EXPECT_FALSE(down_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
EXPECT_FALSE(down_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen, down_event.pointer_details.pointer_type);
|
||||||
down_event.pointer_details.pointer_type);
|
|
||||||
|
|
||||||
auto button_down_event = dispatched_touch_event(1);
|
auto button_down_event = dispatched_touch_event(1);
|
||||||
EXPECT_EQ(ET_TOUCH_MOVED, button_down_event.type);
|
EXPECT_EQ(ET_TOUCH_MOVED, button_down_event.type);
|
||||||
EXPECT_TRUE(button_down_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
EXPECT_TRUE(button_down_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen,
|
||||||
button_down_event.pointer_details.pointer_type);
|
button_down_event.pointer_details.pointer_type);
|
||||||
|
|
||||||
auto button_up_event = dispatched_touch_event(2);
|
auto button_up_event = dispatched_touch_event(2);
|
||||||
EXPECT_EQ(ET_TOUCH_MOVED, button_up_event.type);
|
EXPECT_EQ(ET_TOUCH_MOVED, button_up_event.type);
|
||||||
EXPECT_FALSE(button_up_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
EXPECT_FALSE(button_up_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen,
|
||||||
button_up_event.pointer_details.pointer_type);
|
button_up_event.pointer_details.pointer_type);
|
||||||
|
|
||||||
auto up_event = dispatched_touch_event(3);
|
auto up_event = dispatched_touch_event(3);
|
||||||
EXPECT_EQ(ET_TOUCH_RELEASED, up_event.type);
|
EXPECT_EQ(ET_TOUCH_RELEASED, up_event.type);
|
||||||
EXPECT_FALSE(down_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
EXPECT_FALSE(down_event.flags & ui::EventFlags::EF_LEFT_MOUSE_BUTTON);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN,
|
EXPECT_EQ(EventPointerType::kPen, up_event.pointer_details.pointer_type);
|
||||||
up_event.pointer_details.pointer_type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TouchEventConverterEvdevTest, HeldEventNotSent) {
|
TEST_F(TouchEventConverterEvdevTest, HeldEventNotSent) {
|
||||||
@ -2300,8 +2283,7 @@ TEST_F(TouchEventConverterEvdevTest, FingerSizeWithResolution) {
|
|||||||
EXPECT_EQ(0, event.slot);
|
EXPECT_EQ(0, event.slot);
|
||||||
EXPECT_FLOAT_EQ(217.0 / devinfo.GetAbsMaximum(ABS_MT_PRESSURE),
|
EXPECT_FLOAT_EQ(217.0 / devinfo.GetAbsMaximum(ABS_MT_PRESSURE),
|
||||||
event.pointer_details.force);
|
event.pointer_details.force);
|
||||||
EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH,
|
EXPECT_EQ(EventPointerType::kTouch, event.pointer_details.pointer_type);
|
||||||
event.pointer_details.pointer_type);
|
|
||||||
EXPECT_FLOAT_EQ(280.f, event.pointer_details.radius_x);
|
EXPECT_FLOAT_EQ(280.f, event.pointer_details.radius_x);
|
||||||
EXPECT_FLOAT_EQ(220.f, event.pointer_details.radius_y);
|
EXPECT_FLOAT_EQ(220.f, event.pointer_details.radius_y);
|
||||||
const ui::InProgressTouchEvdev& in_progress_event = dev->event(0);
|
const ui::InProgressTouchEvdev& in_progress_event = dev->event(0);
|
||||||
|
@ -39,9 +39,7 @@ PointerDetails::PointerDetails(EventPointerType pointer_type,
|
|||||||
twist(twist),
|
twist(twist),
|
||||||
id(pointer_id) {
|
id(pointer_id) {
|
||||||
if (pointer_id == kPointerIdUnknown) {
|
if (pointer_id == kPointerIdUnknown) {
|
||||||
id = (pointer_type == EventPointerType::POINTER_TYPE_MOUSE)
|
id = (pointer_type == EventPointerType::kMouse) ? kPointerIdMouse : 0;
|
||||||
? kPointerIdMouse
|
|
||||||
: 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ struct EVENTS_BASE_EXPORT PointerDetails {
|
|||||||
bool operator==(const PointerDetails& other) const;
|
bool operator==(const PointerDetails& other) const;
|
||||||
|
|
||||||
// The type of pointer device.
|
// The type of pointer device.
|
||||||
EventPointerType pointer_type = EventPointerType::POINTER_TYPE_UNKNOWN;
|
EventPointerType pointer_type = EventPointerType::kUnknown;
|
||||||
|
|
||||||
// Radius of the X (major) axis of the touch ellipse. 0.0 if unknown.
|
// Radius of the X (major) axis of the touch ellipse. 0.0 if unknown.
|
||||||
float radius_x = 0.0;
|
float radius_x = 0.0;
|
||||||
|
@ -69,7 +69,7 @@ class TestTouchEvent : public ui::TouchEvent {
|
|||||||
: TouchEvent(type,
|
: TouchEvent(type,
|
||||||
root_location,
|
root_location,
|
||||||
timestamp,
|
timestamp,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ touch_id,
|
/* pointer_id*/ touch_id,
|
||||||
/* radius_x */ 1.0f,
|
/* radius_x */ 1.0f,
|
||||||
/* radius_y */ 1.0f,
|
/* radius_y */ 1.0f,
|
||||||
@ -242,12 +242,11 @@ void EventGenerator::MoveMouseToCenterOf(EventTarget* window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EventGenerator::EnterPenPointerMode() {
|
void EventGenerator::EnterPenPointerMode() {
|
||||||
touch_pointer_details_.pointer_type = ui::EventPointerType::POINTER_TYPE_PEN;
|
touch_pointer_details_.pointer_type = ui::EventPointerType::kPen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventGenerator::ExitPenPointerMode() {
|
void EventGenerator::ExitPenPointerMode() {
|
||||||
touch_pointer_details_.pointer_type =
|
touch_pointer_details_.pointer_type = ui::EventPointerType::kTouch;
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventGenerator::SetTouchRadius(float x, float y) {
|
void EventGenerator::SetTouchRadius(float x, float y) {
|
||||||
@ -312,13 +311,13 @@ void EventGenerator::GestureTapAt(const gfx::Point& location) {
|
|||||||
const int kTouchId = 2;
|
const int kTouchId = 2;
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(
|
||||||
ui::ET_TOUCH_PRESSED, converted_location, ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, converted_location, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, kTouchId));
|
ui::PointerDetails(ui::EventPointerType::kTouch, kTouchId));
|
||||||
Dispatch(&press);
|
Dispatch(&press);
|
||||||
|
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(
|
||||||
ui::ET_TOUCH_RELEASED, converted_location,
|
ui::ET_TOUCH_RELEASED, converted_location,
|
||||||
press.time_stamp() + base::TimeDelta::FromMilliseconds(50),
|
press.time_stamp() + base::TimeDelta::FromMilliseconds(50),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, kTouchId));
|
ui::PointerDetails(ui::EventPointerType::kTouch, kTouchId));
|
||||||
Dispatch(&release);
|
Dispatch(&release);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,13 +329,13 @@ void EventGenerator::GestureTapDownAndUp(const gfx::Point& location) {
|
|||||||
const int kTouchId = 3;
|
const int kTouchId = 3;
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(
|
||||||
ui::ET_TOUCH_PRESSED, converted_location, ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, converted_location, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, kTouchId));
|
ui::PointerDetails(ui::EventPointerType::kTouch, kTouchId));
|
||||||
Dispatch(&press);
|
Dispatch(&press);
|
||||||
|
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(
|
||||||
ui::ET_TOUCH_RELEASED, converted_location,
|
ui::ET_TOUCH_RELEASED, converted_location,
|
||||||
press.time_stamp() + base::TimeDelta::FromMilliseconds(1000),
|
press.time_stamp() + base::TimeDelta::FromMilliseconds(1000),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, kTouchId));
|
ui::PointerDetails(ui::EventPointerType::kTouch, kTouchId));
|
||||||
Dispatch(&release);
|
Dispatch(&release);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,7 +367,7 @@ void EventGenerator::GestureScrollSequenceWithCallback(
|
|||||||
const int kTouchId = 5;
|
const int kTouchId = 5;
|
||||||
base::TimeTicks timestamp = ui::EventTimeForNow();
|
base::TimeTicks timestamp = ui::EventTimeForNow();
|
||||||
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, start, timestamp,
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, start, timestamp,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ kTouchId,
|
/* pointer_id*/ kTouchId,
|
||||||
/* radius_x */ 5.0f,
|
/* radius_x */ 5.0f,
|
||||||
/* radius_y */ 5.0f,
|
/* radius_y */ 5.0f,
|
||||||
@ -384,7 +383,7 @@ void EventGenerator::GestureScrollSequenceWithCallback(
|
|||||||
location.Offset(dx, dy);
|
location.Offset(dx, dy);
|
||||||
timestamp += step_delay;
|
timestamp += step_delay;
|
||||||
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(), timestamp,
|
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(), timestamp,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
/* pointer_id*/ kTouchId,
|
/* pointer_id*/ kTouchId,
|
||||||
/* radius_x */ 5.0f,
|
/* radius_x */ 5.0f,
|
||||||
/* radius_y */ 5.0f,
|
/* radius_y */ 5.0f,
|
||||||
@ -395,13 +394,12 @@ void EventGenerator::GestureScrollSequenceWithCallback(
|
|||||||
callback.Run(ui::ET_GESTURE_SCROLL_UPDATE, gfx::Vector2dF(dx, dy));
|
callback.Run(ui::ET_GESTURE_SCROLL_UPDATE, gfx::Vector2dF(dx, dy));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, end, timestamp,
|
||||||
ui::ET_TOUCH_RELEASED, end, timestamp,
|
PointerDetails(ui::EventPointerType::kTouch,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
/* pointer_id*/ kTouchId,
|
||||||
/* pointer_id*/ kTouchId,
|
/* radius_x */ 5.0f,
|
||||||
/* radius_x */ 5.0f,
|
/* radius_y */ 5.0f,
|
||||||
/* radius_y */ 5.0f,
|
/* force */ 1.0f));
|
||||||
/* force */ 1.0f));
|
|
||||||
Dispatch(&release);
|
Dispatch(&release);
|
||||||
|
|
||||||
callback.Run(ui::ET_GESTURE_SCROLL_END, gfx::Vector2dF());
|
callback.Run(ui::ET_GESTURE_SCROLL_END, gfx::Vector2dF());
|
||||||
@ -449,7 +447,7 @@ void EventGenerator::GestureMultiFingerScrollWithDelays(
|
|||||||
if (!pressed[i] && move_time >= press_time[i]) {
|
if (!pressed[i] && move_time >= press_time[i]) {
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(
|
||||||
ui::ET_TOUCH_PRESSED, points[i], press_time[i],
|
ui::ET_TOUCH_PRESSED, points[i], press_time[i],
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, i));
|
ui::PointerDetails(ui::EventPointerType::kTouch, i));
|
||||||
Dispatch(&press);
|
Dispatch(&press);
|
||||||
pressed[i] = true;
|
pressed[i] = true;
|
||||||
}
|
}
|
||||||
@ -461,7 +459,7 @@ void EventGenerator::GestureMultiFingerScrollWithDelays(
|
|||||||
if (pressed[i] && move_time >= release_time[i]) {
|
if (pressed[i] && move_time >= release_time[i]) {
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(
|
||||||
ui::ET_TOUCH_RELEASED, points[i], release_time[i],
|
ui::ET_TOUCH_RELEASED, points[i], release_time[i],
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, i));
|
ui::PointerDetails(ui::EventPointerType::kTouch, i));
|
||||||
Dispatch(&release);
|
Dispatch(&release);
|
||||||
pressed[i] = false;
|
pressed[i] = false;
|
||||||
}
|
}
|
||||||
@ -472,7 +470,7 @@ void EventGenerator::GestureMultiFingerScrollWithDelays(
|
|||||||
if (pressed[i]) {
|
if (pressed[i]) {
|
||||||
ui::TouchEvent move(
|
ui::TouchEvent move(
|
||||||
ui::ET_TOUCH_MOVED, points[i], move_time,
|
ui::ET_TOUCH_MOVED, points[i], move_time,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, i));
|
ui::PointerDetails(ui::EventPointerType::kTouch, i));
|
||||||
Dispatch(&move);
|
Dispatch(&move);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -486,7 +484,7 @@ void EventGenerator::GestureMultiFingerScrollWithDelays(
|
|||||||
if (pressed[i]) {
|
if (pressed[i]) {
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(
|
||||||
ui::ET_TOUCH_RELEASED, points[i], default_release_time,
|
ui::ET_TOUCH_RELEASED, points[i], default_release_time,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, i));
|
ui::PointerDetails(ui::EventPointerType::kTouch, i));
|
||||||
Dispatch(&release);
|
Dispatch(&release);
|
||||||
pressed[i] = false;
|
pressed[i] = false;
|
||||||
}
|
}
|
||||||
@ -622,12 +620,11 @@ void EventGenerator::Init(gfx::NativeWindow root_window,
|
|||||||
else if (root_window)
|
else if (root_window)
|
||||||
delegate()->ConvertPointFromWindow(root_window, ¤t_screen_location_);
|
delegate()->ConvertPointFromWindow(root_window, ¤t_screen_location_);
|
||||||
current_target_ = delegate()->GetTargetAt(current_screen_location_);
|
current_target_ = delegate()->GetTargetAt(current_screen_location_);
|
||||||
touch_pointer_details_ =
|
touch_pointer_details_ = PointerDetails(ui::EventPointerType::kTouch,
|
||||||
PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
/* pointer_id*/ 0,
|
||||||
/* pointer_id*/ 0,
|
/* radius_x */ 1.0f,
|
||||||
/* radius_x */ 1.0f,
|
/* radius_y */ 1.0f,
|
||||||
/* radius_y */ 1.0f,
|
/* force */ 0.0f);
|
||||||
/* force */ 0.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventGenerator::DispatchKeyEvent(bool is_press,
|
void EventGenerator::DispatchKeyEvent(bool is_press,
|
||||||
|
@ -249,7 +249,7 @@ class EventGenerator {
|
|||||||
void MoveMouseToCenterOf(EventTarget* window);
|
void MoveMouseToCenterOf(EventTarget* window);
|
||||||
|
|
||||||
// Enter pen-pointer mode, which will cause any generated mouse events to have
|
// Enter pen-pointer mode, which will cause any generated mouse events to have
|
||||||
// a pointer type ui::EventPointerType::POINTER_TYPE_PEN.
|
// a pointer type ui::EventPointerType::kPen.
|
||||||
void EnterPenPointerMode();
|
void EnterPenPointerMode();
|
||||||
|
|
||||||
// Exit pen-pointer mode. Generated mouse events will use the default pointer
|
// Exit pen-pointer mode. Generated mouse events will use the default pointer
|
||||||
|
@ -60,7 +60,7 @@ void ReleaseCopiedNativeEvent(const MSG& event) {}
|
|||||||
|
|
||||||
PointerDetails GetTouchPointerDetailsFromNative(const MSG& native_event) {
|
PointerDetails GetTouchPointerDetailsFromNative(const MSG& native_event) {
|
||||||
NOTIMPLEMENTED();
|
NOTIMPLEMENTED();
|
||||||
return PointerDetails(EventPointerType::POINTER_TYPE_TOUCH,
|
return PointerDetails(EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 1.0,
|
/* radius_x */ 1.0,
|
||||||
/* radius_y */ 1.0,
|
/* radius_y */ 1.0,
|
||||||
|
@ -322,9 +322,9 @@ PointerDetails GetMousePointerDetailsFromMSG(const MSG& native_event) {
|
|||||||
// We should filter out all the mouse events Synthesized from touch events.
|
// We should filter out all the mouse events Synthesized from touch events.
|
||||||
// TODO(lanwei): Will set the pointer ID, see https://crbug.com/616771.
|
// TODO(lanwei): Will set the pointer ID, see https://crbug.com/616771.
|
||||||
if ((GetMessageExtraInfo() & SIGNATURE_MASK) != MOUSEEVENTF_FROMTOUCHPEN)
|
if ((GetMessageExtraInfo() & SIGNATURE_MASK) != MOUSEEVENTF_FROMTOUCHPEN)
|
||||||
return PointerDetails(EventPointerType::POINTER_TYPE_MOUSE);
|
return PointerDetails(EventPointerType::kMouse);
|
||||||
|
|
||||||
return PointerDetails(EventPointerType::POINTER_TYPE_PEN);
|
return PointerDetails(EventPointerType::kPen);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Vector2d GetMouseWheelOffsetFromMSG(const MSG& native_event) {
|
gfx::Vector2d GetMouseWheelOffsetFromMSG(const MSG& native_event) {
|
||||||
@ -352,7 +352,7 @@ int GetTouchIdFromMSG(const MSG& xev) {
|
|||||||
|
|
||||||
PointerDetails GetTouchPointerDetailsFromMSG(const MSG& native_event) {
|
PointerDetails GetTouchPointerDetailsFromMSG(const MSG& native_event) {
|
||||||
NOTIMPLEMENTED();
|
NOTIMPLEMENTED();
|
||||||
return PointerDetails(EventPointerType::POINTER_TYPE_TOUCH,
|
return PointerDetails(EventPointerType::kTouch,
|
||||||
/* pointer_id*/ 0,
|
/* pointer_id*/ 0,
|
||||||
/* radius_x */ 1.0,
|
/* radius_x */ 1.0,
|
||||||
/* radius_y */ 1.0,
|
/* radius_y */ 1.0,
|
||||||
|
@ -739,7 +739,7 @@ EventPointerType GetTouchPointerTypeFromXEvent(const XEvent& xev) {
|
|||||||
|
|
||||||
PointerDetails GetTouchPointerDetailsFromXEvent(const XEvent& xev) {
|
PointerDetails GetTouchPointerDetailsFromXEvent(const XEvent& xev) {
|
||||||
return PointerDetails(
|
return PointerDetails(
|
||||||
EventPointerType::POINTER_TYPE_TOUCH, GetTouchIdFromXEvent(xev),
|
EventPointerType::kTouch, GetTouchIdFromXEvent(xev),
|
||||||
GetTouchRadiusXFromXEvent(xev), GetTouchRadiusYFromXEvent(xev),
|
GetTouchRadiusXFromXEvent(xev), GetTouchRadiusYFromXEvent(xev),
|
||||||
GetTouchForceFromXEvent(xev), GetTouchAngleFromXEvent(xev));
|
GetTouchForceFromXEvent(xev), GetTouchAngleFromXEvent(xev));
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ std::unique_ptr<MouseEvent> CreateMouseEvent(EventType type,
|
|||||||
if (enter_or_leave && xev.xcrossing.detail == NotifyInferior)
|
if (enter_or_leave && xev.xcrossing.detail == NotifyInferior)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
PointerDetails details{EventPointerType::POINTER_TYPE_MOUSE};
|
PointerDetails details{EventPointerType::kMouse};
|
||||||
auto event = std::make_unique<MouseEvent>(
|
auto event = std::make_unique<MouseEvent>(
|
||||||
type, EventLocationFromXEvent(xev), EventSystemLocationFromXEvent(xev),
|
type, EventLocationFromXEvent(xev), EventSystemLocationFromXEvent(xev),
|
||||||
EventTimeFromXEvent(xev), EventFlagsFromXEvent(xev),
|
EventTimeFromXEvent(xev), EventFlagsFromXEvent(xev),
|
||||||
|
@ -96,7 +96,7 @@ void WaylandTouch::Down(void* data,
|
|||||||
gfx::Point location(wl_fixed_to_double(x), wl_fixed_to_double(y));
|
gfx::Point location(wl_fixed_to_double(x), wl_fixed_to_double(y));
|
||||||
base::TimeTicks time_stamp =
|
base::TimeTicks time_stamp =
|
||||||
base::TimeTicks() + base::TimeDelta::FromMilliseconds(time);
|
base::TimeTicks() + base::TimeDelta::FromMilliseconds(time);
|
||||||
PointerDetails pointer_details(EventPointerType::POINTER_TYPE_TOUCH, id);
|
PointerDetails pointer_details(EventPointerType::kTouch, id);
|
||||||
TouchEvent event(type, location, time_stamp, pointer_details);
|
TouchEvent event(type, location, time_stamp, pointer_details);
|
||||||
touch->callback_.Run(&event);
|
touch->callback_.Run(&event);
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ void WaylandTouch::Up(void* data,
|
|||||||
EventType type = ET_TOUCH_RELEASED;
|
EventType type = ET_TOUCH_RELEASED;
|
||||||
base::TimeTicks time_stamp =
|
base::TimeTicks time_stamp =
|
||||||
base::TimeTicks() + base::TimeDelta::FromMilliseconds(time);
|
base::TimeTicks() + base::TimeDelta::FromMilliseconds(time);
|
||||||
PointerDetails pointer_details(EventPointerType::POINTER_TYPE_TOUCH, id);
|
PointerDetails pointer_details(EventPointerType::kTouch, id);
|
||||||
TouchEvent event(type, touch->current_points_[id].last_known_location,
|
TouchEvent event(type, touch->current_points_[id].last_known_location,
|
||||||
time_stamp, pointer_details);
|
time_stamp, pointer_details);
|
||||||
touch->callback_.Run(&event);
|
touch->callback_.Run(&event);
|
||||||
@ -150,7 +150,7 @@ void WaylandTouch::Motion(void* data,
|
|||||||
gfx::Point location(wl_fixed_to_double(x), wl_fixed_to_double(y));
|
gfx::Point location(wl_fixed_to_double(x), wl_fixed_to_double(y));
|
||||||
base::TimeTicks time_stamp =
|
base::TimeTicks time_stamp =
|
||||||
base::TimeTicks() + base::TimeDelta::FromMilliseconds(time);
|
base::TimeTicks() + base::TimeDelta::FromMilliseconds(time);
|
||||||
PointerDetails pointer_details(EventPointerType::POINTER_TYPE_TOUCH, id);
|
PointerDetails pointer_details(EventPointerType::kTouch, id);
|
||||||
TouchEvent event(type, location, time_stamp, pointer_details);
|
TouchEvent event(type, location, time_stamp, pointer_details);
|
||||||
touch->callback_.Run(&event);
|
touch->callback_.Run(&event);
|
||||||
touch->current_points_[id].last_known_location = location;
|
touch->current_points_[id].last_known_location = location;
|
||||||
@ -166,7 +166,7 @@ void WaylandTouch::Cancel(void* data, wl_touch* obj) {
|
|||||||
|
|
||||||
EventType type = ET_TOUCH_CANCELLED;
|
EventType type = ET_TOUCH_CANCELLED;
|
||||||
base::TimeTicks time_stamp = base::TimeTicks::Now();
|
base::TimeTicks time_stamp = base::TimeTicks::Now();
|
||||||
PointerDetails pointer_details(EventPointerType::POINTER_TYPE_TOUCH, id);
|
PointerDetails pointer_details(EventPointerType::kTouch, id);
|
||||||
TouchEvent event(type, gfx::Point(), time_stamp, pointer_details);
|
TouchEvent event(type, gfx::Point(), time_stamp, pointer_details);
|
||||||
touch->callback_.Run(&event);
|
touch->callback_.Run(&event);
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ TEST_F(InkDropHostViewTest, NoInkDropOnTouchOrGestureEvents) {
|
|||||||
|
|
||||||
ui::TouchEvent touch_event(
|
ui::TouchEvent touch_event(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(5, 6), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(5, 6), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
|
|
||||||
test_api_.AnimateInkDrop(InkDropState::ACTION_PENDING, &touch_event);
|
test_api_.AnimateInkDrop(InkDropState::ACTION_PENDING, &touch_event);
|
||||||
EXPECT_EQ(test_api_.GetInkDrop()->GetTargetInkDropState(),
|
EXPECT_EQ(test_api_.GetInkDrop()->GetTargetInkDropState(),
|
||||||
@ -268,7 +268,7 @@ TEST_F(InkDropHostViewTest, DismissInkDropOnTouchOrGestureEvents) {
|
|||||||
|
|
||||||
ui::TouchEvent touch_event(
|
ui::TouchEvent touch_event(
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(5, 6), ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, gfx::Point(5, 6), ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
|
|
||||||
test_api_.AnimateInkDrop(InkDropState::ACTION_TRIGGERED, &touch_event);
|
test_api_.AnimateInkDrop(InkDropState::ACTION_TRIGGERED, &touch_event);
|
||||||
EXPECT_EQ(test_api_.GetInkDrop()->GetTargetInkDropState(),
|
EXPECT_EQ(test_api_.GetInkDrop()->GetTargetInkDropState(),
|
||||||
|
@ -1518,7 +1518,7 @@ TEST_F(MenuControllerTest, NoTouchCloseWhenSendingGesturesToOwner) {
|
|||||||
location.Offset(1, 1);
|
location.Offset(1, 1);
|
||||||
ui::TouchEvent touch_event(
|
ui::TouchEvent touch_event(
|
||||||
ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(),
|
ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
controller->OnTouchEvent(sub_menu, &touch_event);
|
controller->OnTouchEvent(sub_menu, &touch_event);
|
||||||
|
|
||||||
// Menu should still be visible.
|
// Menu should still be visible.
|
||||||
@ -1592,9 +1592,8 @@ TEST_F(MenuControllerTest, AsynchronousTouchEventRepostEvent) {
|
|||||||
sub_menu->ShowAt(owner(), item->bounds(), false);
|
sub_menu->ShowAt(owner(), item->bounds(), false);
|
||||||
gfx::Point location(sub_menu->bounds().bottom_right());
|
gfx::Point location(sub_menu->bounds().bottom_right());
|
||||||
location.Offset(1, 1);
|
location.Offset(1, 1);
|
||||||
ui::TouchEvent event(
|
ui::TouchEvent event(ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(),
|
||||||
ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(),
|
ui::PointerDetails(ui::EventPointerType::kTouch, 0));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0));
|
|
||||||
controller->OnTouchEvent(sub_menu, &event);
|
controller->OnTouchEvent(sub_menu, &event);
|
||||||
views::test::WaitForMenuClosureAnimation();
|
views::test::WaitForMenuClosureAnimation();
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ bool Textfield::OnMousePressed(const ui::MouseEvent& event) {
|
|||||||
if (!handled &&
|
if (!handled &&
|
||||||
(event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton())) {
|
(event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton())) {
|
||||||
if (!had_focus)
|
if (!had_focus)
|
||||||
RequestFocusWithPointer(ui::EventPointerType::POINTER_TYPE_MOUSE);
|
RequestFocusWithPointer(ui::EventPointerType::kMouse);
|
||||||
#if !defined(OS_WIN)
|
#if !defined(OS_WIN)
|
||||||
ShowVirtualKeyboardIfEnabled();
|
ShowVirtualKeyboardIfEnabled();
|
||||||
#endif
|
#endif
|
||||||
@ -712,7 +712,7 @@ bool Textfield::OnMousePressed(const ui::MouseEvent& event) {
|
|||||||
|
|
||||||
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
||||||
if (!handled && !had_focus && event.IsOnlyMiddleMouseButton())
|
if (!handled && !had_focus && event.IsOnlyMiddleMouseButton())
|
||||||
RequestFocusWithPointer(ui::EventPointerType::POINTER_TYPE_MOUSE);
|
RequestFocusWithPointer(ui::EventPointerType::kMouse);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return selection_controller_.OnMousePressed(
|
return selection_controller_.OnMousePressed(
|
||||||
@ -2077,13 +2077,13 @@ void Textfield::RequestFocusWithPointer(ui::EventPointerType pointer_type) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
switch (pointer_type) {
|
switch (pointer_type) {
|
||||||
case ui::EventPointerType::POINTER_TYPE_MOUSE:
|
case ui::EventPointerType::kMouse:
|
||||||
focus_reason_ = ui::TextInputClient::FOCUS_REASON_MOUSE;
|
focus_reason_ = ui::TextInputClient::FOCUS_REASON_MOUSE;
|
||||||
break;
|
break;
|
||||||
case ui::EventPointerType::POINTER_TYPE_PEN:
|
case ui::EventPointerType::kPen:
|
||||||
focus_reason_ = ui::TextInputClient::FOCUS_REASON_PEN;
|
focus_reason_ = ui::TextInputClient::FOCUS_REASON_PEN;
|
||||||
break;
|
break;
|
||||||
case ui::EventPointerType::POINTER_TYPE_TOUCH:
|
case ui::EventPointerType::kTouch:
|
||||||
focus_reason_ = ui::TextInputClient::FOCUS_REASON_TOUCH;
|
focus_reason_ = ui::TextInputClient::FOCUS_REASON_TOUCH;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2098,9 +2098,8 @@ void Textfield::RequestFocusForGesture(const ui::GestureEventDetails& details) {
|
|||||||
bool show_virtual_keyboard = true;
|
bool show_virtual_keyboard = true;
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
show_virtual_keyboard =
|
show_virtual_keyboard =
|
||||||
details.primary_pointer_type() ==
|
details.primary_pointer_type() == ui::EventPointerType::kTouch ||
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH ||
|
details.primary_pointer_type() == ui::EventPointerType::kPen;
|
||||||
details.primary_pointer_type() == ui::EventPointerType::POINTER_TYPE_PEN;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RequestFocusWithPointer(details.primary_pointer_type());
|
RequestFocusWithPointer(details.primary_pointer_type());
|
||||||
|
@ -3742,8 +3742,7 @@ TEST_F(TextfieldTest, FocusReasonTouchTap) {
|
|||||||
textfield_->GetFocusReason());
|
textfield_->GetFocusReason());
|
||||||
|
|
||||||
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
||||||
tap_details.set_primary_pointer_type(
|
tap_details.set_primary_pointer_type(ui::EventPointerType::kTouch);
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH);
|
|
||||||
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
||||||
textfield_->OnGestureEvent(&tap);
|
textfield_->OnGestureEvent(&tap);
|
||||||
|
|
||||||
@ -3758,7 +3757,7 @@ TEST_F(TextfieldTest, FocusReasonPenTap) {
|
|||||||
textfield_->GetFocusReason());
|
textfield_->GetFocusReason());
|
||||||
|
|
||||||
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
||||||
tap_details.set_primary_pointer_type(ui::EventPointerType::POINTER_TYPE_PEN);
|
tap_details.set_primary_pointer_type(ui::EventPointerType::kPen);
|
||||||
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
||||||
textfield_->OnGestureEvent(&tap);
|
textfield_->OnGestureEvent(&tap);
|
||||||
|
|
||||||
@ -3775,16 +3774,14 @@ TEST_F(TextfieldTest, FocusReasonMultipleEvents) {
|
|||||||
// Pen tap, followed by a touch tap
|
// Pen tap, followed by a touch tap
|
||||||
{
|
{
|
||||||
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
||||||
tap_details.set_primary_pointer_type(
|
tap_details.set_primary_pointer_type(ui::EventPointerType::kPen);
|
||||||
ui::EventPointerType::POINTER_TYPE_PEN);
|
|
||||||
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
||||||
textfield_->OnGestureEvent(&tap);
|
textfield_->OnGestureEvent(&tap);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
||||||
tap_details.set_primary_pointer_type(
|
tap_details.set_primary_pointer_type(ui::EventPointerType::kTouch);
|
||||||
ui::EventPointerType::POINTER_TYPE_TOUCH);
|
|
||||||
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
||||||
textfield_->OnGestureEvent(&tap);
|
textfield_->OnGestureEvent(&tap);
|
||||||
}
|
}
|
||||||
@ -3801,7 +3798,7 @@ TEST_F(TextfieldTest, FocusReasonFocusBlurFocus) {
|
|||||||
|
|
||||||
// Pen tap, blur, then programmatic focus.
|
// Pen tap, blur, then programmatic focus.
|
||||||
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
||||||
tap_details.set_primary_pointer_type(ui::EventPointerType::POINTER_TYPE_PEN);
|
tap_details.set_primary_pointer_type(ui::EventPointerType::kPen);
|
||||||
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
||||||
textfield_->OnGestureEvent(&tap);
|
textfield_->OnGestureEvent(&tap);
|
||||||
|
|
||||||
@ -3817,7 +3814,7 @@ TEST_F(TextfieldTest, KeyboardObserverForPenInput) {
|
|||||||
InitTextfield();
|
InitTextfield();
|
||||||
|
|
||||||
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP_DOWN);
|
||||||
tap_details.set_primary_pointer_type(ui::EventPointerType::POINTER_TYPE_PEN);
|
tap_details.set_primary_pointer_type(ui::EventPointerType::kPen);
|
||||||
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
GestureEventForTest tap(GetCursorPositionX(0), 0, tap_details);
|
||||||
textfield_->OnGestureEvent(&tap);
|
textfield_->OnGestureEvent(&tap);
|
||||||
|
|
||||||
|
@ -643,7 +643,7 @@ void TouchSelectionControllerImpl::OnEvent(const ui::Event& event) {
|
|||||||
// from touch as this can clear an active selection generated by the pen.
|
// from touch as this can clear an active selection generated by the pen.
|
||||||
if ((event.flags() & (ui::EF_IS_SYNTHESIZED | ui::EF_FROM_TOUCH)) ||
|
if ((event.flags() & (ui::EF_IS_SYNTHESIZED | ui::EF_FROM_TOUCH)) ||
|
||||||
event.AsMouseEvent()->pointer_details().pointer_type ==
|
event.AsMouseEvent()->pointer_details().pointer_type ==
|
||||||
ui::EventPointerType::POINTER_TYPE_PEN) {
|
ui::EventPointerType::kPen) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -413,9 +413,9 @@ TEST_F(NativeWidgetAuraTest, DontCaptureOnGesture) {
|
|||||||
widget->SetContentsView(view);
|
widget->SetContentsView(view);
|
||||||
widget->Show();
|
widget->Show();
|
||||||
|
|
||||||
ui::TouchEvent press(
|
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(41, 51),
|
||||||
ui::ET_TOUCH_PRESSED, gfx::Point(41, 51), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&press);
|
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&press);
|
||||||
ASSERT_FALSE(details.dispatcher_destroyed);
|
ASSERT_FALSE(details.dispatcher_destroyed);
|
||||||
// Both views should get the press.
|
// Both views should get the press.
|
||||||
@ -428,9 +428,9 @@ TEST_F(NativeWidgetAuraTest, DontCaptureOnGesture) {
|
|||||||
|
|
||||||
// Release touch. Only |view| should get the release since that it consumed
|
// Release touch. Only |view| should get the release since that it consumed
|
||||||
// the press.
|
// the press.
|
||||||
ui::TouchEvent release(
|
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(250, 251),
|
||||||
ui::ET_TOUCH_RELEASED, gfx::Point(250, 251), ui::EventTimeForNow(),
|
ui::EventTimeForNow(),
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
|
ui::PointerDetails(ui::EventPointerType::kTouch, 1));
|
||||||
details = event_sink()->OnEventFromSource(&release);
|
details = event_sink()->OnEventFromSource(&release);
|
||||||
ASSERT_FALSE(details.dispatcher_destroyed);
|
ASSERT_FALSE(details.dispatcher_destroyed);
|
||||||
EXPECT_TRUE(view->got_gesture_event());
|
EXPECT_TRUE(view->got_gesture_event());
|
||||||
|
@ -3121,9 +3121,8 @@ LRESULT HWNDMessageHandler::HandlePointerEventTypeTouch(UINT message,
|
|||||||
|
|
||||||
ui::TouchEvent event(
|
ui::TouchEvent event(
|
||||||
event_type, touch_point, event_time,
|
event_type, touch_point, event_time,
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
ui::PointerDetails(ui::EventPointerType::kTouch, mapped_pointer_id,
|
||||||
mapped_pointer_id, radius_x, radius_y, pressure,
|
radius_x, radius_y, pressure, rotation_angle),
|
||||||
rotation_angle),
|
|
||||||
ui::GetModifiersFromKeyState());
|
ui::GetModifiersFromKeyState());
|
||||||
|
|
||||||
event.latency()->AddLatencyNumberWithTimestamp(
|
event.latency()->AddLatencyNumberWithTimestamp(
|
||||||
@ -3277,9 +3276,8 @@ void HWNDMessageHandler::GenerateTouchEvent(ui::EventType event_type,
|
|||||||
size_t id,
|
size_t id,
|
||||||
base::TimeTicks time_stamp,
|
base::TimeTicks time_stamp,
|
||||||
TouchEvents* touch_events) {
|
TouchEvents* touch_events) {
|
||||||
ui::TouchEvent event(
|
ui::TouchEvent event(event_type, point, time_stamp,
|
||||||
event_type, point, time_stamp,
|
ui::PointerDetails(ui::EventPointerType::kTouch, id));
|
||||||
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, id));
|
|
||||||
|
|
||||||
event.set_flags(ui::GetModifiersFromKeyState());
|
event.set_flags(ui::GetModifiersFromKeyState());
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user