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

Unified Diff: ui/compositor/layer_animator_unittest.cc

Issue 2550933002: Make all LayerAnimationElement::Create*Element return unique_ptr (Closed)
Patch Set: More change and typo fix 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 side-by-side diff with in-line comments
Download patch
Index: ui/compositor/layer_animator_unittest.cc
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc
index 51f883b4fd9121f24957b18cbb672c8f36da3476..fa4ab07d061fff4c73c011f9fecbab2d277b7112 100644
--- a/ui/compositor/layer_animator_unittest.cc
+++ b/ui/compositor/layer_animator_unittest.cc
@@ -44,12 +44,12 @@ std::string ColorToString(SkColor color) {
// Creates vector with two LayerAnimationSequences, based on |first| and
// |second| layer animation elements.
std::vector<LayerAnimationSequence*> CreateMultiSequence(
- LayerAnimationElement* first,
- LayerAnimationElement* second) {
+ std::unique_ptr<LayerAnimationElement> first,
+ std::unique_ptr<LayerAnimationElement> second) {
LayerAnimationSequence* first_sequence = new LayerAnimationSequence();
- first_sequence->AddElement(first);
+ first_sequence->AddElement(std::move(first));
LayerAnimationSequence* second_sequence = new LayerAnimationSequence();
- second_sequence->AddElement(second);
+ second_sequence->AddElement(std::move(second));
std::vector<ui::LayerAnimationSequence*> animations;
animations.push_back(first_sequence);
@@ -242,9 +242,9 @@ class TestLayerAnimator : public LayerAnimator {
// created and destroyed.
class TestLayerAnimationSequence : public LayerAnimationSequence {
public:
- TestLayerAnimationSequence(LayerAnimationElement* element,
+ TestLayerAnimationSequence(std::unique_ptr<LayerAnimationElement> element,
int* num_live_instances)
- : LayerAnimationSequence(element),
+ : LayerAnimationSequence(std::move(element)),
num_live_instances_(num_live_instances) {
(*num_live_instances_)++;
}
@@ -2106,8 +2106,9 @@ TEST(LayerAnimatorTest, SettingPropertyDuringAnAnimation) {
delegate.SetOpacityFromAnimation(start_opacity);
- std::unique_ptr<LayerAnimationSequence> sequence(new LayerAnimationSequence(
- LayerAnimationElement::CreateOpacityElement(target_opacity, delta)));
+ std::unique_ptr<LayerAnimationSequence> sequence =
+ base::MakeUnique<LayerAnimationSequence>(
+ LayerAnimationElement::CreateOpacityElement(target_opacity, delta));
animator->StartAnimation(sequence.release());
@@ -2140,10 +2141,10 @@ TEST(LayerAnimatorTest, ImmediatelySettingNewTargetDoesNotLeak) {
int num_live_instances = 0;
base::TimeDelta delta = base::TimeDelta::FromSeconds(1);
- std::unique_ptr<TestLayerAnimationSequence> sequence(
- new TestLayerAnimationSequence(
+ std::unique_ptr<TestLayerAnimationSequence> sequence =
+ base::MakeUnique<TestLayerAnimationSequence>(
LayerAnimationElement::CreateBoundsElement(target_bounds, delta),
- &num_live_instances));
+ &num_live_instances);
EXPECT_EQ(1, num_live_instances);

Powered by Google App Engine
This is Rietveld 408576698