Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Side by Side Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 2231233002: cc: Remove the lie of "DirectRenderer" in LayerTreeTests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no-ltt-delegating: ccpt Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 // The vertical adjustment factor has two effects: 731 // The vertical adjustment factor has two effects:
732 // 1.) Moves the horizontal scrollbar down 732 // 1.) Moves the horizontal scrollbar down
733 // 2.) Increases the vertical scrollbar's effective track length which both 733 // 2.) Increases the vertical scrollbar's effective track length which both
734 // increases the thumb's length and its position within the track. 734 // increases the thumb's length and its position within the track.
735 EXPECT_EQ(gfx::Rect(20.f, 10.f, 20.f, 3.f), 735 EXPECT_EQ(gfx::Rect(20.f, 10.f, 20.f, 3.f),
736 horizontal_scrollbar_layer_->ComputeThumbQuadRect()); 736 horizontal_scrollbar_layer_->ComputeThumbQuadRect());
737 EXPECT_EQ(gfx::Rect(0.f, 22, 3.f, 22.f), 737 EXPECT_EQ(gfx::Rect(0.f, 22, 3.f, 22.f),
738 vertical_scrollbar_layer_->ComputeThumbQuadRect()); 738 vertical_scrollbar_layer_->ComputeThumbQuadRect());
739 } 739 }
740 740
741 class ScrollbarLayerTestMaxTextureSize : public LayerTreeTest { 741 class ScrollbarLayerTestWithFixedScrollbarBounds : public LayerTreeTest {
742 public: 742 public:
743 ScrollbarLayerTestMaxTextureSize() {} 743 ScrollbarLayerTestWithFixedScrollbarBounds() {}
744 744
745 void SetScrollbarBounds(const gfx::Size& bounds) { bounds_ = bounds; } 745 void SetScrollbarBounds(const gfx::Size& bounds) { bounds_ = bounds; }
746 746
747 void BeginTest() override { 747 void BeginTest() override {
748 scroll_layer_ = Layer::Create(); 748 scroll_layer_ = Layer::Create();
749 layer_tree_host()->root_layer()->AddChild(scroll_layer_); 749 layer_tree_host()->root_layer()->AddChild(scroll_layer_);
750 750
751 std::unique_ptr<Scrollbar> scrollbar(new FakeScrollbar); 751 std::unique_ptr<Scrollbar> scrollbar(new FakeScrollbar);
752 scrollbar_layer_ = PaintedScrollbarLayer::Create(std::move(scrollbar), 752 scrollbar_layer_ = PaintedScrollbarLayer::Create(std::move(scrollbar),
753 scroll_layer_->id()); 753 scroll_layer_->id());
(...skipping 22 matching lines...) Expand all
776 } 776 }
777 777
778 void AfterTest() override {} 778 void AfterTest() override {}
779 779
780 private: 780 private:
781 scoped_refptr<PaintedScrollbarLayer> scrollbar_layer_; 781 scoped_refptr<PaintedScrollbarLayer> scrollbar_layer_;
782 scoped_refptr<Layer> scroll_layer_; 782 scoped_refptr<Layer> scroll_layer_;
783 gfx::Size bounds_; 783 gfx::Size bounds_;
784 }; 784 };
785 785
786 TEST_F(ScrollbarLayerTestMaxTextureSize, DirectRenderer) { 786 TEST_F(ScrollbarLayerTestWithFixedScrollbarBounds, MaxTextureSize) {
787 std::unique_ptr<TestWebGraphicsContext3D> context = 787 std::unique_ptr<TestWebGraphicsContext3D> context =
788 TestWebGraphicsContext3D::Create(); 788 TestWebGraphicsContext3D::Create();
789 int max_size = 0; 789 int max_size = 0;
790 context->getIntegerv(GL_MAX_TEXTURE_SIZE, &max_size); 790 context->getIntegerv(GL_MAX_TEXTURE_SIZE, &max_size);
791 SetScrollbarBounds(gfx::Size(max_size + 100, max_size + 100)); 791 SetScrollbarBounds(gfx::Size(max_size + 100, max_size + 100));
792 RunTest(CompositorMode::THREADED, false); 792 RunTest(CompositorMode::THREADED);
793 }
794
795 TEST_F(ScrollbarLayerTestMaxTextureSize, DelegatingRenderer) {
796 std::unique_ptr<TestWebGraphicsContext3D> context =
797 TestWebGraphicsContext3D::Create();
798 int max_size = 0;
799 context->getIntegerv(GL_MAX_TEXTURE_SIZE, &max_size);
800 SetScrollbarBounds(gfx::Size(max_size + 100, max_size + 100));
801 RunTest(CompositorMode::THREADED, true);
802 } 793 }
803 794
804 class ScrollbarLayerTestResourceCreationAndRelease : public ScrollbarLayerTest { 795 class ScrollbarLayerTestResourceCreationAndRelease : public ScrollbarLayerTest {
805 public: 796 public:
806 void TestResourceUpload(int num_updates, 797 void TestResourceUpload(int num_updates,
807 size_t expected_resources, 798 size_t expected_resources,
808 int expected_created, 799 int expected_created,
809 int expected_deleted, 800 int expected_deleted,
810 bool use_solid_color_scrollbar) { 801 bool use_solid_color_scrollbar) {
811 std::unique_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, false)); 802 std::unique_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, false));
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); 1145 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f);
1155 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); 1146 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f);
1156 1147
1157 // Horizontal Scrollbars. 1148 // Horizontal Scrollbars.
1158 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); 1149 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f);
1159 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); 1150 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f);
1160 } 1151 }
1161 1152
1162 } // namespace 1153 } // namespace
1163 } // namespace cc 1154 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698