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

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

Issue 2550933002: Make all LayerAnimationElement::Create*Element return unique_ptr (Closed)
Patch Set: Make all LayerAnimationElement::Create*Element return unique_ptr 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_animator.h" 5 #include "ui/compositor/layer_animator.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 26 matching lines...) Expand all
37 // space and the order if A R G B. 37 // space and the order if A R G B.
38 std::string ColorToString(SkColor color) { 38 std::string ColorToString(SkColor color) {
39 return base::StringPrintf("%d %d %d %d", SkColorGetA(color), 39 return base::StringPrintf("%d %d %d %d", SkColorGetA(color),
40 SkColorGetR(color), SkColorGetG(color), 40 SkColorGetR(color), SkColorGetG(color),
41 SkColorGetB(color)); 41 SkColorGetB(color));
42 } 42 }
43 43
44 // Creates vector with two LayerAnimationSequences, based on |first| and 44 // Creates vector with two LayerAnimationSequences, based on |first| and
45 // |second| layer animation elements. 45 // |second| layer animation elements.
46 std::vector<LayerAnimationSequence*> CreateMultiSequence( 46 std::vector<LayerAnimationSequence*> CreateMultiSequence(
47 LayerAnimationElement* first, 47 std::unique_ptr<LayerAnimationElement> first,
48 LayerAnimationElement* second) { 48 std::unique_ptr<LayerAnimationElement> second) {
49 LayerAnimationSequence* first_sequence = new LayerAnimationSequence(); 49 LayerAnimationSequence* first_sequence = new LayerAnimationSequence();
50 first_sequence->AddElement(first); 50 first_sequence->AddElement(std::move(first));
51 LayerAnimationSequence* second_sequence = new LayerAnimationSequence(); 51 LayerAnimationSequence* second_sequence = new LayerAnimationSequence();
52 second_sequence->AddElement(second); 52 second_sequence->AddElement(std::move(second));
53 53
54 std::vector<ui::LayerAnimationSequence*> animations; 54 std::vector<ui::LayerAnimationSequence*> animations;
55 animations.push_back(first_sequence); 55 animations.push_back(first_sequence);
56 animations.push_back(second_sequence); 56 animations.push_back(second_sequence);
57 return animations; 57 return animations;
58 } 58 }
59 59
60 // Creates a default animator with timers disabled for test. |delegate| and 60 // Creates a default animator with timers disabled for test. |delegate| and
61 // |observer| are attached if non-null. 61 // |observer| are attached if non-null.
62 LayerAnimator* CreateDefaultTestAnimator(LayerAnimationDelegate* delegate, 62 LayerAnimator* CreateDefaultTestAnimator(LayerAnimationDelegate* delegate,
(...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after
2945 EXPECT_EQ(observer.last_ended_sequence(), nullptr); 2945 EXPECT_EQ(observer.last_ended_sequence(), nullptr);
2946 EXPECT_EQ(observer.last_detached_sequence(), first_sequence); 2946 EXPECT_EQ(observer.last_detached_sequence(), first_sequence);
2947 2947
2948 EXPECT_TRUE(observer.AbortedEpochIsBeforeDetachedEpoch()); 2948 EXPECT_TRUE(observer.AbortedEpochIsBeforeDetachedEpoch());
2949 EXPECT_TRUE(observer.AbortedEpochIsBeforeStartedEpoch()); 2949 EXPECT_TRUE(observer.AbortedEpochIsBeforeStartedEpoch());
2950 EXPECT_TRUE(observer.AttachedEpochIsBeforeScheduledEpoch()); 2950 EXPECT_TRUE(observer.AttachedEpochIsBeforeScheduledEpoch());
2951 EXPECT_TRUE(observer.ScheduledEpochIsBeforeStartedEpoch()); 2951 EXPECT_TRUE(observer.ScheduledEpochIsBeforeStartedEpoch());
2952 } 2952 }
2953 2953
2954 } // namespace ui 2954 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698