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

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

Issue 1700653002: CC Animation: Expose TargetProperty enum to be aliased in Blink Platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/test/animation_test_common.h » ('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 <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 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 if (settings().use_compositor_animation_timelines) { 1701 if (settings().use_compositor_animation_timelines) {
1702 int animation_id = AddOpacityTransitionToLayerWithPlayer( 1702 int animation_id = AddOpacityTransitionToLayerWithPlayer(
1703 impl_layer->id(), timeline_impl(), 1.0, 0.3f, 0.7f, false); 1703 impl_layer->id(), timeline_impl(), 1.0, 0.3f, 0.7f, false);
1704 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(), 1704 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(),
1705 animation_id) 1705 animation_id)
1706 ->set_is_impl_only(true); 1706 ->set_is_impl_only(true);
1707 } else { 1707 } else {
1708 AddOpacityTransitionToController(impl_layer->layer_animation_controller(), 1708 AddOpacityTransitionToController(impl_layer->layer_animation_controller(),
1709 1.0, 0.3f, 0.7f, false); 1709 1.0, 0.3f, 0.7f, false);
1710 impl_layer->layer_animation_controller() 1710 impl_layer->layer_animation_controller()
1711 ->GetAnimation(Animation::OPACITY) 1711 ->GetAnimation(TargetProperty::OPACITY)
1712 ->set_is_impl_only(true); 1712 ->set_is_impl_only(true);
1713 } 1713 }
1714 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.75f)); 1714 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.75f));
1715 1715
1716 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 1716 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
1717 test_layer->PushPropertiesTo(impl_layer.get()); 1717 test_layer->PushPropertiesTo(impl_layer.get());
1718 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 1718 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
1719 } 1719 }
1720 1720
1721 TEST_F(LayerTest, 1721 TEST_F(LayerTest,
(...skipping 30 matching lines...) Expand all
1752 if (settings().use_compositor_animation_timelines) { 1752 if (settings().use_compositor_animation_timelines) {
1753 int animation_id = AddAnimatedFilterToLayerWithPlayer( 1753 int animation_id = AddAnimatedFilterToLayerWithPlayer(
1754 impl_layer->id(), timeline_impl(), 1.0, 1.f, 2.f); 1754 impl_layer->id(), timeline_impl(), 1.0, 1.f, 2.f);
1755 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(), 1755 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(),
1756 animation_id) 1756 animation_id)
1757 ->set_is_impl_only(true); 1757 ->set_is_impl_only(true);
1758 } else { 1758 } else {
1759 AddAnimatedFilterToController(impl_layer->layer_animation_controller(), 1.0, 1759 AddAnimatedFilterToController(impl_layer->layer_animation_controller(), 1.0,
1760 1.f, 2.f); 1760 1.f, 2.f);
1761 impl_layer->layer_animation_controller() 1761 impl_layer->layer_animation_controller()
1762 ->GetAnimation(Animation::FILTER) 1762 ->GetAnimation(TargetProperty::FILTER)
1763 ->set_is_impl_only(true); 1763 ->set_is_impl_only(true);
1764 } 1764 }
1765 filters.Append(FilterOperation::CreateSepiaFilter(0.5f)); 1765 filters.Append(FilterOperation::CreateSepiaFilter(0.5f));
1766 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters)); 1766 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFilters(filters));
1767 1767
1768 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 1768 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
1769 test_layer->PushPropertiesTo(impl_layer.get()); 1769 test_layer->PushPropertiesTo(impl_layer.get());
1770 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); 1770 EXPECT_FALSE(impl_layer->LayerPropertyChanged());
1771 } 1771 }
1772 1772
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2086 layer_tree_host->SetRootLayer(root); 2086 layer_tree_host->SetRootLayer(root);
2087 } 2087 }
2088 2088
2089 static bool AddTestAnimation(Layer* layer) { 2089 static bool AddTestAnimation(Layer* layer) {
2090 scoped_ptr<KeyframedFloatAnimationCurve> curve = 2090 scoped_ptr<KeyframedFloatAnimationCurve> curve =
2091 KeyframedFloatAnimationCurve::Create(); 2091 KeyframedFloatAnimationCurve::Create();
2092 curve->AddKeyframe(FloatKeyframe::Create(base::TimeDelta(), 0.3f, nullptr)); 2092 curve->AddKeyframe(FloatKeyframe::Create(base::TimeDelta(), 0.3f, nullptr));
2093 curve->AddKeyframe( 2093 curve->AddKeyframe(
2094 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.7f, nullptr)); 2094 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.7f, nullptr));
2095 scoped_ptr<Animation> animation = 2095 scoped_ptr<Animation> animation =
2096 Animation::Create(std::move(curve), 0, 0, Animation::OPACITY); 2096 Animation::Create(std::move(curve), 0, 0, TargetProperty::OPACITY);
2097 2097
2098 return layer->AddAnimation(std::move(animation)); 2098 return layer->AddAnimation(std::move(animation));
2099 } 2099 }
2100 2100
2101 TEST_F(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { 2101 TEST_F(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) {
2102 // This tests isn't needed in new use_compositor_animation_timelines mode. 2102 // This tests isn't needed in new use_compositor_animation_timelines mode.
2103 if (layer_settings_.use_compositor_animation_timelines) 2103 if (layer_settings_.use_compositor_animation_timelines)
2104 return; 2104 return;
2105 2105
2106 scoped_refptr<Layer> layer = Layer::Create(layer_settings_); 2106 scoped_refptr<Layer> layer = Layer::Create(layer_settings_);
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
2729 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); 2729 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties());
2730 2730
2731 test_layer->PushPropertiesTo(impl_layer.get()); 2731 test_layer->PushPropertiesTo(impl_layer.get());
2732 2732
2733 EXPECT_EQ(2lu, impl_layer->element_id()); 2733 EXPECT_EQ(2lu, impl_layer->element_id());
2734 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); 2734 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties());
2735 } 2735 }
2736 2736
2737 } // namespace 2737 } // namespace
2738 } // namespace cc 2738 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/test/animation_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698