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

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

Issue 623293004: replace OVERRIDE and FINAL with override and final in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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 | « ui/compositor/layer_animator_collection.h ('k') | ui/compositor/layer_unittest.cc » ('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 (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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 bool WasAnimationCompletedForProperty( 75 bool WasAnimationCompletedForProperty(
76 LayerAnimationElement::AnimatableProperty property) const { 76 LayerAnimationElement::AnimatableProperty property) const {
77 return ImplicitAnimationObserver::WasAnimationCompletedForProperty( 77 return ImplicitAnimationObserver::WasAnimationCompletedForProperty(
78 property); 78 property);
79 } 79 }
80 80
81 private: 81 private:
82 // ImplicitAnimationObserver implementation 82 // ImplicitAnimationObserver implementation
83 virtual void OnImplicitAnimationsCompleted() OVERRIDE { 83 virtual void OnImplicitAnimationsCompleted() override {
84 animations_completed_ = true; 84 animations_completed_ = true;
85 } 85 }
86 86
87 virtual bool RequiresNotificationWhenAnimatorDestroyed() const OVERRIDE { 87 virtual bool RequiresNotificationWhenAnimatorDestroyed() const override {
88 return notify_when_animator_destructed_; 88 return notify_when_animator_destructed_;
89 } 89 }
90 90
91 bool animations_completed_; 91 bool animations_completed_;
92 bool notify_when_animator_destructed_; 92 bool notify_when_animator_destructed_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(TestImplicitAnimationObserver); 94 DISALLOW_COPY_AND_ASSIGN(TestImplicitAnimationObserver);
95 }; 95 };
96 96
97 // When notified that an animation has ended, stops all other animations. 97 // When notified that an animation has ended, stops all other animations.
98 class DeletingLayerAnimationObserver : public LayerAnimationObserver { 98 class DeletingLayerAnimationObserver : public LayerAnimationObserver {
99 public: 99 public:
100 DeletingLayerAnimationObserver(LayerAnimator* animator) 100 DeletingLayerAnimationObserver(LayerAnimator* animator)
101 : animator_(animator) { 101 : animator_(animator) {
102 } 102 }
103 103
104 virtual void OnLayerAnimationEnded( 104 virtual void OnLayerAnimationEnded(
105 LayerAnimationSequence* sequence) OVERRIDE { 105 LayerAnimationSequence* sequence) override {
106 animator_->StopAnimating(); 106 animator_->StopAnimating();
107 } 107 }
108 108
109 virtual void OnLayerAnimationAborted( 109 virtual void OnLayerAnimationAborted(
110 LayerAnimationSequence* sequence) OVERRIDE { 110 LayerAnimationSequence* sequence) override {
111 animator_->StopAnimating(); 111 animator_->StopAnimating();
112 } 112 }
113 113
114 virtual void OnLayerAnimationScheduled( 114 virtual void OnLayerAnimationScheduled(
115 LayerAnimationSequence* sequence) OVERRIDE { 115 LayerAnimationSequence* sequence) override {
116 } 116 }
117 117
118 private: 118 private:
119 LayerAnimator* animator_; 119 LayerAnimator* animator_;
120 120
121 DISALLOW_COPY_AND_ASSIGN(DeletingLayerAnimationObserver); 121 DISALLOW_COPY_AND_ASSIGN(DeletingLayerAnimationObserver);
122 }; 122 };
123 123
124 class LayerAnimatorDestructionObserver { 124 class LayerAnimatorDestructionObserver {
125 public: 125 public:
(...skipping 25 matching lines...) Expand all
151 } 151 }
152 152
153 protected: 153 protected:
154 virtual ~TestLayerAnimator() { 154 virtual ~TestLayerAnimator() {
155 if (destruction_observer_) { 155 if (destruction_observer_) {
156 destruction_observer_->NotifyAnimatorDeleted(); 156 destruction_observer_->NotifyAnimatorDeleted();
157 } 157 }
158 } 158 }
159 159
160 virtual void ProgressAnimation(LayerAnimationSequence* sequence, 160 virtual void ProgressAnimation(LayerAnimationSequence* sequence,
161 base::TimeTicks now) OVERRIDE { 161 base::TimeTicks now) override {
162 EXPECT_TRUE(HasAnimation(sequence)); 162 EXPECT_TRUE(HasAnimation(sequence));
163 LayerAnimator::ProgressAnimation(sequence, now); 163 LayerAnimator::ProgressAnimation(sequence, now);
164 } 164 }
165 165
166 private: 166 private:
167 LayerAnimatorDestructionObserver* destruction_observer_; 167 LayerAnimatorDestructionObserver* destruction_observer_;
168 168
169 DISALLOW_COPY_AND_ASSIGN(TestLayerAnimator); 169 DISALLOW_COPY_AND_ASSIGN(TestLayerAnimator);
170 }; 170 };
171 171
(...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 // callback triggered by the animation progress. 1941 // callback triggered by the animation progress.
1942 TEST(LayerAnimatorTest, CallbackDeletesAnimationInProgress) { 1942 TEST(LayerAnimatorTest, CallbackDeletesAnimationInProgress) {
1943 1943
1944 class TestLayerAnimationDeletingDelegate : public TestLayerAnimationDelegate { 1944 class TestLayerAnimationDeletingDelegate : public TestLayerAnimationDelegate {
1945 public: 1945 public:
1946 TestLayerAnimationDeletingDelegate(LayerAnimator* animator, int max_width) 1946 TestLayerAnimationDeletingDelegate(LayerAnimator* animator, int max_width)
1947 : animator_(animator), 1947 : animator_(animator),
1948 max_width_(max_width) { 1948 max_width_(max_width) {
1949 } 1949 }
1950 1950
1951 virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE { 1951 virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) override {
1952 TestLayerAnimationDelegate::SetBoundsFromAnimation(bounds); 1952 TestLayerAnimationDelegate::SetBoundsFromAnimation(bounds);
1953 if (bounds.width() > max_width_) 1953 if (bounds.width() > max_width_)
1954 animator_->StopAnimating(); 1954 animator_->StopAnimating();
1955 } 1955 }
1956 private: 1956 private:
1957 LayerAnimator* animator_; 1957 LayerAnimator* animator_;
1958 int max_width_; 1958 int max_width_;
1959 // Allow copy and assign. 1959 // Allow copy and assign.
1960 }; 1960 };
1961 1961
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 2275
2276 bool delete_on_animation_scheduled() const { 2276 bool delete_on_animation_scheduled() const {
2277 return delete_on_animation_scheduled_; 2277 return delete_on_animation_scheduled_;
2278 } 2278 }
2279 void set_delete_on_animation_scheduled(bool enabled) { 2279 void set_delete_on_animation_scheduled(bool enabled) {
2280 delete_on_animation_scheduled_ = enabled; 2280 delete_on_animation_scheduled_ = enabled;
2281 } 2281 }
2282 2282
2283 // LayerAnimationObserver implementation. 2283 // LayerAnimationObserver implementation.
2284 virtual void OnLayerAnimationEnded( 2284 virtual void OnLayerAnimationEnded(
2285 LayerAnimationSequence* sequence) OVERRIDE { 2285 LayerAnimationSequence* sequence) override {
2286 if (delete_on_animation_ended_) 2286 if (delete_on_animation_ended_)
2287 delete this; 2287 delete this;
2288 } 2288 }
2289 2289
2290 virtual void OnLayerAnimationAborted( 2290 virtual void OnLayerAnimationAborted(
2291 LayerAnimationSequence* sequence) OVERRIDE { 2291 LayerAnimationSequence* sequence) override {
2292 if (delete_on_animation_aborted_) 2292 if (delete_on_animation_aborted_)
2293 delete this; 2293 delete this;
2294 } 2294 }
2295 2295
2296 virtual void OnLayerAnimationScheduled( 2296 virtual void OnLayerAnimationScheduled(
2297 LayerAnimationSequence* sequence) OVERRIDE { 2297 LayerAnimationSequence* sequence) override {
2298 if (delete_on_animation_scheduled_) 2298 if (delete_on_animation_scheduled_)
2299 delete this; 2299 delete this;
2300 } 2300 }
2301 2301
2302 private: 2302 private:
2303 scoped_ptr<AnimatorOwner> animator_owner_; 2303 scoped_ptr<AnimatorOwner> animator_owner_;
2304 bool delete_on_animation_ended_; 2304 bool delete_on_animation_ended_;
2305 bool delete_on_animation_aborted_; 2305 bool delete_on_animation_aborted_;
2306 bool delete_on_animation_scheduled_; 2306 bool delete_on_animation_scheduled_;
2307 bool* was_deleted_; 2307 bool* was_deleted_;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2501 << child.GetTargetTransform().ToString(); 2501 << child.GetTargetTransform().ToString();
2502 2502
2503 } 2503 }
2504 2504
2505 class CollectionLayerAnimationDelegate : public TestLayerAnimationDelegate { 2505 class CollectionLayerAnimationDelegate : public TestLayerAnimationDelegate {
2506 public: 2506 public:
2507 CollectionLayerAnimationDelegate() : collection(NULL) {} 2507 CollectionLayerAnimationDelegate() : collection(NULL) {}
2508 virtual ~CollectionLayerAnimationDelegate() {} 2508 virtual ~CollectionLayerAnimationDelegate() {}
2509 2509
2510 // LayerAnimationDelegate: 2510 // LayerAnimationDelegate:
2511 virtual LayerAnimatorCollection* GetLayerAnimatorCollection() OVERRIDE { 2511 virtual LayerAnimatorCollection* GetLayerAnimatorCollection() override {
2512 return &collection; 2512 return &collection;
2513 } 2513 }
2514 2514
2515 private: 2515 private:
2516 LayerAnimatorCollection collection; 2516 LayerAnimatorCollection collection;
2517 }; 2517 };
2518 2518
2519 TEST(LayerAnimatorTest, LayerAnimatorCollectionTickTime) { 2519 TEST(LayerAnimatorTest, LayerAnimatorCollectionTickTime) {
2520 Layer layer; 2520 Layer layer;
2521 LayerAnimator* animator = layer.GetAnimator(); 2521 LayerAnimator* animator = layer.GetAnimator();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2614 2614
2615 root_2.Add(&layer); 2615 root_2.Add(&layer);
2616 EXPECT_FALSE(compositor_1->layer_animator_collection()->HasActiveAnimators()); 2616 EXPECT_FALSE(compositor_1->layer_animator_collection()->HasActiveAnimators());
2617 EXPECT_TRUE(compositor_2->layer_animator_collection()->HasActiveAnimators()); 2617 EXPECT_TRUE(compositor_2->layer_animator_collection()->HasActiveAnimators());
2618 host_2.reset(); 2618 host_2.reset();
2619 host_1.reset(); 2619 host_1.reset();
2620 TerminateContextFactoryForTests(); 2620 TerminateContextFactoryForTests();
2621 } 2621 }
2622 2622
2623 } // namespace ui 2623 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer_animator_collection.h ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698