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