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 "base/thread_task_runner_handle.h" | 6 #include "base/thread_task_runner_handle.h" |
7 #include "cc/animation/scrollbar_animation_controller.h" | 7 #include "cc/animation/scrollbar_animation_controller.h" |
8 #include "cc/layers/append_quads_data.h" | 8 #include "cc/layers/append_quads_data.h" |
9 #include "cc/layers/painted_scrollbar_layer.h" | 9 #include "cc/layers/painted_scrollbar_layer.h" |
10 #include "cc/layers/painted_scrollbar_layer_impl.h" | 10 #include "cc/layers/painted_scrollbar_layer_impl.h" |
11 #include "cc/layers/scrollbar_layer_interface.h" | 11 #include "cc/layers/scrollbar_layer_interface.h" |
12 #include "cc/layers/solid_color_scrollbar_layer.h" | 12 #include "cc/layers/solid_color_scrollbar_layer.h" |
13 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 13 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
14 #include "cc/quads/solid_color_draw_quad.h" | 14 #include "cc/quads/solid_color_draw_quad.h" |
15 #include "cc/test/fake_impl_proxy.h" | 15 #include "cc/test/fake_impl_task_runner_provider.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_task_graph_runner.h" |
25 #include "cc/test/test_web_graphics_context_3d.h" | 25 #include "cc/test/test_web_graphics_context_3d.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 ASSERT_EQ(1u, quads.size()); | 474 ASSERT_EQ(1u, quads.size()); |
475 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads.front()->material); | 475 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads.front()->material); |
476 EXPECT_EQ(gfx::Rect(3, 0, 3, 3), quads.front()->rect); | 476 EXPECT_EQ(gfx::Rect(3, 0, 3, 3), quads.front()->rect); |
477 } | 477 } |
478 } | 478 } |
479 | 479 |
480 class ScrollbarLayerSolidColorThumbTest : public testing::Test { | 480 class ScrollbarLayerSolidColorThumbTest : public testing::Test { |
481 public: | 481 public: |
482 ScrollbarLayerSolidColorThumbTest() { | 482 ScrollbarLayerSolidColorThumbTest() { |
483 LayerTreeSettings layer_tree_settings; | 483 LayerTreeSettings layer_tree_settings; |
484 host_impl_.reset(new FakeLayerTreeHostImpl(layer_tree_settings, &proxy_, | 484 host_impl_.reset(new FakeLayerTreeHostImpl( |
485 &shared_bitmap_manager_, | 485 layer_tree_settings, &task_runner_provider_, &shared_bitmap_manager_, |
486 &task_graph_runner_)); | 486 &task_graph_runner_)); |
487 | 487 |
488 const int kThumbThickness = 3; | 488 const int kThumbThickness = 3; |
489 const int kTrackStart = 0; | 489 const int kTrackStart = 0; |
490 const bool kIsLeftSideVerticalScrollbar = false; | 490 const bool kIsLeftSideVerticalScrollbar = false; |
491 const bool kIsOverlayScrollbar = false; | 491 const bool kIsOverlayScrollbar = false; |
492 | 492 |
493 horizontal_scrollbar_layer_ = | 493 horizontal_scrollbar_layer_ = |
494 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), | 494 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), |
495 1, | 495 1, |
496 HORIZONTAL, | 496 HORIZONTAL, |
497 kThumbThickness, | 497 kThumbThickness, |
498 kTrackStart, | 498 kTrackStart, |
499 kIsLeftSideVerticalScrollbar, | 499 kIsLeftSideVerticalScrollbar, |
500 kIsOverlayScrollbar); | 500 kIsOverlayScrollbar); |
501 vertical_scrollbar_layer_ = | 501 vertical_scrollbar_layer_ = |
502 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), | 502 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), |
503 2, | 503 2, |
504 VERTICAL, | 504 VERTICAL, |
505 kThumbThickness, | 505 kThumbThickness, |
506 kTrackStart, | 506 kTrackStart, |
507 kIsLeftSideVerticalScrollbar, | 507 kIsLeftSideVerticalScrollbar, |
508 kIsOverlayScrollbar); | 508 kIsOverlayScrollbar); |
509 } | 509 } |
510 | 510 |
511 protected: | 511 protected: |
512 FakeImplProxy proxy_; | 512 FakeImplTaskRunnerProvider task_runner_provider_; |
513 TestSharedBitmapManager shared_bitmap_manager_; | 513 TestSharedBitmapManager shared_bitmap_manager_; |
514 TestTaskGraphRunner task_graph_runner_; | 514 TestTaskGraphRunner task_graph_runner_; |
515 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; | 515 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; |
516 scoped_ptr<SolidColorScrollbarLayerImpl> horizontal_scrollbar_layer_; | 516 scoped_ptr<SolidColorScrollbarLayerImpl> horizontal_scrollbar_layer_; |
517 scoped_ptr<SolidColorScrollbarLayerImpl> vertical_scrollbar_layer_; | 517 scoped_ptr<SolidColorScrollbarLayerImpl> vertical_scrollbar_layer_; |
518 }; | 518 }; |
519 | 519 |
520 TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbLength) { | 520 TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbLength) { |
521 horizontal_scrollbar_layer_->SetCurrentPos(0); | 521 horizontal_scrollbar_layer_->SetCurrentPos(0); |
522 | 522 |
(...skipping 478 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 |