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