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

Unified Diff: ui/views/animation/ink_drop_impl_unittest.cc

Issue 1937353002: Rename of InkDropAnimationController classes to InkDrop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed tdanderson@ comments from patch set 2. Created 4 years, 7 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
« no previous file with comments | « ui/views/animation/ink_drop_impl.cc ('k') | ui/views/animation/test/ink_drop_impl_test_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/ink_drop_impl_unittest.cc
diff --git a/ui/views/animation/ink_drop_animation_controller_impl_unittest.cc b/ui/views/animation/ink_drop_impl_unittest.cc
similarity index 54%
rename from ui/views/animation/ink_drop_animation_controller_impl_unittest.cc
rename to ui/views/animation/ink_drop_impl_unittest.cc
index 3f3cb56e10db3e96bc3cd79aa6687e720d70990c..d390ae10161e0956d40bf1582bc35f3039b6a163 100644
--- a/ui/views/animation/ink_drop_animation_controller_impl_unittest.cc
+++ b/ui/views/animation/ink_drop_impl_unittest.cc
@@ -2,84 +2,80 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/views/animation/ink_drop_animation_controller_impl.h"
+#include "ui/views/animation/ink_drop_impl.h"
#include "base/macros.h"
#include "base/test/test_simple_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/views/animation/ink_drop_ripple.h"
-#include "ui/views/animation/test/ink_drop_animation_controller_impl_test_api.h"
+#include "ui/views/animation/test/ink_drop_impl_test_api.h"
#include "ui/views/animation/test/test_ink_drop_host.h"
namespace views {
-// NOTE: The InkDropAnimationControllerImpl class is also tested by the
-// InkDropAnimationControllerFactoryTest tests.
-class InkDropAnimationControllerImplTest : public testing::Test {
+// NOTE: The InkDropImpl class is also tested by the InkDropFactoryTest tests.
+class InkDropImplTest : public testing::Test {
public:
- InkDropAnimationControllerImplTest();
- ~InkDropAnimationControllerImplTest() override;
+ InkDropImplTest();
+ ~InkDropImplTest() override;
protected:
TestInkDropHost ink_drop_host_;
// The test target.
- InkDropAnimationControllerImpl ink_drop_animation_controller_;
+ InkDropImpl ink_drop_;
// Allows privileged access to the the |ink_drop_hover_|.
- test::InkDropAnimationControllerImplTestApi test_api_;
+ test::InkDropImplTestApi test_api_;
- // Used to control the tasks scheduled by the InkDropAnimationControllerImpl's
- // Timer.
+ // Used to control the tasks scheduled by the InkDropImpl's Timer.
scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
// Required by base::Timer's.
std::unique_ptr<base::ThreadTaskRunnerHandle> thread_task_runner_handle_;
private:
- DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImplTest);
+ DISALLOW_COPY_AND_ASSIGN(InkDropImplTest);
};
-InkDropAnimationControllerImplTest::InkDropAnimationControllerImplTest()
- : ink_drop_animation_controller_(&ink_drop_host_),
- test_api_(&ink_drop_animation_controller_),
+InkDropImplTest::InkDropImplTest()
+ : ink_drop_(&ink_drop_host_),
+ test_api_(&ink_drop_),
task_runner_(new base::TestSimpleTaskRunner),
thread_task_runner_handle_(
new base::ThreadTaskRunnerHandle(task_runner_)) {
ink_drop_host_.set_disable_timers_for_test(true);
}
-InkDropAnimationControllerImplTest::~InkDropAnimationControllerImplTest() {}
+InkDropImplTest::~InkDropImplTest() {}
-TEST_F(InkDropAnimationControllerImplTest, SetHoveredIsFadingInOrVisible) {
+TEST_F(InkDropImplTest, SetHoveredIsFadingInOrVisible) {
ink_drop_host_.set_should_show_hover(true);
- ink_drop_animation_controller_.SetHovered(true);
+ ink_drop_.SetHovered(true);
EXPECT_TRUE(test_api_.IsHoverFadingInOrVisible());
test_api_.CompleteAnimations();
- ink_drop_animation_controller_.SetHovered(false);
+ ink_drop_.SetHovered(false);
EXPECT_FALSE(test_api_.IsHoverFadingInOrVisible());
}
-TEST_F(InkDropAnimationControllerImplTest,
- HoverDoesntFadeInAfterAnimationIfHoverNotSet) {
+TEST_F(InkDropImplTest, HoverDoesntFadeInAfterAnimationIfHoverNotSet) {
ink_drop_host_.set_should_show_hover(true);
- ink_drop_animation_controller_.SetHovered(false);
- ink_drop_animation_controller_.AnimateToState(InkDropState::ACTION_TRIGGERED);
+ ink_drop_.SetHovered(false);
+ ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED);
test_api_.CompleteAnimations();
EXPECT_FALSE(task_runner_->HasPendingTask());
EXPECT_FALSE(test_api_.IsHoverFadingInOrVisible());
}
-TEST_F(InkDropAnimationControllerImplTest,
- HoverFadesInAfterAnimationWhenHostIsHovered) {
+TEST_F(InkDropImplTest, HoverFadesInAfterAnimationWhenHostIsHovered) {
ink_drop_host_.set_should_show_hover(true);
- ink_drop_animation_controller_.SetHovered(true);
- ink_drop_animation_controller_.AnimateToState(InkDropState::ACTION_TRIGGERED);
+ ink_drop_.SetHovered(true);
+ ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED);
test_api_.CompleteAnimations();
EXPECT_TRUE(task_runner_->HasPendingTask());
@@ -89,11 +85,10 @@ TEST_F(InkDropAnimationControllerImplTest,
EXPECT_TRUE(test_api_.IsHoverFadingInOrVisible());
}
-TEST_F(InkDropAnimationControllerImplTest,
- HoverDoesntFadeInAfterAnimationWhenHostIsNotHovered) {
+TEST_F(InkDropImplTest, HoverDoesntFadeInAfterAnimationWhenHostIsNotHovered) {
ink_drop_host_.set_should_show_hover(false);
- ink_drop_animation_controller_.SetHovered(true);
- ink_drop_animation_controller_.AnimateToState(InkDropState::ACTION_TRIGGERED);
+ ink_drop_.SetHovered(true);
+ ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED);
test_api_.CompleteAnimations();
EXPECT_TRUE(task_runner_->HasPendingTask());
@@ -103,86 +98,83 @@ TEST_F(InkDropAnimationControllerImplTest,
EXPECT_FALSE(test_api_.IsHoverFadingInOrVisible());
}
-TEST_F(InkDropAnimationControllerImplTest,
- HoveredStateNotVisibleOrFadingInAfterAnimateToState) {
+TEST_F(InkDropImplTest, HoveredStateNotVisibleOrFadingInAfterAnimateToState) {
ink_drop_host_.set_should_show_hover(true);
- ink_drop_animation_controller_.SetHovered(true);
+ ink_drop_.SetHovered(true);
test_api_.CompleteAnimations();
EXPECT_TRUE(test_api_.IsHoverFadingInOrVisible());
- ink_drop_animation_controller_.AnimateToState(InkDropState::ACTION_TRIGGERED);
+ ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED);
EXPECT_FALSE(test_api_.IsHoverFadingInOrVisible());
}
// Verifies that there is not a crash when setting hovered state and the host
// returns null for the hover.
-TEST_F(InkDropAnimationControllerImplTest,
- SetHoveredFalseWorksWhenNoInkDropHoverExists) {
+TEST_F(InkDropImplTest, SetHoveredFalseWorksWhenNoInkDropHoverExists) {
ink_drop_host_.set_should_show_hover(false);
- ink_drop_animation_controller_.SetHovered(true);
+ ink_drop_.SetHovered(true);
EXPECT_FALSE(test_api_.hover());
- ink_drop_animation_controller_.SetHovered(false);
+ ink_drop_.SetHovered(false);
EXPECT_FALSE(test_api_.hover());
}
-TEST_F(InkDropAnimationControllerImplTest, HoverFadesOutOnSnapToActivated) {
+TEST_F(InkDropImplTest, HoverFadesOutOnSnapToActivated) {
ink_drop_host_.set_should_show_hover(true);
- ink_drop_animation_controller_.SetHovered(true);
+ ink_drop_.SetHovered(true);
test_api_.CompleteAnimations();
EXPECT_TRUE(test_api_.IsHoverFadingInOrVisible());
- ink_drop_animation_controller_.SnapToActivated();
+ ink_drop_.SnapToActivated();
EXPECT_FALSE(test_api_.IsHoverFadingInOrVisible());
}
-TEST_F(InkDropAnimationControllerImplTest, LayersRemovedFromHostAfterHover) {
+TEST_F(InkDropImplTest, LayersRemovedFromHostAfterHover) {
ink_drop_host_.set_should_show_hover(true);
EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
- ink_drop_animation_controller_.SetHovered(true);
+ ink_drop_.SetHovered(true);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
test_api_.CompleteAnimations();
- ink_drop_animation_controller_.SetHovered(false);
+ ink_drop_.SetHovered(false);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
test_api_.CompleteAnimations();
EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
}
-TEST_F(InkDropAnimationControllerImplTest, LayersRemovedFromHostAfterInkDrop) {
+TEST_F(InkDropImplTest, LayersRemovedFromHostAfterInkDrop) {
ink_drop_host_.set_should_show_hover(true);
EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
- ink_drop_animation_controller_.AnimateToState(InkDropState::ACTION_PENDING);
+ ink_drop_.AnimateToState(InkDropState::ACTION_PENDING);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
- ink_drop_animation_controller_.AnimateToState(InkDropState::HIDDEN);
+ ink_drop_.AnimateToState(InkDropState::HIDDEN);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
test_api_.CompleteAnimations();
EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
}
-TEST_F(InkDropAnimationControllerImplTest,
- LayersAddedToHostWhenHoverOrInkDropVisible) {
+TEST_F(InkDropImplTest, LayersAddedToHostWhenHoverOrInkDropVisible) {
ink_drop_host_.set_should_show_hover(true);
EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
- ink_drop_animation_controller_.SetHovered(true);
+ ink_drop_.SetHovered(true);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
- ink_drop_animation_controller_.AnimateToState(InkDropState::ACTION_PENDING);
+ ink_drop_.AnimateToState(InkDropState::ACTION_PENDING);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
- ink_drop_animation_controller_.AnimateToState(InkDropState::HIDDEN);
+ ink_drop_.AnimateToState(InkDropState::HIDDEN);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
test_api_.CompleteAnimations();
@@ -196,19 +188,18 @@ TEST_F(InkDropAnimationControllerImplTest,
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
}
-TEST_F(InkDropAnimationControllerImplTest,
- LayersNotAddedToHostWhenHoverTimeFires) {
+TEST_F(InkDropImplTest, LayersNotAddedToHostWhenHoverTimeFires) {
ink_drop_host_.set_should_show_hover(true);
EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
- ink_drop_animation_controller_.SetHovered(true);
+ ink_drop_.SetHovered(true);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
- ink_drop_animation_controller_.AnimateToState(InkDropState::ACTION_PENDING);
+ ink_drop_.AnimateToState(InkDropState::ACTION_PENDING);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
- ink_drop_animation_controller_.AnimateToState(InkDropState::HIDDEN);
+ ink_drop_.AnimateToState(InkDropState::HIDDEN);
test_api_.CompleteAnimations();
EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
@@ -220,21 +211,20 @@ TEST_F(InkDropAnimationControllerImplTest,
EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
}
-TEST_F(InkDropAnimationControllerImplTest,
- LayersArentRemovedWhenPreemptingFadeOut) {
+TEST_F(InkDropImplTest, LayersArentRemovedWhenPreemptingFadeOut) {
ink_drop_host_.set_should_show_hover(true);
EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers());
- ink_drop_animation_controller_.SetHovered(true);
+ ink_drop_.SetHovered(true);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
test_api_.CompleteAnimations();
- ink_drop_animation_controller_.SetHovered(false);
+ ink_drop_.SetHovered(false);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
- ink_drop_animation_controller_.SetHovered(true);
+ ink_drop_.SetHovered(true);
EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers());
}
« no previous file with comments | « ui/views/animation/ink_drop_impl.cc ('k') | ui/views/animation/test/ink_drop_impl_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698