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 6584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6595 external_transform.Translate(20, 20); | 6595 external_transform.Translate(20, 20); |
6596 host_impl_->SetExternalDrawConstraints(external_transform, | 6596 host_impl_->SetExternalDrawConstraints(external_transform, |
6597 external_viewport, | 6597 external_viewport, |
6598 external_clip, | 6598 external_clip, |
6599 valid_for_tile_management); | 6599 valid_for_tile_management); |
6600 DrawFrame(); | 6600 DrawFrame(); |
6601 EXPECT_TRANSFORMATION_MATRIX_EQ( | 6601 EXPECT_TRANSFORMATION_MATRIX_EQ( |
6602 external_transform, layer->draw_properties().target_space_transform); | 6602 external_transform, layer->draw_properties().target_space_transform); |
6603 } | 6603 } |
6604 | 6604 |
| 6605 TEST_F(LayerTreeHostImplTest, ScrollAnimated) { |
| 6606 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 6607 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
| 6608 DrawFrame(); |
| 6609 |
| 6610 base::TimeTicks start_time = |
| 6611 base::TimeTicks() + base::TimeDelta::FromMilliseconds(100); |
| 6612 |
| 6613 EXPECT_EQ(InputHandler::ScrollStarted, |
| 6614 host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50))); |
| 6615 |
| 6616 LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer(); |
| 6617 |
| 6618 host_impl_->Animate(start_time); |
| 6619 host_impl_->UpdateAnimationState(true); |
| 6620 |
| 6621 EXPECT_EQ(gfx::Vector2dF(), scrolling_layer->TotalScrollOffset()); |
| 6622 |
| 6623 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(50)); |
| 6624 host_impl_->UpdateAnimationState(true); |
| 6625 |
| 6626 float y = scrolling_layer->TotalScrollOffset().y(); |
| 6627 EXPECT_TRUE(y > 1 && y < 49); |
| 6628 |
| 6629 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); |
| 6630 host_impl_->UpdateAnimationState(true); |
| 6631 |
| 6632 EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset()); |
| 6633 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
| 6634 } |
| 6635 |
6605 } // namespace | 6636 } // namespace |
6606 } // namespace cc | 6637 } // namespace cc |
OLD | NEW |