OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <unordered_map> | 7 #include <unordered_map> |
8 | 8 |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 scrollbar_layer->effect_tree_index()); | 638 scrollbar_layer->effect_tree_index()); |
639 EXPECT_EQ(node->opacity, 1.f); | 639 EXPECT_EQ(node->opacity, 1.f); |
640 } | 640 } |
641 | 641 |
642 class ScrollbarLayerSolidColorThumbTest : public testing::Test { | 642 class ScrollbarLayerSolidColorThumbTest : public testing::Test { |
643 public: | 643 public: |
644 ScrollbarLayerSolidColorThumbTest() { | 644 ScrollbarLayerSolidColorThumbTest() { |
645 LayerTreeSettings layer_tree_settings; | 645 LayerTreeSettings layer_tree_settings; |
646 layer_tree_settings.verify_clip_tree_calculations = true; | 646 layer_tree_settings.verify_clip_tree_calculations = true; |
647 host_impl_.reset(new FakeLayerTreeHostImpl( | 647 host_impl_.reset(new FakeLayerTreeHostImpl( |
648 layer_tree_settings, &task_runner_provider_, &shared_bitmap_manager_, | 648 layer_tree_settings, &task_runner_provider_, &task_graph_runner_)); |
649 &task_graph_runner_)); | |
650 | 649 |
651 const int kThumbThickness = 3; | 650 const int kThumbThickness = 3; |
652 const int kTrackStart = 0; | 651 const int kTrackStart = 0; |
653 const bool kIsLeftSideVerticalScrollbar = false; | 652 const bool kIsLeftSideVerticalScrollbar = false; |
654 const bool kIsOverlayScrollbar = false; | 653 const bool kIsOverlayScrollbar = false; |
655 | 654 |
656 horizontal_scrollbar_layer_ = | 655 horizontal_scrollbar_layer_ = |
657 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), | 656 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), |
658 1, | 657 1, |
659 HORIZONTAL, | 658 HORIZONTAL, |
660 kThumbThickness, | 659 kThumbThickness, |
661 kTrackStart, | 660 kTrackStart, |
662 kIsLeftSideVerticalScrollbar, | 661 kIsLeftSideVerticalScrollbar, |
663 kIsOverlayScrollbar); | 662 kIsOverlayScrollbar); |
664 vertical_scrollbar_layer_ = | 663 vertical_scrollbar_layer_ = |
665 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), | 664 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), |
666 2, | 665 2, |
667 VERTICAL, | 666 VERTICAL, |
668 kThumbThickness, | 667 kThumbThickness, |
669 kTrackStart, | 668 kTrackStart, |
670 kIsLeftSideVerticalScrollbar, | 669 kIsLeftSideVerticalScrollbar, |
671 kIsOverlayScrollbar); | 670 kIsOverlayScrollbar); |
672 } | 671 } |
673 | 672 |
674 protected: | 673 protected: |
675 FakeImplTaskRunnerProvider task_runner_provider_; | 674 FakeImplTaskRunnerProvider task_runner_provider_; |
676 TestSharedBitmapManager shared_bitmap_manager_; | |
677 TestTaskGraphRunner task_graph_runner_; | 675 TestTaskGraphRunner task_graph_runner_; |
678 std::unique_ptr<FakeLayerTreeHostImpl> host_impl_; | 676 std::unique_ptr<FakeLayerTreeHostImpl> host_impl_; |
679 std::unique_ptr<SolidColorScrollbarLayerImpl> horizontal_scrollbar_layer_; | 677 std::unique_ptr<SolidColorScrollbarLayerImpl> horizontal_scrollbar_layer_; |
680 std::unique_ptr<SolidColorScrollbarLayerImpl> vertical_scrollbar_layer_; | 678 std::unique_ptr<SolidColorScrollbarLayerImpl> vertical_scrollbar_layer_; |
681 }; | 679 }; |
682 | 680 |
683 TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbLength) { | 681 TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbLength) { |
684 horizontal_scrollbar_layer_->SetCurrentPos(0); | 682 horizontal_scrollbar_layer_->SetCurrentPos(0); |
685 | 683 |
686 // Simple case - one third of the scrollable area is visible, so the thumb | 684 // Simple case - one third of the scrollable area is visible, so the thumb |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1117 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
1120 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1118 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
1121 | 1119 |
1122 // Horizontal Scrollbars. | 1120 // Horizontal Scrollbars. |
1123 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1121 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
1124 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1122 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
1125 } | 1123 } |
1126 | 1124 |
1127 } // namespace | 1125 } // namespace |
1128 } // namespace cc | 1126 } // namespace cc |
OLD | NEW |