| 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" |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 ASSERT_EQ(1u, quads.size()); | 383 ASSERT_EQ(1u, quads.size()); |
| 384 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); | 384 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); |
| 385 EXPECT_RECT_EQ(gfx::Rect(3, 0, 3, 3), quads[0]->rect); | 385 EXPECT_RECT_EQ(gfx::Rect(3, 0, 3, 3), quads[0]->rect); |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 | 388 |
| 389 class ScrollbarLayerSolidColorThumbTest : public testing::Test { | 389 class ScrollbarLayerSolidColorThumbTest : public testing::Test { |
| 390 public: | 390 public: |
| 391 ScrollbarLayerSolidColorThumbTest() { | 391 ScrollbarLayerSolidColorThumbTest() { |
| 392 LayerTreeSettings layer_tree_settings; | 392 LayerTreeSettings layer_tree_settings; |
| 393 host_impl_.reset(new FakeLayerTreeHostImpl(layer_tree_settings, &proxy_)); | 393 host_impl_.reset(new FakeLayerTreeHostImpl( |
| 394 layer_tree_settings, &proxy_, &shared_bitmap_manager_)); |
| 394 | 395 |
| 395 const int kThumbThickness = 3; | 396 const int kThumbThickness = 3; |
| 396 const bool kIsLeftSideVerticalScrollbar = false; | 397 const bool kIsLeftSideVerticalScrollbar = false; |
| 397 const bool kIsOverlayScrollbar = false; | 398 const bool kIsOverlayScrollbar = false; |
| 398 | 399 |
| 399 horizontal_scrollbar_layer_ = | 400 horizontal_scrollbar_layer_ = |
| 400 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), | 401 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), |
| 401 1, | 402 1, |
| 402 HORIZONTAL, | 403 HORIZONTAL, |
| 403 kThumbThickness, | 404 kThumbThickness, |
| 404 kIsLeftSideVerticalScrollbar, | 405 kIsLeftSideVerticalScrollbar, |
| 405 kIsOverlayScrollbar); | 406 kIsOverlayScrollbar); |
| 406 vertical_scrollbar_layer_ = | 407 vertical_scrollbar_layer_ = |
| 407 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), | 408 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), |
| 408 2, | 409 2, |
| 409 VERTICAL, | 410 VERTICAL, |
| 410 kThumbThickness, | 411 kThumbThickness, |
| 411 kIsLeftSideVerticalScrollbar, | 412 kIsLeftSideVerticalScrollbar, |
| 412 kIsOverlayScrollbar); | 413 kIsOverlayScrollbar); |
| 413 } | 414 } |
| 414 | 415 |
| 415 protected: | 416 protected: |
| 416 FakeImplProxy proxy_; | 417 FakeImplProxy proxy_; |
| 418 TestSharedBitmapManager shared_bitmap_manager_; |
| 417 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; | 419 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; |
| 418 scoped_ptr<SolidColorScrollbarLayerImpl> horizontal_scrollbar_layer_; | 420 scoped_ptr<SolidColorScrollbarLayerImpl> horizontal_scrollbar_layer_; |
| 419 scoped_ptr<SolidColorScrollbarLayerImpl> vertical_scrollbar_layer_; | 421 scoped_ptr<SolidColorScrollbarLayerImpl> vertical_scrollbar_layer_; |
| 420 }; | 422 }; |
| 421 | 423 |
| 422 TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbLength) { | 424 TEST_F(ScrollbarLayerSolidColorThumbTest, SolidColorThumbLength) { |
| 423 horizontal_scrollbar_layer_->SetCurrentPos(0); | 425 horizontal_scrollbar_layer_->SetCurrentPos(0); |
| 424 horizontal_scrollbar_layer_->SetMaximum(10); | 426 horizontal_scrollbar_layer_->SetMaximum(10); |
| 425 | 427 |
| 426 // Simple case - one third of the scrollable area is visible, so the thumb | 428 // Simple case - one third of the scrollable area is visible, so the thumb |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 873 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
| 872 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 874 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
| 873 | 875 |
| 874 // Horizontal Scrollbars. | 876 // Horizontal Scrollbars. |
| 875 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 877 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
| 876 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 878 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
| 877 } | 879 } |
| 878 | 880 |
| 879 } // namespace | 881 } // namespace |
| 880 } // namespace cc | 882 } // namespace cc |
| OLD | NEW |