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

Side by Side Diff: ui/views/animation/ink_drop_animation_unittest.cc

Issue 1832963002: MD - add ripples to DL shelf items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix another TODO 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_ 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_
6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_ 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 TEST_P(InkDropAnimationTest, ActionPendingOpacity) { 124 TEST_P(InkDropAnimationTest, ActionPendingOpacity) {
125 ink_drop_animation_->AnimateToState(views::InkDropState::ACTION_PENDING); 125 ink_drop_animation_->AnimateToState(views::InkDropState::ACTION_PENDING);
126 test_api_->CompleteAnimations(); 126 test_api_->CompleteAnimations();
127 127
128 EXPECT_EQ(InkDropAnimation::kVisibleOpacity, test_api_->GetCurrentOpacity()); 128 EXPECT_EQ(InkDropAnimation::kVisibleOpacity, test_api_->GetCurrentOpacity());
129 } 129 }
130 130
131 TEST_P(InkDropAnimationTest, QuickActionOpacity) { 131 TEST_P(InkDropAnimationTest, QuickActionOpacity) {
132 ink_drop_animation_->AnimateToState(views::InkDropState::ACTION_PENDING); 132 ink_drop_animation_->AnimateToState(views::InkDropState::ACTION_PENDING);
133 ink_drop_animation_->AnimateToState(views::InkDropState::QUICK_ACTION); 133 ink_drop_animation_->AnimateToState(views::InkDropState::ACTION_TRIGGERED);
134 test_api_->CompleteAnimations(); 134 test_api_->CompleteAnimations();
135 135
136 EXPECT_EQ(InkDropAnimation::kHiddenOpacity, test_api_->GetCurrentOpacity()); 136 EXPECT_EQ(InkDropAnimation::kHiddenOpacity, test_api_->GetCurrentOpacity());
137 } 137 }
138 138
139 TEST_P(InkDropAnimationTest, SlowActionPendingOpacity) { 139 TEST_P(InkDropAnimationTest, SlowActionPendingOpacity) {
140 ink_drop_animation_->AnimateToState(views::InkDropState::ACTION_PENDING); 140 ink_drop_animation_->AnimateToState(views::InkDropState::ACTION_PENDING);
141 ink_drop_animation_->AnimateToState(views::InkDropState::SLOW_ACTION_PENDING); 141 ink_drop_animation_->AnimateToState(
142 views::InkDropState::ALTERNATE_ACTION_PENDING);
142 test_api_->CompleteAnimations(); 143 test_api_->CompleteAnimations();
143 144
144 EXPECT_EQ(InkDropAnimation::kVisibleOpacity, test_api_->GetCurrentOpacity()); 145 EXPECT_EQ(InkDropAnimation::kVisibleOpacity, test_api_->GetCurrentOpacity());
145 } 146 }
146 147
147 TEST_P(InkDropAnimationTest, SlowActionOpacity) { 148 TEST_P(InkDropAnimationTest, SlowActionOpacity) {
148 ink_drop_animation_->AnimateToState(views::InkDropState::ACTION_PENDING); 149 ink_drop_animation_->AnimateToState(views::InkDropState::ACTION_PENDING);
149 ink_drop_animation_->AnimateToState(views::InkDropState::SLOW_ACTION_PENDING); 150 ink_drop_animation_->AnimateToState(
150 ink_drop_animation_->AnimateToState(views::InkDropState::SLOW_ACTION); 151 views::InkDropState::ALTERNATE_ACTION_PENDING);
152 ink_drop_animation_->AnimateToState(
153 views::InkDropState::ALTERNATE_ACTION_TRIGGERED);
151 test_api_->CompleteAnimations(); 154 test_api_->CompleteAnimations();
152 155
153 EXPECT_EQ(InkDropAnimation::kHiddenOpacity, test_api_->GetCurrentOpacity()); 156 EXPECT_EQ(InkDropAnimation::kHiddenOpacity, test_api_->GetCurrentOpacity());
154 } 157 }
155 158
156 TEST_P(InkDropAnimationTest, ActivatedOpacity) { 159 TEST_P(InkDropAnimationTest, ActivatedOpacity) {
157 ink_drop_animation_->AnimateToState(views::InkDropState::ACTIVATED); 160 ink_drop_animation_->AnimateToState(views::InkDropState::ACTIVATED);
158 test_api_->CompleteAnimations(); 161 test_api_->CompleteAnimations();
159 162
160 EXPECT_EQ(InkDropAnimation::kVisibleOpacity, test_api_->GetCurrentOpacity()); 163 EXPECT_EQ(InkDropAnimation::kVisibleOpacity, test_api_->GetCurrentOpacity());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 ink_drop_animation_->AnimateToState(InkDropState::ACTION_PENDING); 206 ink_drop_animation_->AnimateToState(InkDropState::ACTION_PENDING);
204 test_api_->CompleteAnimations(); 207 test_api_->CompleteAnimations();
205 208
206 EXPECT_EQ(2, observer_.last_animation_ended_ordinal()); 209 EXPECT_EQ(2, observer_.last_animation_ended_ordinal());
207 EXPECT_EQ(InkDropAnimationObserver::InkDropAnimationEndedReason::SUCCESS, 210 EXPECT_EQ(InkDropAnimationObserver::InkDropAnimationEndedReason::SUCCESS,
208 observer_.last_animation_ended_reason()); 211 observer_.last_animation_ended_reason());
209 } 212 }
210 213
211 TEST_P(InkDropAnimationTest, VerifyObserversAreNotifiedOfPreemptedAnimations) { 214 TEST_P(InkDropAnimationTest, VerifyObserversAreNotifiedOfPreemptedAnimations) {
212 ink_drop_animation_->AnimateToState(InkDropState::ACTION_PENDING); 215 ink_drop_animation_->AnimateToState(InkDropState::ACTION_PENDING);
213 ink_drop_animation_->AnimateToState(InkDropState::SLOW_ACTION_PENDING); 216 ink_drop_animation_->AnimateToState(InkDropState::ALTERNATE_ACTION_PENDING);
214 217
215 EXPECT_EQ(2, observer_.last_animation_ended_ordinal()); 218 EXPECT_EQ(2, observer_.last_animation_ended_ordinal());
216 EXPECT_EQ(InkDropAnimationObserver::InkDropAnimationEndedReason::PRE_EMPTED, 219 EXPECT_EQ(InkDropAnimationObserver::InkDropAnimationEndedReason::PRE_EMPTED,
217 observer_.last_animation_ended_reason()); 220 observer_.last_animation_ended_reason());
218 } 221 }
219 222
220 TEST_P(InkDropAnimationTest, InkDropStatesPersistWhenCallingAnimateToState) { 223 TEST_P(InkDropAnimationTest, InkDropStatesPersistWhenCallingAnimateToState) {
221 ink_drop_animation_->AnimateToState(views::InkDropState::ACTION_PENDING); 224 ink_drop_animation_->AnimateToState(views::InkDropState::ACTION_PENDING);
222 ink_drop_animation_->AnimateToState(views::InkDropState::ACTIVATED); 225 ink_drop_animation_->AnimateToState(views::InkDropState::ACTIVATED);
223 EXPECT_EQ(views::InkDropState::ACTIVATED, 226 EXPECT_EQ(views::InkDropState::ACTIVATED,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 345
343 EXPECT_EQ(2, observer_.last_animation_ended_ordinal()); 346 EXPECT_EQ(2, observer_.last_animation_ended_ordinal());
344 EXPECT_EQ(views::InkDropState::HIDDEN, 347 EXPECT_EQ(views::InkDropState::HIDDEN,
345 observer_.target_state_at_last_animation_ended()); 348 observer_.target_state_at_last_animation_ended());
346 } 349 }
347 350
348 } // namespace test 351 } // namespace test
349 } // namespace views 352 } // namespace views
350 353
351 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_ 354 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_UNITTEST_H_
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_animation_controller_impl_unittest.cc ('k') | ui/views/animation/ink_drop_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698