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