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

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

Issue 1698813002: CC Animation: Expose TargetProperty enum to be aliased in Blink Platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use custom hash in unordered_set. Created 4 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 if (settings().use_compositor_animation_timelines) { 1558 if (settings().use_compositor_animation_timelines) {
1559 int animation_id = AddAnimatedTransformToLayerWithPlayer( 1559 int animation_id = AddAnimatedTransformToLayerWithPlayer(
1560 impl_layer->id(), timeline_impl(), 1.0, 0, 100); 1560 impl_layer->id(), timeline_impl(), 1.0, 0, 100);
1561 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(), 1561 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(),
1562 animation_id) 1562 animation_id)
1563 ->set_is_impl_only(true); 1563 ->set_is_impl_only(true);
1564 } else { 1564 } else {
1565 AddAnimatedTransformToController(impl_layer->layer_animation_controller(), 1565 AddAnimatedTransformToController(impl_layer->layer_animation_controller(),
1566 1.0, 0, 100); 1566 1.0, 0, 100);
1567 impl_layer->layer_animation_controller() 1567 impl_layer->layer_animation_controller()
1568 ->GetAnimation(Animation::TRANSFORM) 1568 ->GetAnimation(AnimationTargetProperty::TRANSFORM)
1569 ->set_is_impl_only(true); 1569 ->set_is_impl_only(true);
1570 } 1570 }
1571 transform.Rotate(45.0); 1571 transform.Rotate(45.0);
1572 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(transform)); 1572 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(transform));
1573 1573
1574 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 1574 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
1575 test_layer->PushPropertiesTo(impl_layer.get()); 1575 test_layer->PushPropertiesTo(impl_layer.get());
1576 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 1576 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
1577 } 1577 }
1578 1578
(...skipping 29 matching lines...) Expand all
1608 if (settings().use_compositor_animation_timelines) { 1608 if (settings().use_compositor_animation_timelines) {
1609 int animation_id = AddOpacityTransitionToLayerWithPlayer( 1609 int animation_id = AddOpacityTransitionToLayerWithPlayer(
1610 impl_layer->id(), timeline_impl(), 1.0, 0.3f, 0.7f, false); 1610 impl_layer->id(), timeline_impl(), 1.0, 0.3f, 0.7f, false);
1611 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(), 1611 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(),
1612 animation_id) 1612 animation_id)
1613 ->set_is_impl_only(true); 1613 ->set_is_impl_only(true);
1614 } else { 1614 } else {
1615 AddOpacityTransitionToController(impl_layer->layer_animation_controller(), 1615 AddOpacityTransitionToController(impl_layer->layer_animation_controller(),
1616 1.0, 0.3f, 0.7f, false); 1616 1.0, 0.3f, 0.7f, false);
1617 impl_layer->layer_animation_controller() 1617 impl_layer->layer_animation_controller()
1618 ->GetAnimation(Animation::OPACITY) 1618 ->GetAnimation(AnimationTargetProperty::OPACITY)
1619 ->set_is_impl_only(true); 1619 ->set_is_impl_only(true);
1620 } 1620 }
1621 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.75f)); 1621 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.75f));
1622 1622
1623 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 1623 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
1624 test_layer->PushPropertiesTo(impl_layer.get()); 1624 test_layer->PushPropertiesTo(impl_layer.get());
1625 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 1625 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
1626 } 1626 }
1627 1627
1628 TEST_F(LayerTest, 1628 TEST_F(LayerTest,
(...skipping 30 matching lines...) Expand all
1659 if (settings().use_compositor_animation_timelines) { 1659 if (settings().use_compositor_animation_timelines) {
1660 int animation_id = AddAnimatedFilterToLayerWithPlayer( 1660 int animation_id = AddAnimatedFilterToLayerWithPlayer(
1661 impl_layer->id(), timeline_impl(), 1.0, 1.f, 2.f); 1661 impl_layer->id(), timeline_impl(), 1.0, 1.f, 2.f);
1662 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(), 1662 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(),
1663 animation_id) 1663 animation_id)
1664 ->set_is_impl_only(true); 1664 ->set_is_impl_only(true);
1665 } else { 1665 } else {
1666 AddAnimatedFilterToController(impl_layer->layer_animation_controller(), 1.0, 1666 AddAnimatedFilterToController(impl_layer->layer_animation_controller(), 1.0,
1667 1.f, 2.f); 1667 1.f, 2.f);
1668 impl_layer->layer_animation_controller() 1668 impl_layer->layer_animation_controller()
1669 ->GetAnimation(Animation::FILTER) 1669 ->GetAnimation(AnimationTargetProperty::FILTER)
1670 ->set_is_impl_only(true); 1670 ->set_is_impl_only(true);
1671 } 1671 }
1672 filters.Append(FilterOperation::CreateSepiaFilter(0.5f)); 1672 filters.Append(FilterOperation::CreateSepiaFilter(0.5f));
1673 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters)); 1673 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters));
1674 1674
1675 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 1675 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
1676 test_layer->PushPropertiesTo(impl_layer.get()); 1676 test_layer->PushPropertiesTo(impl_layer.get());
1677 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 1677 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
1678 } 1678 }
1679 1679
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(); 1992 scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create();
1993 layer_tree_host->SetRootLayer(root); 1993 layer_tree_host->SetRootLayer(root);
1994 } 1994 }
1995 1995
1996 static bool AddTestAnimation(Layer* layer) { 1996 static bool AddTestAnimation(Layer* layer) {
1997 scoped_ptr<KeyframedFloatAnimationCurve> curve = 1997 scoped_ptr<KeyframedFloatAnimationCurve> curve =
1998 KeyframedFloatAnimationCurve::Create(); 1998 KeyframedFloatAnimationCurve::Create();
1999 curve->AddKeyframe(FloatKeyframe::Create(base::TimeDelta(), 0.3f, nullptr)); 1999 curve->AddKeyframe(FloatKeyframe::Create(base::TimeDelta(), 0.3f, nullptr));
2000 curve->AddKeyframe( 2000 curve->AddKeyframe(
2001 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.7f, nullptr)); 2001 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.7f, nullptr));
2002 scoped_ptr<Animation> animation = 2002 scoped_ptr<Animation> animation = Animation::Create(
2003 Animation::Create(std::move(curve), 0, 0, Animation::OPACITY); 2003 std::move(curve), 0, 0, AnimationTargetProperty::OPACITY);
2004 2004
2005 return layer->AddAnimation(std::move(animation)); 2005 return layer->AddAnimation(std::move(animation));
2006 } 2006 }
2007 2007
2008 TEST_F(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { 2008 TEST_F(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) {
2009 // This tests isn't needed in new use_compositor_animation_timelines mode. 2009 // This tests isn't needed in new use_compositor_animation_timelines mode.
2010 if (layer_settings_.use_compositor_animation_timelines) 2010 if (layer_settings_.use_compositor_animation_timelines)
2011 return; 2011 return;
2012 2012
2013 scoped_refptr<Layer> layer = Layer::Create(layer_settings_); 2013 scoped_refptr<Layer> layer = Layer::Create(layer_settings_);
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2618 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); 2618 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties());
2619 2619
2620 test_layer->PushPropertiesTo(impl_layer.get()); 2620 test_layer->PushPropertiesTo(impl_layer.get());
2621 2621
2622 EXPECT_EQ(2lu, impl_layer->element_id()); 2622 EXPECT_EQ(2lu, impl_layer->element_id());
2623 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); 2623 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties());
2624 } 2624 }
2625 2625
2626 } // namespace 2626 } // namespace
2627 } // namespace cc 2627 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698