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/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "cc/animation/scrollbar_animation_controller.h" | 10 #include "cc/animation/scrollbar_animation_controller.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 layer_tree_root->AddChild(child1); | 59 layer_tree_root->AddChild(child1); |
60 layer_tree_root->InsertChild(child2, reverse_order ? 0 : 1); | 60 layer_tree_root->InsertChild(child2, reverse_order ? 0 : 1); |
61 host->SetRootLayer(layer_tree_root); | 61 host->SetRootLayer(layer_tree_root); |
62 return host->CommitAndCreateLayerImplTree(); | 62 return host->CommitAndCreateLayerImplTree(); |
63 } | 63 } |
64 | 64 |
65 class FakeResourceTrackingLayerTreeHost : public FakeLayerTreeHost { | 65 class FakeResourceTrackingLayerTreeHost : public FakeLayerTreeHost { |
66 public: | 66 public: |
67 FakeResourceTrackingLayerTreeHost(FakeLayerTreeHostClient* client, | 67 FakeResourceTrackingLayerTreeHost(FakeLayerTreeHostClient* client, |
68 LayerTreeHost::InitParams* params) | 68 LayerTreeHost::InitParams* params) |
69 : FakeLayerTreeHost(client, params, CompositorMode::SingleThreaded), | 69 : FakeLayerTreeHost(client, params, CompositorMode::SINGLE_THREADED), |
70 next_id_(1), | 70 next_id_(1), |
71 total_ui_resource_created_(0), | 71 total_ui_resource_created_(0), |
72 total_ui_resource_deleted_(0) { | 72 total_ui_resource_deleted_(0) { |
73 InitializeSingleThreaded(client, base::ThreadTaskRunnerHandle::Get(), | 73 InitializeSingleThreaded(client, base::ThreadTaskRunnerHandle::Get(), |
74 nullptr); | 74 nullptr); |
75 } | 75 } |
76 | 76 |
77 UIResourceId CreateUIResource(UIResourceClient* content) override { | 77 UIResourceId CreateUIResource(UIResourceClient* content) override { |
78 total_ui_resource_created_++; | 78 total_ui_resource_created_++; |
79 UIResourceId nid = next_id_++; | 79 UIResourceId nid = next_id_++; |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 scoped_refptr<Layer> scroll_layer_; | 635 scoped_refptr<Layer> scroll_layer_; |
636 gfx::Size bounds_; | 636 gfx::Size bounds_; |
637 }; | 637 }; |
638 | 638 |
639 TEST_F(ScrollbarLayerTestMaxTextureSize, DirectRenderer) { | 639 TEST_F(ScrollbarLayerTestMaxTextureSize, DirectRenderer) { |
640 scoped_ptr<TestWebGraphicsContext3D> context = | 640 scoped_ptr<TestWebGraphicsContext3D> context = |
641 TestWebGraphicsContext3D::Create(); | 641 TestWebGraphicsContext3D::Create(); |
642 int max_size = 0; | 642 int max_size = 0; |
643 context->getIntegerv(GL_MAX_TEXTURE_SIZE, &max_size); | 643 context->getIntegerv(GL_MAX_TEXTURE_SIZE, &max_size); |
644 SetScrollbarBounds(gfx::Size(max_size + 100, max_size + 100)); | 644 SetScrollbarBounds(gfx::Size(max_size + 100, max_size + 100)); |
645 RunTest(CompositorMode::Threaded, false); | 645 RunTest(CompositorMode::THREADED, false); |
646 } | 646 } |
647 | 647 |
648 TEST_F(ScrollbarLayerTestMaxTextureSize, DelegatingRenderer) { | 648 TEST_F(ScrollbarLayerTestMaxTextureSize, DelegatingRenderer) { |
649 scoped_ptr<TestWebGraphicsContext3D> context = | 649 scoped_ptr<TestWebGraphicsContext3D> context = |
650 TestWebGraphicsContext3D::Create(); | 650 TestWebGraphicsContext3D::Create(); |
651 int max_size = 0; | 651 int max_size = 0; |
652 context->getIntegerv(GL_MAX_TEXTURE_SIZE, &max_size); | 652 context->getIntegerv(GL_MAX_TEXTURE_SIZE, &max_size); |
653 SetScrollbarBounds(gfx::Size(max_size + 100, max_size + 100)); | 653 SetScrollbarBounds(gfx::Size(max_size + 100, max_size + 100)); |
654 RunTest(CompositorMode::Threaded, true); | 654 RunTest(CompositorMode::THREADED, true); |
655 } | 655 } |
656 | 656 |
657 class ScrollbarLayerTestResourceCreationAndRelease : public ScrollbarLayerTest { | 657 class ScrollbarLayerTestResourceCreationAndRelease : public ScrollbarLayerTest { |
658 public: | 658 public: |
659 void TestResourceUpload(int num_updates, | 659 void TestResourceUpload(int num_updates, |
660 size_t expected_resources, | 660 size_t expected_resources, |
661 int expected_created, | 661 int expected_created, |
662 int expected_deleted, | 662 int expected_deleted, |
663 bool use_solid_color_scrollbar) { | 663 bool use_solid_color_scrollbar) { |
664 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, false)); | 664 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, false)); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1009 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
1010 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1010 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
1011 | 1011 |
1012 // Horizontal Scrollbars. | 1012 // Horizontal Scrollbars. |
1013 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1013 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
1014 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1014 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
1015 } | 1015 } |
1016 | 1016 |
1017 } // namespace | 1017 } // namespace |
1018 } // namespace cc | 1018 } // namespace cc |
OLD | NEW |