| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 std::unique_ptr<Layer> child(CreateLayer(LAYER_TEXTURED)); | 2133 std::unique_ptr<Layer> child(CreateLayer(LAYER_TEXTURED)); |
| 2134 root->Add(parent.get()); | 2134 root->Add(parent.get()); |
| 2135 parent->Add(child.get()); | 2135 parent->Add(child.get()); |
| 2136 compositor()->SetRootLayer(root.get()); | 2136 compositor()->SetRootLayer(root.get()); |
| 2137 | 2137 |
| 2138 child->SetAnimator(LayerAnimator::CreateDefaultAnimator()); | 2138 child->SetAnimator(LayerAnimator::CreateDefaultAnimator()); |
| 2139 | 2139 |
| 2140 LayerRemovingLayerAnimationObserver observer(root.get(), parent.get()); | 2140 LayerRemovingLayerAnimationObserver observer(root.get(), parent.get()); |
| 2141 child->GetAnimator()->AddObserver(&observer); | 2141 child->GetAnimator()->AddObserver(&observer); |
| 2142 | 2142 |
| 2143 LayerAnimationElement* element = | 2143 std::unique_ptr<LayerAnimationElement> element = |
| 2144 ui::LayerAnimationElement::CreateOpacityElement( | 2144 ui::LayerAnimationElement::CreateOpacityElement( |
| 2145 0.5f, base::TimeDelta::FromSeconds(1)); | 2145 0.5f, base::TimeDelta::FromSeconds(1)); |
| 2146 LayerAnimationSequence* sequence = new LayerAnimationSequence(element); | 2146 LayerAnimationSequence* sequence = |
| 2147 new LayerAnimationSequence(std::move(element)); |
| 2147 | 2148 |
| 2148 child->GetAnimator()->StartAnimation(sequence); | 2149 child->GetAnimator()->StartAnimation(sequence); |
| 2149 EXPECT_TRUE(compositor()->layer_animator_collection()->HasActiveAnimators()); | 2150 EXPECT_TRUE(compositor()->layer_animator_collection()->HasActiveAnimators()); |
| 2150 | 2151 |
| 2151 child->GetAnimator()->StopAnimating(); | 2152 child->GetAnimator()->StopAnimating(); |
| 2152 EXPECT_FALSE(root->Contains(parent.get())); | 2153 EXPECT_FALSE(root->Contains(parent.get())); |
| 2153 EXPECT_FALSE(compositor()->layer_animator_collection()->HasActiveAnimators()); | 2154 EXPECT_FALSE(compositor()->layer_animator_collection()->HasActiveAnimators()); |
| 2154 } | 2155 } |
| 2155 | 2156 |
| 2156 namespace { | 2157 namespace { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2254 layer.set_name("foo"); | 2255 layer.set_name("foo"); |
| 2255 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = | 2256 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = |
| 2256 layer.TakeDebugInfo(nullptr); | 2257 layer.TakeDebugInfo(nullptr); |
| 2257 std::string trace_format("bar,"); | 2258 std::string trace_format("bar,"); |
| 2258 debug_info->AppendAsTraceFormat(&trace_format); | 2259 debug_info->AppendAsTraceFormat(&trace_format); |
| 2259 std::string expected("bar,{\"layer_name\":\"foo\"}"); | 2260 std::string expected("bar,{\"layer_name\":\"foo\"}"); |
| 2260 EXPECT_EQ(expected, trace_format); | 2261 EXPECT_EQ(expected, trace_format); |
| 2261 } | 2262 } |
| 2262 | 2263 |
| 2263 } // namespace ui | 2264 } // namespace ui |
| OLD | NEW |