chromium/cc/layers/scrollbar_layer_unittest.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include <stddef.h>

#include <memory>
#include <unordered_map>

#include "base/memory/raw_ptr.h"
#include "base/task/single_thread_task_runner.h"
#include "cc/animation/animation_host.h"
#include "cc/input/scrollbar_animation_controller.h"
#include "cc/layers/append_quads_data.h"
#include "cc/layers/nine_patch_thumb_scrollbar_layer.h"
#include "cc/layers/nine_patch_thumb_scrollbar_layer_impl.h"
#include "cc/layers/painted_scrollbar_layer.h"
#include "cc/layers/painted_scrollbar_layer_impl.h"
#include "cc/layers/scrollbar_layer_base.h"
#include "cc/layers/solid_color_scrollbar_layer.h"
#include "cc/layers/solid_color_scrollbar_layer_impl.h"
#include "cc/resources/ui_resource_manager.h"
#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_scrollbar.h"
#include "cc/test/fake_scrollbar_layer.h"
#include "cc/test/layer_tree_impl_test_base.h"
#include "cc/test/layer_tree_test.h"
#include "cc/test/stub_layer_tree_host_single_thread_client.h"
#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/effect_node.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/occlusion_tracker.h"
#include "cc/trees/scroll_node.h"
#include "cc/trees/single_thread_proxy.h"
#include "cc/trees/tree_synchronizer.h"
#include "components/viz/common/quads/solid_color_draw_quad.h"
#include "components/viz/test/test_context_provider.h"
#include "components/viz/test/test_raster_interface.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

Bool;

namespace cc {

class FakeResourceTrackingUIResourceManager : public UIResourceManager {};

class BaseScrollbarLayerTest : public testing::Test {};

class CommitToActiveTreeScrollbarLayerTest : public BaseScrollbarLayerTest {};

class ScrollbarLayerTest : public BaseScrollbarLayerTest {};

class AuraScrollbarLayerTest : public BaseScrollbarLayerTest,
                               public testing::WithParamInterface<bool> {};

class FakeNinePatchThumbScrollbar : public FakeScrollbar {};

// Test that a nine-patch-thumb scrollbar will repaint and recrate its resource
// after its been disposed, even if Blink doesn't think it requires a repaint.
// crbug.com/704656.
TEST_F(ScrollbarLayerTest, RepaintNinePatchWhenResourceDisposed) {}

TEST_F(ScrollbarLayerTest,
       SetNeedsDisplayDoesNotRequireUpdate_NonSolidColorThumb) {}

TEST_F(ScrollbarLayerTest,
       SetNeedsDisplayDoesNotRequireUpdate_SolidColorThumb) {}

class FakeNinePatchScrollbar : public FakeScrollbar {};

TEST_F(CommitToActiveTreeScrollbarLayerTest,
       ScrollElementIdPushedAcrossCommit) {}

TEST_F(CommitToActiveTreeScrollbarLayerTest, ScrollOffsetSynchronization) {}

#define UPDATE_AND_EXTRACT_LAYER_POINTERS()

TEST_F(CommitToActiveTreeScrollbarLayerTest,
       UpdatePropertiesOfScrollBarWhenThumbRemoved) {}

TEST_F(CommitToActiveTreeScrollbarLayerTest, NinePatchThumbRect) {}

TEST_F(CommitToActiveTreeScrollbarLayerTest, PaintedThumbRect) {}

TEST_F(CommitToActiveTreeScrollbarLayerTest,
       ThumbRectForOverlayLeftSideVerticalScrollbar) {}

TEST_F(CommitToActiveTreeScrollbarLayerTest, SolidColorDrawQuads) {}

TEST_F(CommitToActiveTreeScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) {}

TEST_F(ScrollbarLayerTest, ScrollbarLayerOpacity) {}

TEST_P(AuraScrollbarLayerTest, ScrollbarLayerPushProperties) {}

TEST_F(ScrollbarLayerTest, SubPixelCanScrollOrientation) {}

TEST_P(AuraScrollbarLayerTest, ScrollbarLayerCreateAfterSetScrollable) {}

class ScrollbarLayerSolidColorThumbTest : public testing::Test {};

TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbLength) {}

TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbPosition) {}

TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbVerticalAdjust) {}

class ScrollbarLayerTestResourceCreationAndRelease : public ScrollbarLayerTest {};

TEST_F(ScrollbarLayerTestResourceCreationAndRelease, ResourceUpload) {}

TEST_F(ScrollbarLayerTestResourceCreationAndRelease,
       SolidColorNoResourceUpload) {}

TEST_F(ScrollbarLayerTestResourceCreationAndRelease, TestResourceUpdate) {}

class ScaledScrollbarLayerTestResourceCreation : public ScrollbarLayerTest {};

TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) {}

class ScaledScrollbarLayerTestScaledRasterization : public ScrollbarLayerTest {};

TEST_F(ScaledScrollbarLayerTestScaledRasterization, TestLostPrecisionInClip) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace cc