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 "base/containers/hash_tables.h" | 5 #include "base/containers/hash_tables.h" |
6 #include "cc/animation/scrollbar_animation_controller.h" | 6 #include "cc/animation/scrollbar_animation_controller.h" |
7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
8 #include "cc/layers/painted_scrollbar_layer.h" | 8 #include "cc/layers/painted_scrollbar_layer.h" |
9 #include "cc/layers/painted_scrollbar_layer_impl.h" | 9 #include "cc/layers/painted_scrollbar_layer_impl.h" |
10 #include "cc/layers/scrollbar_layer_interface.h" | 10 #include "cc/layers/scrollbar_layer_interface.h" |
11 #include "cc/layers/solid_color_scrollbar_layer.h" | 11 #include "cc/layers/solid_color_scrollbar_layer.h" |
12 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 12 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
13 #include "cc/quads/solid_color_draw_quad.h" | 13 #include "cc/quads/solid_color_draw_quad.h" |
14 #include "cc/resources/resource_update_queue.h" | 14 #include "cc/resources/resource_update_queue.h" |
15 #include "cc/test/fake_impl_proxy.h" | 15 #include "cc/test/fake_impl_proxy.h" |
16 #include "cc/test/fake_layer_tree_host.h" | 16 #include "cc/test/fake_layer_tree_host.h" |
17 #include "cc/test/fake_layer_tree_host_client.h" | 17 #include "cc/test/fake_layer_tree_host_client.h" |
18 #include "cc/test/fake_layer_tree_host_impl.h" | 18 #include "cc/test/fake_layer_tree_host_impl.h" |
19 #include "cc/test/fake_painted_scrollbar_layer.h" | 19 #include "cc/test/fake_painted_scrollbar_layer.h" |
20 #include "cc/test/fake_scrollbar.h" | 20 #include "cc/test/fake_scrollbar.h" |
21 #include "cc/test/geometry_test_utils.h" | 21 #include "cc/test/geometry_test_utils.h" |
22 #include "cc/test/layer_tree_test.h" | 22 #include "cc/test/layer_tree_test.h" |
23 #include "cc/test/mock_occlusion_tracker.h" | 23 #include "cc/test/mock_occlusion_tracker.h" |
| 24 #include "cc/test/test_task_graph_runner.h" |
24 #include "cc/test/test_web_graphics_context_3d.h" | 25 #include "cc/test/test_web_graphics_context_3d.h" |
25 #include "cc/trees/layer_tree_host.h" | 26 #include "cc/trees/layer_tree_host.h" |
26 #include "cc/trees/layer_tree_impl.h" | 27 #include "cc/trees/layer_tree_impl.h" |
27 #include "cc/trees/occlusion_tracker.h" | 28 #include "cc/trees/occlusion_tracker.h" |
28 #include "cc/trees/single_thread_proxy.h" | 29 #include "cc/trees/single_thread_proxy.h" |
29 #include "cc/trees/tree_synchronizer.h" | 30 #include "cc/trees/tree_synchronizer.h" |
30 #include "testing/gmock/include/gmock/gmock.h" | 31 #include "testing/gmock/include/gmock/gmock.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
32 | 33 |
33 namespace cc { | 34 namespace cc { |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 ASSERT_EQ(1u, quads.size()); | 510 ASSERT_EQ(1u, quads.size()); |
510 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads.front()->material); | 511 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads.front()->material); |
511 EXPECT_EQ(gfx::Rect(3, 0, 3, 3), quads.front()->rect); | 512 EXPECT_EQ(gfx::Rect(3, 0, 3, 3), quads.front()->rect); |
512 } | 513 } |
513 } | 514 } |
514 | 515 |
515 class ScrollbarLayerSolidColorThumbTest : public testing::Test { | 516 class ScrollbarLayerSolidColorThumbTest : public testing::Test { |
516 public: | 517 public: |
517 ScrollbarLayerSolidColorThumbTest() { | 518 ScrollbarLayerSolidColorThumbTest() { |
518 LayerTreeSettings layer_tree_settings; | 519 LayerTreeSettings layer_tree_settings; |
519 host_impl_.reset(new FakeLayerTreeHostImpl( | 520 host_impl_.reset(new FakeLayerTreeHostImpl(layer_tree_settings, &proxy_, |
520 layer_tree_settings, &proxy_, &shared_bitmap_manager_)); | 521 &shared_bitmap_manager_, |
| 522 &task_graph_runner_)); |
521 | 523 |
522 const int kThumbThickness = 3; | 524 const int kThumbThickness = 3; |
523 const int kTrackStart = 0; | 525 const int kTrackStart = 0; |
524 const bool kIsLeftSideVerticalScrollbar = false; | 526 const bool kIsLeftSideVerticalScrollbar = false; |
525 const bool kIsOverlayScrollbar = false; | 527 const bool kIsOverlayScrollbar = false; |
526 | 528 |
527 horizontal_scrollbar_layer_ = | 529 horizontal_scrollbar_layer_ = |
528 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), | 530 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), |
529 1, | 531 1, |
530 HORIZONTAL, | 532 HORIZONTAL, |
531 kThumbThickness, | 533 kThumbThickness, |
532 kTrackStart, | 534 kTrackStart, |
533 kIsLeftSideVerticalScrollbar, | 535 kIsLeftSideVerticalScrollbar, |
534 kIsOverlayScrollbar); | 536 kIsOverlayScrollbar); |
535 vertical_scrollbar_layer_ = | 537 vertical_scrollbar_layer_ = |
536 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), | 538 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), |
537 2, | 539 2, |
538 VERTICAL, | 540 VERTICAL, |
539 kThumbThickness, | 541 kThumbThickness, |
540 kTrackStart, | 542 kTrackStart, |
541 kIsLeftSideVerticalScrollbar, | 543 kIsLeftSideVerticalScrollbar, |
542 kIsOverlayScrollbar); | 544 kIsOverlayScrollbar); |
543 } | 545 } |
544 | 546 |
545 protected: | 547 protected: |
546 FakeImplProxy proxy_; | 548 FakeImplProxy proxy_; |
547 TestSharedBitmapManager shared_bitmap_manager_; | 549 TestSharedBitmapManager shared_bitmap_manager_; |
| 550 TestTaskGraphRunner task_graph_runner_; |
548 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; | 551 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; |
549 scoped_ptr<SolidColorScrollbarLayerImpl> horizontal_scrollbar_layer_; | 552 scoped_ptr<SolidColorScrollbarLayerImpl> horizontal_scrollbar_layer_; |
550 scoped_ptr<SolidColorScrollbarLayerImpl> vertical_scrollbar_layer_; | 553 scoped_ptr<SolidColorScrollbarLayerImpl> vertical_scrollbar_layer_; |
551 }; | 554 }; |
552 | 555 |
553 TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbLength) { | 556 TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbLength) { |
554 horizontal_scrollbar_layer_->SetCurrentPos(0); | 557 horizontal_scrollbar_layer_->SetCurrentPos(0); |
555 horizontal_scrollbar_layer_->SetMaximum(10); | 558 horizontal_scrollbar_layer_->SetMaximum(10); |
556 | 559 |
557 // Simple case - one third of the scrollable area is visible, so the thumb | 560 // Simple case - one third of the scrollable area is visible, so the thumb |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1060 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
1058 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1061 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
1059 | 1062 |
1060 // Horizontal Scrollbars. | 1063 // Horizontal Scrollbars. |
1061 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1064 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
1062 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1065 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
1063 } | 1066 } |
1064 | 1067 |
1065 } // namespace | 1068 } // namespace |
1066 } // namespace cc | 1069 } // namespace cc |
OLD | NEW |