Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: cc/layers/layer_unittest.cc

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/picture_image_layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include "cc/animation/keyframed_animation_curve.h" 7 #include "cc/animation/keyframed_animation_curve.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/layers/layer_impl.h" 9 #include "cc/layers/layer_impl.h"
10 #include "cc/resources/layer_painter.h" 10 #include "cc/resources/layer_painter.h"
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 731
732 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 732 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
733 test_layer->PushPropertiesTo(impl_layer.get()); 733 test_layer->PushPropertiesTo(impl_layer.get());
734 EXPECT_TRUE(impl_layer->LayerPropertyChanged()); 734 EXPECT_TRUE(impl_layer->LayerPropertyChanged());
735 735
736 impl_layer->ResetAllChangeTrackingForSubtree(); 736 impl_layer->ResetAllChangeTrackingForSubtree();
737 AddAnimatedTransformToController(impl_layer->layer_animation_controller(), 737 AddAnimatedTransformToController(impl_layer->layer_animation_controller(),
738 1.0, 738 1.0,
739 0, 739 0,
740 100); 740 100);
741 impl_layer->layer_animation_controller()->GetAnimation(Animation::Transform)-> 741 impl_layer->layer_animation_controller()
742 set_is_impl_only(true); 742 ->GetAnimation(Animation::TRANSFORM)
743 ->set_is_impl_only(true);
743 transform.Rotate(45.0); 744 transform.Rotate(45.0);
744 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(transform)); 745 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(transform));
745 746
746 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 747 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
747 test_layer->PushPropertiesTo(impl_layer.get()); 748 test_layer->PushPropertiesTo(impl_layer.get());
748 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 749 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
749 } 750 }
750 751
751 TEST_F(LayerTest, 752 TEST_F(LayerTest,
752 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyOpacityAnim) { 753 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyOpacityAnim) {
(...skipping 19 matching lines...) Expand all
772 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 773 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
773 test_layer->PushPropertiesTo(impl_layer.get()); 774 test_layer->PushPropertiesTo(impl_layer.get());
774 EXPECT_TRUE(impl_layer->LayerPropertyChanged()); 775 EXPECT_TRUE(impl_layer->LayerPropertyChanged());
775 776
776 impl_layer->ResetAllChangeTrackingForSubtree(); 777 impl_layer->ResetAllChangeTrackingForSubtree();
777 AddOpacityTransitionToController(impl_layer->layer_animation_controller(), 778 AddOpacityTransitionToController(impl_layer->layer_animation_controller(),
778 1.0, 779 1.0,
779 0.3f, 780 0.3f,
780 0.7f, 781 0.7f,
781 false); 782 false);
782 impl_layer->layer_animation_controller()->GetAnimation(Animation::Opacity)-> 783 impl_layer->layer_animation_controller()
783 set_is_impl_only(true); 784 ->GetAnimation(Animation::OPACITY)
785 ->set_is_impl_only(true);
784 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.75f)); 786 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.75f));
785 787
786 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 788 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
787 test_layer->PushPropertiesTo(impl_layer.get()); 789 test_layer->PushPropertiesTo(impl_layer.get());
788 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 790 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
789 } 791 }
790 792
791 TEST_F(LayerTest, 793 TEST_F(LayerTest,
792 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyFilterAnim) { 794 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyFilterAnim) {
793 scoped_refptr<Layer> test_layer = Layer::Create(); 795 scoped_refptr<Layer> test_layer = Layer::Create();
(...skipping 14 matching lines...) Expand all
808 filters.Append(FilterOperation::CreateBlurFilter(2.f)); 810 filters.Append(FilterOperation::CreateBlurFilter(2.f));
809 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters)); 811 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters));
810 812
811 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 813 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
812 test_layer->PushPropertiesTo(impl_layer.get()); 814 test_layer->PushPropertiesTo(impl_layer.get());
813 EXPECT_TRUE(impl_layer->LayerPropertyChanged()); 815 EXPECT_TRUE(impl_layer->LayerPropertyChanged());
814 816
815 impl_layer->ResetAllChangeTrackingForSubtree(); 817 impl_layer->ResetAllChangeTrackingForSubtree();
816 AddAnimatedFilterToController( 818 AddAnimatedFilterToController(
817 impl_layer->layer_animation_controller(), 1.0, 1.f, 2.f); 819 impl_layer->layer_animation_controller(), 1.0, 1.f, 2.f);
818 impl_layer->layer_animation_controller()->GetAnimation(Animation::Filter)-> 820 impl_layer->layer_animation_controller()
819 set_is_impl_only(true); 821 ->GetAnimation(Animation::FILTER)
822 ->set_is_impl_only(true);
820 filters.Append(FilterOperation::CreateSepiaFilter(0.5f)); 823 filters.Append(FilterOperation::CreateSepiaFilter(0.5f));
821 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters)); 824 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters));
822 825
823 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 826 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
824 test_layer->PushPropertiesTo(impl_layer.get()); 827 test_layer->PushPropertiesTo(impl_layer.get());
825 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 828 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
826 } 829 }
827 830
828 TEST_F(LayerTest, MaskAndReplicaHasParent) { 831 TEST_F(LayerTest, MaskAndReplicaHasParent) {
829 scoped_refptr<Layer> parent = Layer::Create(); 832 scoped_refptr<Layer> parent = Layer::Create();
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 layer_tree_host->SetRootLayer(root); 1144 layer_tree_host->SetRootLayer(root);
1142 } 1145 }
1143 1146
1144 static bool AddTestAnimation(Layer* layer) { 1147 static bool AddTestAnimation(Layer* layer) {
1145 scoped_ptr<KeyframedFloatAnimationCurve> curve = 1148 scoped_ptr<KeyframedFloatAnimationCurve> curve =
1146 KeyframedFloatAnimationCurve::Create(); 1149 KeyframedFloatAnimationCurve::Create();
1147 curve->AddKeyframe(FloatKeyframe::Create(base::TimeDelta(), 0.3f, nullptr)); 1150 curve->AddKeyframe(FloatKeyframe::Create(base::TimeDelta(), 0.3f, nullptr));
1148 curve->AddKeyframe( 1151 curve->AddKeyframe(
1149 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.7f, nullptr)); 1152 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.7f, nullptr));
1150 scoped_ptr<Animation> animation = 1153 scoped_ptr<Animation> animation =
1151 Animation::Create(curve.Pass(), 0, 0, Animation::Opacity); 1154 Animation::Create(curve.Pass(), 0, 0, Animation::OPACITY);
1152 1155
1153 return layer->AddAnimation(animation.Pass()); 1156 return layer->AddAnimation(animation.Pass());
1154 } 1157 }
1155 1158
1156 TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { 1159 TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) {
1157 scoped_refptr<Layer> layer = Layer::Create(); 1160 scoped_refptr<Layer> layer = Layer::Create();
1158 1161
1159 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the 1162 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the
1160 // animation should not be accepted. 1163 // animation should not be accepted.
1161 EXPECT_FALSE(AddTestAnimation(layer.get())); 1164 EXPECT_FALSE(AddTestAnimation(layer.get()));
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 root_layer->AddChild(becomes_not_draws_content); 1252 root_layer->AddChild(becomes_not_draws_content);
1250 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent()); 1253 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent());
1251 1254
1252 becomes_draws_content->SetIsDrawable(true); 1255 becomes_draws_content->SetIsDrawable(true);
1253 root_layer->AddChild(becomes_draws_content); 1256 root_layer->AddChild(becomes_draws_content);
1254 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent()); 1257 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent());
1255 } 1258 }
1256 1259
1257 } // namespace 1260 } // namespace
1258 } // namespace cc 1261 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/picture_image_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698