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

Side by Side Diff: ash/common/shelf/shelf_background_animator_unittest.cc

Issue 2749123003: [ash-md] Fixed ShelfBackgroundAnimator to not snap target values when being preempted. (Closed)
Patch Set: Removed ShelfBackgroundAnimatorTest.AnimationProgressesToTargetWhenStoppingUnfinishedAnimator. Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/common/shelf/shelf_background_animator.h" 5 #include "ash/common/shelf/shelf_background_animator.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/animation/animation_change_type.h" 9 #include "ash/animation/animation_change_type.h"
10 #include "ash/common/shelf/shelf_background_animator_observer.h" 10 #include "ash/common/shelf/shelf_background_animator_observer.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 const gfx::SlideAnimation* animator = test_api_->animator(); 272 const gfx::SlideAnimation* animator = test_api_->animator();
273 EXPECT_TRUE(animator); 273 EXPECT_TRUE(animator);
274 274
275 EXPECT_NE(SHELF_BACKGROUND_OVERLAP, test_api_->previous_background_type()); 275 EXPECT_NE(SHELF_BACKGROUND_OVERLAP, test_api_->previous_background_type());
276 PaintBackground(SHELF_BACKGROUND_OVERLAP, AnimationChangeType::ANIMATE); 276 PaintBackground(SHELF_BACKGROUND_OVERLAP, AnimationChangeType::ANIMATE);
277 277
278 EXPECT_NE(animator, test_api_->animator()); 278 EXPECT_NE(animator, test_api_->animator());
279 } 279 }
280 280
281 TEST_F(ShelfBackgroundAnimatorTest,
282 AnimationProgressesToTargetWhenStoppingUnfinishedAnimator) {
283 PaintBackground(SHELF_BACKGROUND_OVERLAP, AnimationChangeType::ANIMATE);
284
285 EXPECT_NE(kShelfTranslucentAlpha, observer_.GetBackgroundAlpha());
286 EXPECT_NE(0, observer_.GetItemBackgroundAlpha());
287
288 test_api_->animator()->Stop();
289
290 EXPECT_EQ(kShelfTranslucentAlpha, observer_.GetBackgroundAlpha());
291 EXPECT_EQ(0, observer_.GetItemBackgroundAlpha());
292 }
293
294 // Verify observers are always notified, even when alpha values don't change. 281 // Verify observers are always notified, even when alpha values don't change.
295 TEST_F(ShelfBackgroundAnimatorTest, 282 TEST_F(ShelfBackgroundAnimatorTest,
296 ObserversAreNotifiedWhenSnappingToSameTargetBackground) { 283 ObserversAreNotifiedWhenSnappingToSameTargetBackground) {
297 PaintBackground(SHELF_BACKGROUND_DEFAULT); 284 PaintBackground(SHELF_BACKGROUND_DEFAULT);
298 SetColorValuesOnObserver(kDummyColor); 285 SetColorValuesOnObserver(kDummyColor);
299 PaintBackground(SHELF_BACKGROUND_DEFAULT); 286 PaintBackground(SHELF_BACKGROUND_DEFAULT);
300 287
301 EXPECT_NE(observer_.background_color(), kDummyColor); 288 EXPECT_NE(observer_.background_color(), kDummyColor);
302 EXPECT_NE(observer_.item_background_color(), kDummyColor); 289 EXPECT_NE(observer_.item_background_color(), kDummyColor);
303 } 290 }
304 291
305 } // namespace ash 292 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698