chromium/cc/input/single_scrollbar_animation_controller_thinning_unittest.cc

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

#include "cc/input/single_scrollbar_animation_controller_thinning.h"

#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "cc/layers/solid_color_scrollbar_layer_impl.h"
#include "cc/test/layer_tree_impl_test_base.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/test/geometry_util.h"

_;
Bool;
Mock;
NiceMock;

namespace cc {
namespace {

// Redefinition from ui/native_theme/overlay_scrollbar_constants_aura.h
const float kIdleThicknessScale =;

class MockSingleScrollbarAnimationControllerClient
    : public ScrollbarAnimationControllerClient {};

class SingleScrollbarAnimationControllerThinningTest
    : public LayerTreeImplTestBase,
      public testing::Test,
      public testing::WithParamInterface<bool> {};

// Return a point with given offset from the top-left of scrollbar.
gfx::PointF NearScrollbar(float offset_x, float offset_y) {}

class SingleScrollbarAnimationControllerThinningAuraTest
    : public SingleScrollbarAnimationControllerThinningTest {};

class SingleScrollbarAnimationControllerThinningFluentTest
    : public SingleScrollbarAnimationControllerThinningTest {};

// Check initialization of scrollbar. Should start thin.
TEST_P(SingleScrollbarAnimationControllerThinningTest, Idle) {}

// Move the pointer near the scrollbar. Confirm it gets thick and narrow when
// moved away.
TEST_P(SingleScrollbarAnimationControllerThinningTest, MouseNear) {}

// Move the pointer over the scrollbar. Make sure it gets thick that it gets
// thin when moved away.
TEST_P(SingleScrollbarAnimationControllerThinningTest, MouseOver) {}

// First move the pointer over the scrollbar off of it. Make sure the thinning
// animation kicked off in DidMouseMoveOffScrollbar gets overridden by the
// thickening animation in the DidMouseMove call.
TEST_F(SingleScrollbarAnimationControllerThinningAuraTest,
       MouseNearThenAwayWhileAnimating) {}

// First move the pointer on the scrollbar, then press it, then away.
// Confirm that the bar gets thick. Then mouse up. Confirm that
// the bar gets thin.
TEST_P(SingleScrollbarAnimationControllerThinningTest,
       MouseCaptureAndReleaseOutOfBar) {}

// First move the pointer on the scrollbar, then press it, then away.  Confirm
// that the bar gets thick. Then move point on the scrollbar and mouse up.
// Confirm that the bar stays thick.
TEST_P(SingleScrollbarAnimationControllerThinningTest,
       MouseCaptureAndReleaseOnBar) {}

// Tests that the thickening/thinning effects are animated.
TEST_P(SingleScrollbarAnimationControllerThinningTest, ThicknessAnimated) {}

// Make sure the Fluent scrollbar transitions to the full mode (thick) after
// moving the mouse over scrollbar track and get back to the minimal mode (thin)
// when moved away both inside and outside the layer.
TEST_F(SingleScrollbarAnimationControllerThinningFluentTest, MouseOverTrack) {}

// Check that Fluent overlay scrollbar doesn't get thicker and doesn't get
// shown when mousing over it while it is hidden.
TEST_F(SingleScrollbarAnimationControllerThinningFluentTest,
       MouseOverHiddenBar) {}

// Check that Fluent overlay scrollbar doesn't get thinner when released outside
// of the scrollbar area with tickmarks showing.
TEST_F(SingleScrollbarAnimationControllerThinningFluentTest,
       ShowTickmarksAndReleaseOutsideBar) {}

// Check that Fluent overlay scrollbar doesn't get thinner when tickmarks are
// showing and the mouse moves over the scrollbar and then leaves the scrollable
// area.
TEST_F(SingleScrollbarAnimationControllerThinningFluentTest,
       ShowTickmarksAndMouseLeave) {}

// Check that if the mouse leaves while thickening animation is happening, the
// animation finishes as a thinning one.
TEST_F(SingleScrollbarAnimationControllerThinningFluentTest,
       ThickeningToThinningOnMouseLeave) {}

// Check that if the mouse leaves after the thickening animation is complete
// no thinning animation gets queued.
TEST_F(SingleScrollbarAnimationControllerThinningFluentTest,
       DoesntAnimateOnFullModeMouseLeave) {}

// Test that the last pointer location variable is set on DidMouseMove calls and
// mouse position variables are correctly updated in DidScrollUpdate() calls.
TEST_P(SingleScrollbarAnimationControllerThinningTest,
       HoverTrackAndMoveThumbUnderPointer) {}

// Test that DidScrollUpdate correctly queues thinning animations when the thumb
// moves under the pointer and when it moves away from it.
TEST_F(SingleScrollbarAnimationControllerThinningAuraTest,
       DidScrollUpdateQueuesAnimations) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace
}  // namespace cc