| 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 "cc/scrollbar_animation_controller_linear_fade.h" | 5 #include "cc/scrollbar_animation_controller_linear_fade.h" |
| 6 | 6 |
| 7 #include "cc/scrollbar_layer_impl.h" | 7 #include "cc/scrollbar_layer_impl.h" |
| 8 #include "cc/single_thread_proxy.h" | 8 #include "cc/single_thread_proxy.h" |
| 9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
| 11 #include "cc/test/fake_web_scrollbar_theme_geometry.h" | 11 #include "cc/test/fake_web_scrollbar_theme_geometry.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 class ScrollbarAnimationControllerLinearFadeTest : public testing::Test { | 17 class ScrollbarAnimationControllerLinearFadeTest : public testing::Test { |
| 18 public: | 18 public: |
| 19 ScrollbarAnimationControllerLinearFadeTest() | 19 ScrollbarAnimationControllerLinearFadeTest() |
| 20 : m_hostImpl(&m_proxy) | 20 : m_hostImpl(&m_proxy) |
| 21 { | 21 { |
| 22 } | 22 } |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 virtual void SetUp() | 25 virtual void SetUp() |
| 26 { | 26 { |
| 27 m_scrollLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1); | 27 m_scrollLayer = LayerImpl::Create(m_hostImpl.active_tree(), 1); |
| 28 scoped_ptr<ScrollbarGeometryFixedThumb> geometry(ScrollbarGeometryFixedT
humb::create(FakeWebScrollbarThemeGeometry::create(false))); | 28 scoped_ptr<ScrollbarGeometryFixedThumb> geometry(ScrollbarGeometryFixedT
humb::create(FakeWebScrollbarThemeGeometry::create(false))); |
| 29 m_scrollbarLayer = ScrollbarLayerImpl::Create(m_hostImpl.activeTree(), 2
, geometry.Pass()); | 29 m_scrollbarLayer = ScrollbarLayerImpl::Create(m_hostImpl.active_tree(),
2, geometry.Pass()); |
| 30 | 30 |
| 31 m_scrollLayer->SetMaxScrollOffset(gfx::Vector2d(50, 50)); | 31 m_scrollLayer->SetMaxScrollOffset(gfx::Vector2d(50, 50)); |
| 32 m_scrollLayer->SetBounds(gfx::Size(50, 50)); | 32 m_scrollLayer->SetBounds(gfx::Size(50, 50)); |
| 33 m_scrollLayer->SetHorizontalScrollbarLayer(m_scrollbarLayer.get()); | 33 m_scrollLayer->SetHorizontalScrollbarLayer(m_scrollbarLayer.get()); |
| 34 | 34 |
| 35 m_scrollbarController = ScrollbarAnimationControllerLinearFade::create(m
_scrollLayer.get(), 2, 3); | 35 m_scrollbarController = ScrollbarAnimationControllerLinearFade::create(m
_scrollLayer.get(), 2, 3); |
| 36 } | 36 } |
| 37 | 37 |
| 38 FakeImplProxy m_proxy; | 38 FakeImplProxy m_proxy; |
| 39 FakeLayerTreeHostImpl m_hostImpl; | 39 FakeLayerTreeHostImpl m_hostImpl; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 EXPECT_FLOAT_EQ(1 / 3.0f, m_scrollbarLayer->opacity()); | 152 EXPECT_FLOAT_EQ(1 / 3.0f, m_scrollbarLayer->opacity()); |
| 153 | 153 |
| 154 time += base::TimeDelta::FromSeconds(1); | 154 time += base::TimeDelta::FromSeconds(1); |
| 155 m_scrollbarController->animate(time); | 155 m_scrollbarController->animate(time); |
| 156 EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity()); | 156 EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity()); |
| 157 | 157 |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace | 160 } // namespace |
| 161 } // namespace cc | 161 } // namespace cc |
| OLD | NEW |