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

Side by Side Diff: ui/compositor/test/test_layer_animation_observer.h

Issue 1381463002: Added LayerAnimationObserver::OnLayerAnimationStarted() notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Polish after self review. Created 5 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
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 #ifndef UI_COMPOSITOR_TEST_TEST_LAYER_ANIMATION_OBSERVER_H_ 5 #ifndef UI_COMPOSITOR_TEST_TEST_LAYER_ANIMATION_OBSERVER_H_
6 #define UI_COMPOSITOR_TEST_TEST_LAYER_ANIMATION_OBSERVER_H_ 6 #define UI_COMPOSITOR_TEST_TEST_LAYER_ANIMATION_OBSERVER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/compositor/layer_animation_observer.h" 10 #include "ui/compositor/layer_animation_observer.h"
10 11
11 namespace ui { 12 namespace ui {
12 13
13 class LayerAnimationSequence; 14 class LayerAnimationSequence;
14 15
15 // Listens to animation ended notifications. Remembers the last sequence that 16 // Listens to animation ended notifications. Remembers the last sequence that
16 // it was notified about. 17 // it was notified about.
17 class TestLayerAnimationObserver : public LayerAnimationObserver { 18 class TestLayerAnimationObserver : public LayerAnimationObserver {
18 public: 19 public:
19 TestLayerAnimationObserver(); 20 TestLayerAnimationObserver();
20 ~TestLayerAnimationObserver() override; 21 ~TestLayerAnimationObserver() override;
21 22
23 // Resets all the data tracking LayerAnimationObserver observations.
24 void ResetLayerAnimationObserverations();
25
26 // LayerAnimationObserver:
27 void OnLayerAnimationScheduled(LayerAnimationSequence* sequence) override;
28 void OnLayerAnimationStarted(LayerAnimationSequence* sequence) override;
29 void OnLayerAnimationAborted(LayerAnimationSequence* sequence) override;
22 void OnLayerAnimationEnded(LayerAnimationSequence* sequence) override; 30 void OnLayerAnimationEnded(LayerAnimationSequence* sequence) override;
23
24 void OnLayerAnimationAborted(LayerAnimationSequence* sequence) override;
25
26 void OnLayerAnimationScheduled(LayerAnimationSequence* sequence) override;
27
28 bool RequiresNotificationWhenAnimatorDestroyed() const override; 31 bool RequiresNotificationWhenAnimatorDestroyed() const override;
29 32
30 const LayerAnimationSequence* last_ended_sequence() const { 33 const LayerAnimationSequence* last_attached_sequence() const {
31 return last_ended_sequence_; 34 return last_attached_sequence_;
35 }
36
37 int last_attached_sequence_epoch() const {
38 return last_attached_sequence_epoch_;
32 } 39 }
33 40
34 const LayerAnimationSequence* last_scheduled_sequence() const { 41 const LayerAnimationSequence* last_scheduled_sequence() const {
35 return last_scheduled_sequence_; 42 return last_scheduled_sequence_;
36 } 43 }
37 44
45 int last_scheduled_sequence_epoch() const {
46 return last_scheduled_sequence_epoch_;
47 }
48
49 const LayerAnimationSequence* last_started_sequence() const {
50 return last_started_sequence_;
51 }
52
53 int last_started_sequence_epoch() const {
54 return last_started_sequence_epoch_;
55 }
56
38 const LayerAnimationSequence* last_aborted_sequence() const { 57 const LayerAnimationSequence* last_aborted_sequence() const {
39 return last_aborted_sequence_; 58 return last_aborted_sequence_;
40 } 59 }
41 60
61 int last_aborted_sequence_epoch() const {
62 return last_aborted_sequence_epoch_;
63 }
64
65 const LayerAnimationSequence* last_ended_sequence() const {
66 return last_ended_sequence_;
67 }
68
69 int last_ended_sequence_epoch() const { return last_ended_sequence_epoch_; }
70
71 const LayerAnimationSequence* last_detached_sequence() const {
72 return last_detached_sequence_;
73 }
74
75 int last_detached_sequence_epoch() const {
76 return last_detached_sequence_epoch_;
77 }
78
42 void set_requires_notification_when_animator_destroyed(bool value) { 79 void set_requires_notification_when_animator_destroyed(bool value) {
43 requires_notification_when_animator_destroyed_ = value; 80 requires_notification_when_animator_destroyed_ = value;
44 } 81 }
45 82
83 testing::AssertionResult NoEventsObserved();
84
85 testing::AssertionResult AttachedEpochIsBeforeScheduledEpoch();
86
87 testing::AssertionResult ScheduledEpochIsBeforeStartedEpoch();
88
89 testing::AssertionResult StartedEpochIsBeforeEndedEpoch();
90
91 testing::AssertionResult StartedEpochIsBeforeAbortedEpoch();
92
93 testing::AssertionResult AbortedEpochIsBeforeStartedEpoch();
94
95 testing::AssertionResult AbortedEpochIsBeforeDetachedEpoch();
96
97 testing::AssertionResult EndedEpochIsBeforeStartedEpoch();
98
99 testing::AssertionResult EndedEpochIsBeforeDetachedEpoch();
100
101 protected:
102 // LayerAnimationObserver:
103 void OnAttachedToSequence(LayerAnimationSequence* sequence) override;
104 void OnDetachedFromSequence(LayerAnimationSequence* sequence) override;
105
46 private: 106 private:
107 int next_epoch_;
108
109 const LayerAnimationSequence* last_attached_sequence_;
110 int last_attached_sequence_epoch_;
111
112 const LayerAnimationSequence* last_scheduled_sequence_;
113 int last_scheduled_sequence_epoch_;
114
115 const LayerAnimationSequence* last_started_sequence_;
116 int last_started_sequence_epoch_;
117
118 const LayerAnimationSequence* last_aborted_sequence_;
119 int last_aborted_sequence_epoch_;
120
47 const LayerAnimationSequence* last_ended_sequence_; 121 const LayerAnimationSequence* last_ended_sequence_;
48 const LayerAnimationSequence* last_scheduled_sequence_; 122 int last_ended_sequence_epoch_;
49 const LayerAnimationSequence* last_aborted_sequence_; 123
124 const LayerAnimationSequence* last_detached_sequence_;
125 int last_detached_sequence_epoch_;
126
50 bool requires_notification_when_animator_destroyed_; 127 bool requires_notification_when_animator_destroyed_;
51 128
52 // Copy and assign are allowed. 129 // Copy and assign are allowed.
53 }; 130 };
54 131
55 } // namespace ui 132 } // namespace ui
56 133
57 #endif // UI_COMPOSITOR_TEST_TEST_LAYER_ANIMATION_OBSERVER_H_ 134 #endif // UI_COMPOSITOR_TEST_TEST_LAYER_ANIMATION_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698