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

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

Issue 1757993004: Added ink drop hover/ripple to menu hosting bookmark buttons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed sky@ & varkha@ comments. Created 4 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 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 #include "ui/views/animation/ink_drop_animation_controller_impl.h" 5 #include "ui/views/animation/ink_drop_animation_controller_impl.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/test/test_simple_task_runner.h" 8 #include "base/test/test_simple_task_runner.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 ink_drop_host_.set_should_show_hover(true); 63 ink_drop_host_.set_should_show_hover(true);
64 64
65 ink_drop_animation_controller_.SetHovered(true); 65 ink_drop_animation_controller_.SetHovered(true);
66 EXPECT_TRUE(is_hover_fading_in_or_visible()); 66 EXPECT_TRUE(is_hover_fading_in_or_visible());
67 67
68 ink_drop_animation_controller_.SetHovered(false); 68 ink_drop_animation_controller_.SetHovered(false);
69 EXPECT_FALSE(is_hover_fading_in_or_visible()); 69 EXPECT_FALSE(is_hover_fading_in_or_visible());
70 } 70 }
71 71
72 TEST_F(InkDropAnimationControllerImplTest, 72 TEST_F(InkDropAnimationControllerImplTest,
73 HoveredStateAfterHoverTimerFiresWhenHostIsHovered) { 73 HoverDoesntFadeInAfterAnimationIfHoverNotSet) {
74 ink_drop_host_.set_should_show_hover(true); 74 ink_drop_host_.set_should_show_hover(true);
75 ink_drop_animation_controller_.SetHovered(false);
76 ink_drop_animation_controller_.AnimateToState(InkDropState::QUICK_ACTION);
77
78 EXPECT_FALSE(task_runner_->HasPendingTask());
79 EXPECT_FALSE(is_hover_fading_in_or_visible());
80 }
81
82 TEST_F(InkDropAnimationControllerImplTest,
83 HoverFadesInAfterAnimationWhenHostIsHovered) {
84 ink_drop_host_.set_should_show_hover(true);
85 ink_drop_animation_controller_.SetHovered(true);
75 ink_drop_animation_controller_.AnimateToState(InkDropState::QUICK_ACTION); 86 ink_drop_animation_controller_.AnimateToState(InkDropState::QUICK_ACTION);
76 87
77 EXPECT_TRUE(task_runner_->HasPendingTask()); 88 EXPECT_TRUE(task_runner_->HasPendingTask());
78 89
79 task_runner_->RunPendingTasks(); 90 task_runner_->RunPendingTasks();
80 91
81 EXPECT_TRUE(is_hover_fading_in_or_visible()); 92 EXPECT_TRUE(is_hover_fading_in_or_visible());
82 } 93 }
83 94
84 TEST_F(InkDropAnimationControllerImplTest, 95 TEST_F(InkDropAnimationControllerImplTest,
85 HoveredStateAfterHoverTimerFiresWhenHostIsNotHovered) { 96 HoverDoesntFadeInAfterAnimationWhenHostIsNotHovered) {
86 ink_drop_host_.set_should_show_hover(false); 97 ink_drop_host_.set_should_show_hover(false);
98 ink_drop_animation_controller_.SetHovered(true);
87 ink_drop_animation_controller_.AnimateToState(InkDropState::QUICK_ACTION); 99 ink_drop_animation_controller_.AnimateToState(InkDropState::QUICK_ACTION);
88 100
89 EXPECT_TRUE(task_runner_->HasPendingTask()); 101 EXPECT_TRUE(task_runner_->HasPendingTask());
90 102
91 task_runner_->RunPendingTasks(); 103 task_runner_->RunPendingTasks();
92 104
93 EXPECT_FALSE(is_hover_fading_in_or_visible()); 105 EXPECT_FALSE(is_hover_fading_in_or_visible());
94 } 106 }
95 107
96 TEST_F(InkDropAnimationControllerImplTest, 108 TEST_F(InkDropAnimationControllerImplTest,
(...skipping 11 matching lines...) Expand all
108 // returns null for the hover. 120 // returns null for the hover.
109 TEST_F(InkDropAnimationControllerImplTest, 121 TEST_F(InkDropAnimationControllerImplTest,
110 SetHoveredFalseWorksWhenNoInkDropHoverExists) { 122 SetHoveredFalseWorksWhenNoInkDropHoverExists) {
111 ink_drop_host_.set_should_show_hover(false); 123 ink_drop_host_.set_should_show_hover(false);
112 ink_drop_animation_controller_.SetHovered(true); 124 ink_drop_animation_controller_.SetHovered(true);
113 EXPECT_FALSE(hover()); 125 EXPECT_FALSE(hover());
114 ink_drop_animation_controller_.SetHovered(false); 126 ink_drop_animation_controller_.SetHovered(false);
115 EXPECT_FALSE(hover()); 127 EXPECT_FALSE(hover());
116 } 128 }
117 129
130 TEST_F(InkDropAnimationControllerImplTest, HoverFadesOutOnSnapToActivated) {
131 ink_drop_host_.set_should_show_hover(true);
132 ink_drop_animation_controller_.SetHovered(true);
133
134 EXPECT_TRUE(is_hover_fading_in_or_visible());
135
136 ink_drop_animation_controller_.SnapToActivated();
137
138 EXPECT_FALSE(is_hover_fading_in_or_visible());
139 }
140
118 } // namespace views 141 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_animation_controller_impl.cc ('k') | ui/views/animation/ink_drop_animation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698