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

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

Issue 1682893002: Color the ink drop ripple and hover effects based on theming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit tests Created 4 years, 10 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_hover.h" 5 #include "ui/views/animation/ink_drop_hover.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 10 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
11 #include "ui/gfx/color_palette.h"
11 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
12 13
13 namespace views { 14 namespace views {
14 namespace test { 15 namespace test {
15 16
16 class InkDropHoverTest : public testing::Test { 17 class InkDropHoverTest : public testing::Test {
17 public: 18 public:
18 InkDropHoverTest(); 19 InkDropHoverTest();
19 ~InkDropHoverTest() override; 20 ~InkDropHoverTest() override;
20 21
21 protected: 22 protected:
22 scoped_ptr<InkDropHover> CreateInkDropHover() const; 23 scoped_ptr<InkDropHover> CreateInkDropHover() const;
23 24
24 private: 25 private:
25 // Enables zero duration animations during the tests. 26 // Enables zero duration animations during the tests.
26 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; 27 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_;
27 28
28 DISALLOW_COPY_AND_ASSIGN(InkDropHoverTest); 29 DISALLOW_COPY_AND_ASSIGN(InkDropHoverTest);
29 }; 30 };
30 31
31 InkDropHoverTest::InkDropHoverTest() { 32 InkDropHoverTest::InkDropHoverTest() {
32 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( 33 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
33 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); 34 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
34 } 35 }
35 36
36 InkDropHoverTest::~InkDropHoverTest() {} 37 InkDropHoverTest::~InkDropHoverTest() {}
37 38
38 scoped_ptr<InkDropHover> InkDropHoverTest::CreateInkDropHover() const { 39 scoped_ptr<InkDropHover> InkDropHoverTest::CreateInkDropHover() const {
39 return make_scoped_ptr(new InkDropHover(gfx::Size(10, 10), 3)); 40 return make_scoped_ptr(
41 new InkDropHover(gfx::kPlaceholderColor, gfx::Size(10, 10), 3));
40 } 42 }
41 43
42 TEST_F(InkDropHoverTest, InitialStateAfterConstruction) { 44 TEST_F(InkDropHoverTest, InitialStateAfterConstruction) {
43 scoped_ptr<InkDropHover> ink_drop_hover = CreateInkDropHover(); 45 scoped_ptr<InkDropHover> ink_drop_hover = CreateInkDropHover();
44 EXPECT_FALSE(ink_drop_hover->IsVisible()); 46 EXPECT_FALSE(ink_drop_hover->IsVisible());
45 } 47 }
46 48
47 TEST_F(InkDropHoverTest, IsHoveredStateTransitions) { 49 TEST_F(InkDropHoverTest, IsHoveredStateTransitions) {
48 scoped_ptr<InkDropHover> ink_drop_hover = CreateInkDropHover(); 50 scoped_ptr<InkDropHover> ink_drop_hover = CreateInkDropHover();
49 51
50 ink_drop_hover->FadeIn(base::TimeDelta::FromMilliseconds(0)); 52 ink_drop_hover->FadeIn(base::TimeDelta::FromMilliseconds(0));
51 EXPECT_TRUE(ink_drop_hover->IsVisible()); 53 EXPECT_TRUE(ink_drop_hover->IsVisible());
52 54
53 ink_drop_hover->FadeOut(base::TimeDelta::FromMilliseconds(0)); 55 ink_drop_hover->FadeOut(base::TimeDelta::FromMilliseconds(0));
54 EXPECT_FALSE(ink_drop_hover->IsVisible()); 56 EXPECT_FALSE(ink_drop_hover->IsVisible());
55 } 57 }
56 58
57 } // namespace test 59 } // namespace test
58 } // namespace views 60 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698