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

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 2550933002: Make all LayerAnimationElement::Create*Element return unique_ptr (Closed)
Patch Set: Complete inclusion Created 4 years 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 (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 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 std::unique_ptr<Layer> child(CreateLayer(LAYER_TEXTURED)); 2155 std::unique_ptr<Layer> child(CreateLayer(LAYER_TEXTURED));
2156 root->Add(parent.get()); 2156 root->Add(parent.get());
2157 parent->Add(child.get()); 2157 parent->Add(child.get());
2158 compositor()->SetRootLayer(root.get()); 2158 compositor()->SetRootLayer(root.get());
2159 2159
2160 child->SetAnimator(LayerAnimator::CreateDefaultAnimator()); 2160 child->SetAnimator(LayerAnimator::CreateDefaultAnimator());
2161 2161
2162 LayerRemovingLayerAnimationObserver observer(root.get(), parent.get()); 2162 LayerRemovingLayerAnimationObserver observer(root.get(), parent.get());
2163 child->GetAnimator()->AddObserver(&observer); 2163 child->GetAnimator()->AddObserver(&observer);
2164 2164
2165 LayerAnimationElement* element = 2165 std::unique_ptr<LayerAnimationElement> element =
2166 ui::LayerAnimationElement::CreateOpacityElement( 2166 ui::LayerAnimationElement::CreateOpacityElement(
2167 0.5f, base::TimeDelta::FromSeconds(1)); 2167 0.5f, base::TimeDelta::FromSeconds(1));
2168 LayerAnimationSequence* sequence = new LayerAnimationSequence(element); 2168 LayerAnimationSequence* sequence =
2169 new LayerAnimationSequence(std::move(element));
2169 2170
2170 child->GetAnimator()->StartAnimation(sequence); 2171 child->GetAnimator()->StartAnimation(sequence);
2171 EXPECT_TRUE(compositor()->layer_animator_collection()->HasActiveAnimators()); 2172 EXPECT_TRUE(compositor()->layer_animator_collection()->HasActiveAnimators());
2172 2173
2173 child->GetAnimator()->StopAnimating(); 2174 child->GetAnimator()->StopAnimating();
2174 EXPECT_FALSE(root->Contains(parent.get())); 2175 EXPECT_FALSE(root->Contains(parent.get()));
2175 EXPECT_FALSE(compositor()->layer_animator_collection()->HasActiveAnimators()); 2176 EXPECT_FALSE(compositor()->layer_animator_collection()->HasActiveAnimators());
2176 } 2177 }
2177 2178
2178 namespace { 2179 namespace {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 layer.set_name("foo"); 2277 layer.set_name("foo");
2277 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = 2278 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info =
2278 layer.TakeDebugInfo(nullptr); 2279 layer.TakeDebugInfo(nullptr);
2279 std::string trace_format("bar,"); 2280 std::string trace_format("bar,");
2280 debug_info->AppendAsTraceFormat(&trace_format); 2281 debug_info->AppendAsTraceFormat(&trace_format);
2281 std::string expected("bar,{\"layer_name\":\"foo\"}"); 2282 std::string expected("bar,{\"layer_name\":\"foo\"}");
2282 EXPECT_EQ(expected, trace_format); 2283 EXPECT_EQ(expected, trace_format);
2283 } 2284 }
2284 2285
2285 } // namespace ui 2286 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698