| Index: ui/views/animation/ink_drop_animation_controller_factory_unittest.cc
|
| diff --git a/ui/views/animation/ink_drop_animation_controller_factory_unittest.cc b/ui/views/animation/ink_drop_animation_controller_factory_unittest.cc
|
| index 8f15a8286f68ad0e88d3deac7a4245d06beb0e18..4c7e976c35b6ac6d161c32777067886ee556314e 100644
|
| --- a/ui/views/animation/ink_drop_animation_controller_factory_unittest.cc
|
| +++ b/ui/views/animation/ink_drop_animation_controller_factory_unittest.cc
|
| @@ -9,6 +9,7 @@
|
| #include "base/memory/scoped_ptr.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "ui/base/test/material_design_controller_test_api.h"
|
| +#include "ui/compositor/scoped_animation_duration_scale_mode.h"
|
| #include "ui/views/animation/ink_drop_animation_controller.h"
|
| #include "ui/views/animation/ink_drop_animation_controller_factory.h"
|
| #include "ui/views/animation/ink_drop_host.h"
|
| @@ -34,6 +35,10 @@ class InkDropAnimationControllerFactoryTest : public testing::Test {
|
| void TearDown() override;
|
|
|
| protected:
|
| + // Template function called during SetUp() that sets the
|
| + // MaterialDesignController::Mode.
|
| + virtual void SetMaterialMode();
|
| +
|
| // A dummy InkDropHost required to create an InkDropAnimationController.
|
| TestInkDropHost test_ink_drop_host_;
|
|
|
| @@ -51,6 +56,8 @@ void InkDropAnimationControllerFactoryTest::SetUp() {
|
| // a non-initialized state.
|
| ui::test::MaterialDesignControllerTestAPI::UninitializeMode();
|
|
|
| + SetMaterialMode();
|
| +
|
| ink_drop_animation_controller_ =
|
| InkDropAnimationControllerFactory::CreateInkDropAnimationController(
|
| &test_ink_drop_host_);
|
| @@ -60,6 +67,11 @@ void InkDropAnimationControllerFactoryTest::TearDown() {
|
| ui::test::MaterialDesignControllerTestAPI::UninitializeMode();
|
| }
|
|
|
| +void InkDropAnimationControllerFactoryTest::SetMaterialMode() {
|
| + ui::test::MaterialDesignControllerTestAPI::SetMode(
|
| + ui::MaterialDesignController::NON_MATERIAL);
|
| +}
|
| +
|
| // Test fixture to test the material design InkDropAnimationController.
|
| class MDInkDropAnimationControllerFactoryTest
|
| : public InkDropAnimationControllerFactoryTest {
|
| @@ -69,23 +81,53 @@ class MDInkDropAnimationControllerFactoryTest
|
| // InkDropAnimationControllerFactoryTest:
|
| void SetUp() override;
|
|
|
| + protected:
|
| + // InkDropAnimationControllerFactoryTest:
|
| + void SetMaterialMode() override;
|
| +
|
| private:
|
| + scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(MDInkDropAnimationControllerFactoryTest);
|
| };
|
|
|
| void MDInkDropAnimationControllerFactoryTest::SetUp() {
|
| + zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
|
| + ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
|
| + InkDropAnimationControllerFactoryTest::SetUp();
|
| +}
|
| +
|
| +void MDInkDropAnimationControllerFactoryTest::SetMaterialMode() {
|
| ui::test::MaterialDesignControllerTestAPI::SetMode(
|
| ui::MaterialDesignController::MATERIAL_NORMAL);
|
| - InkDropAnimationControllerFactoryTest::SetUp();
|
| }
|
|
|
| -TEST_ALL_INK_DROPS(StateIsHiddenInitially,
|
| +TEST_ALL_INK_DROPS(InitialState,
|
| {
|
| + EXPECT_FALSE(ink_drop_animation_controller_->IsHovered());
|
| EXPECT_EQ(
|
| InkDropState::HIDDEN,
|
| ink_drop_animation_controller_->GetInkDropState());
|
| })
|
|
|
| +TEST_ALL_INK_DROPS(SetHovered,
|
| + {
|
| + ink_drop_animation_controller_->SetHovered(true);
|
| + EXPECT_TRUE(ink_drop_animation_controller_->IsHovered());
|
| +
|
| + ink_drop_animation_controller_->SetHovered(false);
|
| + EXPECT_FALSE(ink_drop_animation_controller_->IsHovered());
|
| + })
|
| +
|
| +TEST_ALL_INK_DROPS(HoveredStateAfterAnimateToState,
|
| + {
|
| + ink_drop_animation_controller_->SetHovered(true);
|
| + ink_drop_animation_controller_->AnimateToState(
|
| + InkDropState::QUICK_ACTION);
|
| +
|
| + EXPECT_FALSE(ink_drop_animation_controller_->IsHovered());
|
| + })
|
| +
|
| TEST_ALL_INK_DROPS(TypicalQuickAction,
|
| {
|
| ink_drop_animation_controller_->AnimateToState(
|
|
|