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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.h" |
8 #include "cc/animation/layer_animation_controller.h" | 8 #include "cc/animation/layer_animation_controller.h" |
9 #include "cc/animation/scroll_offset_animation_curve.h" | 9 #include "cc/animation/scroll_offset_animation_curve.h" |
10 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 void AfterTest() override {} | 1028 void AfterTest() override {} |
1029 | 1029 |
1030 private: | 1030 private: |
1031 scoped_refptr<Layer> layer_; | 1031 scoped_refptr<Layer> layer_; |
1032 int num_swap_buffers_; | 1032 int num_swap_buffers_; |
1033 }; | 1033 }; |
1034 | 1034 |
1035 SINGLE_AND_MULTI_THREAD_TEST_F( | 1035 SINGLE_AND_MULTI_THREAD_TEST_F( |
1036 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1036 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
1037 | 1037 |
| 1038 class LayerTreeHostAnimationTestNotifyAnimationFinished |
| 1039 : public LayerTreeHostAnimationTest { |
| 1040 public: |
| 1041 LayerTreeHostAnimationTestNotifyAnimationFinished() |
| 1042 : called_animation_started_(false), called_animation_finished_(false) {} |
| 1043 |
| 1044 void SetupTree() override { |
| 1045 LayerTreeHostAnimationTest::SetupTree(); |
| 1046 picture_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 1047 picture_->SetBounds(gfx::Size(4, 4)); |
| 1048 picture_->set_layer_animation_delegate(this); |
| 1049 layer_tree_host()->root_layer()->AddChild(picture_); |
| 1050 } |
| 1051 |
| 1052 void BeginTest() override { |
| 1053 layer_tree_host()->SetViewportSize(gfx::Size()); |
| 1054 PostAddLongAnimationToMainThread(picture_.get()); |
| 1055 } |
| 1056 |
| 1057 void NotifyAnimationStarted(base::TimeTicks monotonic_time, |
| 1058 Animation::TargetProperty target_property, |
| 1059 int group) override { |
| 1060 called_animation_started_ = true; |
| 1061 layer_tree_host()->AnimateLayers( |
| 1062 base::TimeTicks::FromInternalValue(std::numeric_limits<int64>::max())); |
| 1063 PostSetNeedsCommitToMainThread(); |
| 1064 } |
| 1065 |
| 1066 void NotifyAnimationFinished(base::TimeTicks monotonic_time, |
| 1067 Animation::TargetProperty target_property, |
| 1068 int group) override { |
| 1069 called_animation_finished_ = true; |
| 1070 EndTest(); |
| 1071 } |
| 1072 |
| 1073 void AfterTest() override { |
| 1074 EXPECT_TRUE(called_animation_started_); |
| 1075 EXPECT_TRUE(called_animation_finished_); |
| 1076 } |
| 1077 |
| 1078 private: |
| 1079 bool called_animation_started_; |
| 1080 bool called_animation_finished_; |
| 1081 FakeContentLayerClient client_; |
| 1082 scoped_refptr<FakePictureLayer> picture_; |
| 1083 }; |
| 1084 |
| 1085 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1086 LayerTreeHostAnimationTestNotifyAnimationFinished); |
| 1087 |
1038 } // namespace | 1088 } // namespace |
1039 } // namespace cc | 1089 } // namespace cc |
OLD | NEW |