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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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() 741 impl_layer->layer_animation_controller()->GetAnimation(Animation::Transform)->
742 ->GetAnimation(Animation::TRANSFORM) 742 set_is_impl_only(true);
743 ->set_is_impl_only(true);
744 transform.Rotate(45.0); 743 transform.Rotate(45.0);
745 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(transform)); 744 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(transform));
746 745
747 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 746 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
748 test_layer->PushPropertiesTo(impl_layer.get()); 747 test_layer->PushPropertiesTo(impl_layer.get());
749 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 748 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
750 } 749 }
751 750
752 TEST_F(LayerTest, 751 TEST_F(LayerTest,
753 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyOpacityAnim) { 752 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyOpacityAnim) {
(...skipping 19 matching lines...) Expand all
773 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 772 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
774 test_layer->PushPropertiesTo(impl_layer.get()); 773 test_layer->PushPropertiesTo(impl_layer.get());
775 EXPECT_TRUE(impl_layer->LayerPropertyChanged()); 774 EXPECT_TRUE(impl_layer->LayerPropertyChanged());
776 775
777 impl_layer->ResetAllChangeTrackingForSubtree(); 776 impl_layer->ResetAllChangeTrackingForSubtree();
778 AddOpacityTransitionToController(impl_layer->layer_animation_controller(), 777 AddOpacityTransitionToController(impl_layer->layer_animation_controller(),
779 1.0, 778 1.0,
780 0.3f, 779 0.3f,
781 0.7f, 780 0.7f,
782 false); 781 false);
783 impl_layer->layer_animation_controller() 782 impl_layer->layer_animation_controller()->GetAnimation(Animation::Opacity)->
784 ->GetAnimation(Animation::OPACITY) 783 set_is_impl_only(true);
785 ->set_is_impl_only(true);
786 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.75f)); 784 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.75f));
787 785
788 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 786 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
789 test_layer->PushPropertiesTo(impl_layer.get()); 787 test_layer->PushPropertiesTo(impl_layer.get());
790 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 788 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
791 } 789 }
792 790
793 TEST_F(LayerTest, 791 TEST_F(LayerTest,
794 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyFilterAnim) { 792 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyFilterAnim) {
795 scoped_refptr<Layer> test_layer = Layer::Create(); 793 scoped_refptr<Layer> test_layer = Layer::Create();
(...skipping 14 matching lines...) Expand all
810 filters.Append(FilterOperation::CreateBlurFilter(2.f)); 808 filters.Append(FilterOperation::CreateBlurFilter(2.f));
811 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters)); 809 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters));
812 810
813 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 811 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
814 test_layer->PushPropertiesTo(impl_layer.get()); 812 test_layer->PushPropertiesTo(impl_layer.get());
815 EXPECT_TRUE(impl_layer->LayerPropertyChanged()); 813 EXPECT_TRUE(impl_layer->LayerPropertyChanged());
816 814
817 impl_layer->ResetAllChangeTrackingForSubtree(); 815 impl_layer->ResetAllChangeTrackingForSubtree();
818 AddAnimatedFilterToController( 816 AddAnimatedFilterToController(
819 impl_layer->layer_animation_controller(), 1.0, 1.f, 2.f); 817 impl_layer->layer_animation_controller(), 1.0, 1.f, 2.f);
820 impl_layer->layer_animation_controller() 818 impl_layer->layer_animation_controller()->GetAnimation(Animation::Filter)->
821 ->GetAnimation(Animation::FILTER) 819 set_is_impl_only(true);
822 ->set_is_impl_only(true);
823 filters.Append(FilterOperation::CreateSepiaFilter(0.5f)); 820 filters.Append(FilterOperation::CreateSepiaFilter(0.5f));
824 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters)); 821 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters));
825 822
826 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 823 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
827 test_layer->PushPropertiesTo(impl_layer.get()); 824 test_layer->PushPropertiesTo(impl_layer.get());
828 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 825 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
829 } 826 }
830 827
831 TEST_F(LayerTest, MaskAndReplicaHasParent) { 828 TEST_F(LayerTest, MaskAndReplicaHasParent) {
832 scoped_refptr<Layer> parent = Layer::Create(); 829 scoped_refptr<Layer> parent = Layer::Create();
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 layer_tree_host->SetRootLayer(root); 1141 layer_tree_host->SetRootLayer(root);
1145 } 1142 }
1146 1143
1147 static bool AddTestAnimation(Layer* layer) { 1144 static bool AddTestAnimation(Layer* layer) {
1148 scoped_ptr<KeyframedFloatAnimationCurve> curve = 1145 scoped_ptr<KeyframedFloatAnimationCurve> curve =
1149 KeyframedFloatAnimationCurve::Create(); 1146 KeyframedFloatAnimationCurve::Create();
1150 curve->AddKeyframe(FloatKeyframe::Create(base::TimeDelta(), 0.3f, nullptr)); 1147 curve->AddKeyframe(FloatKeyframe::Create(base::TimeDelta(), 0.3f, nullptr));
1151 curve->AddKeyframe( 1148 curve->AddKeyframe(
1152 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.7f, nullptr)); 1149 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.7f, nullptr));
1153 scoped_ptr<Animation> animation = 1150 scoped_ptr<Animation> animation =
1154 Animation::Create(curve.Pass(), 0, 0, Animation::OPACITY); 1151 Animation::Create(curve.Pass(), 0, 0, Animation::Opacity);
1155 1152
1156 return layer->AddAnimation(animation.Pass()); 1153 return layer->AddAnimation(animation.Pass());
1157 } 1154 }
1158 1155
1159 TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { 1156 TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) {
1160 scoped_refptr<Layer> layer = Layer::Create(); 1157 scoped_refptr<Layer> layer = Layer::Create();
1161 1158
1162 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the 1159 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the
1163 // animation should not be accepted. 1160 // animation should not be accepted.
1164 EXPECT_FALSE(AddTestAnimation(layer.get())); 1161 EXPECT_FALSE(AddTestAnimation(layer.get()));
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 root_layer->AddChild(becomes_not_draws_content); 1249 root_layer->AddChild(becomes_not_draws_content);
1253 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent()); 1250 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent());
1254 1251
1255 becomes_draws_content->SetIsDrawable(true); 1252 becomes_draws_content->SetIsDrawable(true);
1256 root_layer->AddChild(becomes_draws_content); 1253 root_layer->AddChild(becomes_draws_content);
1257 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent()); 1254 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent());
1258 } 1255 }
1259 1256
1260 } // namespace 1257 } // namespace
1261 } // namespace cc 1258 } // 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