chromium/components/input/touchpad_pinch_event_queue_unittest.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/input/touchpad_pinch_event_queue.h"

#include <string>

#include "base/functional/bind.h"
#include "components/input/event_with_latency_info.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/latency/latency_info.h"

namespace input {

class MockTouchpadPinchEventQueueClient {};

class TouchpadPinchEventQueueTest : public testing::TestWithParam<bool>,
                                    public TouchpadPinchEventQueueClient {};

MATCHER_P(EventHasType,
          type,
          std::string(negation ? "does not have" : "has") + " type " +
              ::testing::PrintToString(type)) {}

MATCHER_P(EventHasPhase,
          phase,
          std::string(negation ? "does not have" : "has") + " phase " +
              ::testing::PrintToString(phase)) {}

MATCHER_P(EventHasScale,
          expected_scale,
          std::string(negation ? "does not have" : "has") + " scale " +
              ::testing::PrintToString(expected_scale)) {}

MATCHER(EventHasCtrlModifier,
        std::string(negation ? "does not have" : "has") + " control modifier") {}

MATCHER(EventIsBlocking,
        std::string(negation ? "is not" : "is") + " blocking") {}

// Ensure that when the queue receives a touchpad pinch sequence, it sends a
// synthetic mouse wheel event and acks the pinch events back to the client.
TEST_F(TouchpadPinchEventQueueTest, Basic) {}

// Ensure the queue sends the wheel events with phase information.
TEST_F(TouchpadPinchEventQueueTest, MouseWheelPhase) {}

// Ensure that if the renderer consumes the synthetic wheel event, the ack of
// the GesturePinchUpdate reflects this.
TEST_F(TouchpadPinchEventQueueTest, Consumed) {}

// Ensure that the queue sends wheel events for updates with |zoom_disabled| as
// well.
TEST_F(TouchpadPinchEventQueueTest, ZoomDisabled) {}

TEST_F(TouchpadPinchEventQueueTest, MultipleSequences) {}

// Ensure we can queue additional pinch event sequences while the queue is
// waiting for a wheel event ack.
TEST_F(TouchpadPinchEventQueueTest, MultipleQueuedSequences) {}

// Ensure the queue handles pinch event sequences with multiple updates.
TEST_F(TouchpadPinchEventQueueTest, MultipleUpdatesInSequence) {}

// Ensure the queue coalesces pinch update events.
TEST_F(TouchpadPinchEventQueueTest, MultipleUpdatesCoalesced) {}

// Ensure the queue handles pinch event sequences with multiple canceled
// updates.
TEST_F(TouchpadPinchEventQueueTest, MultipleCanceledUpdatesInSequence) {}

// Ensure that when the queue receives a touchpad double tap, it sends a
// synthetic mouse wheel event and acks the double tap back to the client.
TEST_F(TouchpadPinchEventQueueTest, DoubleTap) {}

// Ensure that ACKs are only processed when they match the event that is
// currently awaiting an ACK.
TEST_F(TouchpadPinchEventQueueTest, IgnoreNonMatchingEvents) {}

}  // namespace input