OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 6705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6716 external_transform.Translate(20, 20); | 6716 external_transform.Translate(20, 20); |
6717 host_impl_->SetExternalDrawConstraints(external_transform, | 6717 host_impl_->SetExternalDrawConstraints(external_transform, |
6718 external_viewport, | 6718 external_viewport, |
6719 external_clip, | 6719 external_clip, |
6720 valid_for_tile_management); | 6720 valid_for_tile_management); |
6721 DrawFrame(); | 6721 DrawFrame(); |
6722 EXPECT_TRANSFORMATION_MATRIX_EQ( | 6722 EXPECT_TRANSFORMATION_MATRIX_EQ( |
6723 external_transform, layer->draw_properties().target_space_transform); | 6723 external_transform, layer->draw_properties().target_space_transform); |
6724 } | 6724 } |
6725 | 6725 |
| 6726 TEST_F(LayerTreeHostImplTest, ScrollAnimated) { |
| 6727 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 6728 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
| 6729 DrawFrame(); |
| 6730 |
| 6731 base::TimeTicks start_time = |
| 6732 base::TimeTicks() + base::TimeDelta::FromMilliseconds(100); |
| 6733 |
| 6734 EXPECT_EQ(InputHandler::ScrollStarted, |
| 6735 host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50))); |
| 6736 |
| 6737 LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer(); |
| 6738 |
| 6739 host_impl_->Animate(start_time); |
| 6740 host_impl_->UpdateAnimationState(true); |
| 6741 |
| 6742 EXPECT_EQ(gfx::Vector2dF(), scrolling_layer->TotalScrollOffset()); |
| 6743 |
| 6744 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(50)); |
| 6745 host_impl_->UpdateAnimationState(true); |
| 6746 |
| 6747 float y = scrolling_layer->TotalScrollOffset().y(); |
| 6748 EXPECT_TRUE(y > 1 && y < 49); |
| 6749 |
| 6750 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); |
| 6751 host_impl_->UpdateAnimationState(true); |
| 6752 |
| 6753 EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset()); |
| 6754 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
| 6755 } |
| 6756 |
6726 } // namespace | 6757 } // namespace |
6727 } // namespace cc | 6758 } // namespace cc |
OLD | NEW |