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

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

Issue 1390113006: Added material design mouse hover feedback support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed pkasting@'s comments from patch set 13. Created 5 years, 1 month 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
Index: ui/views/animation/ink_drop_hover_unittest.cc
diff --git a/ui/views/animation/ink_drop_hover_unittest.cc b/ui/views/animation/ink_drop_hover_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..08ee8b98861d68c9bba34a83043df922be0a7842
--- /dev/null
+++ b/ui/views/animation/ink_drop_hover_unittest.cc
@@ -0,0 +1,58 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// 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_hover.h"
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/compositor/scoped_animation_duration_scale_mode.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace views {
+namespace test {
+
+class InkDropHoverTest : public testing::Test {
+ public:
+ InkDropHoverTest();
+ ~InkDropHoverTest() override;
+
+ protected:
+ scoped_ptr<InkDropHover> CreateInkDropHover() const;
+
+ private:
+ // Enables zero duration animations during the tests.
+ scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_;
+
+ DISALLOW_COPY_AND_ASSIGN(InkDropHoverTest);
+};
+
+InkDropHoverTest::InkDropHoverTest() {
+ zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
+ ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
+}
+
+InkDropHoverTest::~InkDropHoverTest() {}
+
+scoped_ptr<InkDropHover> InkDropHoverTest::CreateInkDropHover() const {
+ return make_scoped_ptr(new InkDropHover(gfx::Size(10, 10), 3));
+}
+
+TEST_F(InkDropHoverTest, InitialStateAfterConstruction) {
+ scoped_ptr<InkDropHover> ink_drop_hover = CreateInkDropHover();
+ EXPECT_FALSE(ink_drop_hover->IsVisible());
+}
+
+TEST_F(InkDropHoverTest, IsHoveredStateTransitions) {
+ scoped_ptr<InkDropHover> ink_drop_hover = CreateInkDropHover();
+
+ ink_drop_hover->FadeIn(base::TimeDelta::FromMilliseconds(0));
+ EXPECT_TRUE(ink_drop_hover->IsVisible());
+
+ ink_drop_hover->FadeOut(base::TimeDelta::FromMilliseconds(0));
+ EXPECT_FALSE(ink_drop_hover->IsVisible());
+}
+
+} // namespace test
+} // namespace views

Powered by Google App Engine
This is Rietveld 408576698