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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/compositor/test/test_layer_animation_observer.h
diff --git a/ui/compositor/test/test_layer_animation_observer.h b/ui/compositor/test/test_layer_animation_observer.h
index 0f0a18ecd39c88ef665eb85aecb87ccf64c795e4..6860b173d31b0d2415a7d4364e11a0cf127ae4f0 100644
--- a/ui/compositor/test/test_layer_animation_observer.h
+++ b/ui/compositor/test/test_layer_animation_observer.h
@@ -6,6 +6,7 @@
#define UI_COMPOSITOR_TEST_TEST_LAYER_ANIMATION_OBSERVER_H_
#include "base/compiler_specific.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "ui/compositor/layer_animation_observer.h"
namespace ui {
@@ -19,34 +20,110 @@ class TestLayerAnimationObserver : public LayerAnimationObserver {
TestLayerAnimationObserver();
~TestLayerAnimationObserver() override;
- void OnLayerAnimationEnded(LayerAnimationSequence* sequence) override;
-
- void OnLayerAnimationAborted(LayerAnimationSequence* sequence) override;
+ // Resets all the data tracking LayerAnimationObserver observations.
+ void ResetLayerAnimationObserverations();
+ // LayerAnimationObserver:
void OnLayerAnimationScheduled(LayerAnimationSequence* sequence) override;
-
+ void OnLayerAnimationStarted(LayerAnimationSequence* sequence) override;
+ void OnLayerAnimationAborted(LayerAnimationSequence* sequence) override;
+ void OnLayerAnimationEnded(LayerAnimationSequence* sequence) override;
bool RequiresNotificationWhenAnimatorDestroyed() const override;
- const LayerAnimationSequence* last_ended_sequence() const {
- return last_ended_sequence_;
+ const LayerAnimationSequence* last_attached_sequence() const {
+ return last_attached_sequence_;
+ }
+
+ int last_attached_sequence_epoch() const {
+ return last_attached_sequence_epoch_;
}
const LayerAnimationSequence* last_scheduled_sequence() const {
return last_scheduled_sequence_;
}
+ int last_scheduled_sequence_epoch() const {
+ return last_scheduled_sequence_epoch_;
+ }
+
+ const LayerAnimationSequence* last_started_sequence() const {
+ return last_started_sequence_;
+ }
+
+ int last_started_sequence_epoch() const {
+ return last_started_sequence_epoch_;
+ }
+
const LayerAnimationSequence* last_aborted_sequence() const {
return last_aborted_sequence_;
}
+ int last_aborted_sequence_epoch() const {
+ return last_aborted_sequence_epoch_;
+ }
+
+ const LayerAnimationSequence* last_ended_sequence() const {
+ return last_ended_sequence_;
+ }
+
+ int last_ended_sequence_epoch() const { return last_ended_sequence_epoch_; }
+
+ const LayerAnimationSequence* last_detached_sequence() const {
+ return last_detached_sequence_;
+ }
+
+ int last_detached_sequence_epoch() const {
+ return last_detached_sequence_epoch_;
+ }
+
void set_requires_notification_when_animator_destroyed(bool value) {
requires_notification_when_animator_destroyed_ = value;
}
+ testing::AssertionResult NoEventsObserved();
+
+ testing::AssertionResult AttachedEpochIsBeforeScheduledEpoch();
+
+ testing::AssertionResult ScheduledEpochIsBeforeStartedEpoch();
+
+ testing::AssertionResult StartedEpochIsBeforeEndedEpoch();
+
+ testing::AssertionResult StartedEpochIsBeforeAbortedEpoch();
+
+ testing::AssertionResult AbortedEpochIsBeforeStartedEpoch();
+
+ testing::AssertionResult AbortedEpochIsBeforeDetachedEpoch();
+
+ testing::AssertionResult EndedEpochIsBeforeStartedEpoch();
+
+ testing::AssertionResult EndedEpochIsBeforeDetachedEpoch();
+
+ protected:
+ // LayerAnimationObserver:
+ void OnAttachedToSequence(LayerAnimationSequence* sequence) override;
+ void OnDetachedFromSequence(LayerAnimationSequence* sequence) override;
+
private:
- const LayerAnimationSequence* last_ended_sequence_;
+ int next_epoch_;
+
+ const LayerAnimationSequence* last_attached_sequence_;
+ int last_attached_sequence_epoch_;
+
const LayerAnimationSequence* last_scheduled_sequence_;
+ int last_scheduled_sequence_epoch_;
+
+ const LayerAnimationSequence* last_started_sequence_;
+ int last_started_sequence_epoch_;
+
const LayerAnimationSequence* last_aborted_sequence_;
+ int last_aborted_sequence_epoch_;
+
+ const LayerAnimationSequence* last_ended_sequence_;
+ int last_ended_sequence_epoch_;
+
+ const LayerAnimationSequence* last_detached_sequence_;
+ int last_detached_sequence_epoch_;
+
bool requires_notification_when_animator_destroyed_;
// Copy and assign are allowed.

Powered by Google App Engine
This is Rietveld 408576698