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

Unified Diff: ui/views/animation/test/test_ink_drop_animation_observer.cc

Issue 1896953003: Added a views::test::TestInkDropAnimationObserverHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed general AnimationObserver. Created 4 years, 8 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/views/animation/test/test_ink_drop_animation_observer.cc
diff --git a/ui/views/animation/test/test_ink_drop_animation_observer.cc b/ui/views/animation/test/test_ink_drop_animation_observer.cc
index 0dd5a7791af9878ae9c63578a5b051e1e2dd27fb..8b35faab2ae57713e631db0861a30e7ed7146638 100644
--- a/ui/views/animation/test/test_ink_drop_animation_observer.cc
+++ b/ui/views/animation/test/test_ink_drop_animation_observer.cc
@@ -10,75 +10,29 @@ namespace views {
namespace test {
TestInkDropAnimationObserver::TestInkDropAnimationObserver()
- : last_animation_started_ordinal_(-1),
- last_animation_ended_ordinal_(-1),
- last_animation_state_started_(InkDropState::HIDDEN),
- last_animation_state_ended_(InkDropState::HIDDEN),
- last_animation_ended_reason_(InkDropAnimationEndedReason::SUCCESS),
- target_state_at_last_animation_started_(InkDropState::HIDDEN),
+ : target_state_at_last_animation_started_(InkDropState::HIDDEN),
target_state_at_last_animation_ended_(InkDropState::HIDDEN) {}
TestInkDropAnimationObserver::~TestInkDropAnimationObserver() {}
-testing::AssertionResult TestInkDropAnimationObserver::AnimationHasStarted() {
- if (last_animation_started_ordinal() > 0) {
- return testing::AssertionSuccess() << "Animations were started at ordinal="
- << last_animation_started_ordinal()
- << ".";
- }
- return testing::AssertionFailure() << "Animations have not started.";
-}
-
-testing::AssertionResult
-TestInkDropAnimationObserver::AnimationHasNotStarted() {
- if (last_animation_started_ordinal() < 0)
- return testing::AssertionSuccess();
- return testing::AssertionFailure() << "Animations were started at ordinal="
- << last_animation_started_ordinal() << ".";
-}
-
-testing::AssertionResult TestInkDropAnimationObserver::AnimationHasEnded() {
- if (last_animation_ended_ordinal() > 0) {
- return testing::AssertionSuccess() << "Animations were ended at ordinal="
- << last_animation_ended_ordinal() << ".";
- }
- return testing::AssertionFailure() << "Animations have not ended.";
-}
-
-testing::AssertionResult TestInkDropAnimationObserver::AnimationHasNotEnded() {
- if (last_animation_ended_ordinal() < 0)
- return testing::AssertionSuccess();
- return testing::AssertionFailure() << "Animations were ended at ordinal="
- << last_animation_ended_ordinal() << ".";
-}
-
-void TestInkDropAnimationObserver::InkDropAnimationStarted(
+void TestInkDropAnimationObserver::AnimationStarted(
InkDropState ink_drop_state) {
- last_animation_started_ordinal_ = GetNextOrdinal();
- last_animation_state_started_ = ink_drop_state;
+ ObserverHelper::OnAnimationStarted(ink_drop_state);
if (ink_drop_animation_) {
target_state_at_last_animation_started_ =
ink_drop_animation_->target_ink_drop_state();
}
}
-void TestInkDropAnimationObserver::InkDropAnimationEnded(
+void TestInkDropAnimationObserver::AnimationEnded(
InkDropState ink_drop_state,
InkDropAnimationEndedReason reason) {
- last_animation_ended_ordinal_ = GetNextOrdinal();
- last_animation_state_ended_ = ink_drop_state;
- last_animation_ended_reason_ = reason;
+ ObserverHelper::OnAnimationEnded(ink_drop_state, reason);
if (ink_drop_animation_) {
target_state_at_last_animation_ended_ =
ink_drop_animation_->target_ink_drop_state();
}
}
-int TestInkDropAnimationObserver::GetNextOrdinal() const {
- return std::max(1, std::max(last_animation_started_ordinal_,
- last_animation_ended_ordinal_) +
- 1);
-}
-
} // namespace test
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698