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 6637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6648 external_transform.Translate(20, 20); | 6648 external_transform.Translate(20, 20); |
6649 host_impl_->SetExternalDrawConstraints(external_transform, | 6649 host_impl_->SetExternalDrawConstraints(external_transform, |
6650 external_viewport, | 6650 external_viewport, |
6651 external_clip, | 6651 external_clip, |
6652 valid_for_tile_management); | 6652 valid_for_tile_management); |
6653 DrawFrame(); | 6653 DrawFrame(); |
6654 EXPECT_TRANSFORMATION_MATRIX_EQ( | 6654 EXPECT_TRANSFORMATION_MATRIX_EQ( |
6655 external_transform, layer->draw_properties().target_space_transform); | 6655 external_transform, layer->draw_properties().target_space_transform); |
6656 } | 6656 } |
6657 | 6657 |
| 6658 TEST_F(LayerTreeHostImplTest, ScrollAnimated) { |
| 6659 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 6660 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
| 6661 DrawFrame(); |
| 6662 |
| 6663 base::TimeTicks start_time = |
| 6664 base::TimeTicks() + base::TimeDelta::FromMilliseconds(100); |
| 6665 |
| 6666 EXPECT_EQ(InputHandler::ScrollStarted, |
| 6667 host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50))); |
| 6668 |
| 6669 LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer(); |
| 6670 |
| 6671 host_impl_->Animate(start_time); |
| 6672 host_impl_->UpdateAnimationState(true); |
| 6673 |
| 6674 EXPECT_EQ(gfx::Vector2dF(), scrolling_layer->TotalScrollOffset()); |
| 6675 |
| 6676 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(50)); |
| 6677 host_impl_->UpdateAnimationState(true); |
| 6678 |
| 6679 float y = scrolling_layer->TotalScrollOffset().y(); |
| 6680 EXPECT_TRUE(y > 1 && y < 49); |
| 6681 |
| 6682 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); |
| 6683 host_impl_->UpdateAnimationState(true); |
| 6684 |
| 6685 EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset()); |
| 6686 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
| 6687 } |
| 6688 |
6658 } // namespace | 6689 } // namespace |
6659 } // namespace cc | 6690 } // namespace cc |
OLD | NEW |