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

Side by Side Diff: ui/views/animation/test/test_ink_drop_host.cc

Issue 2431493002: MD Buttons: Don't add layers for hidden -> hidden transitions. (Closed)
Patch Set: Additional test Created 4 years, 2 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/test/test_ink_drop_host.h" 5 #include "ui/views/animation/test/test_ink_drop_host.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/gfx/geometry/size.h" 8 #include "ui/gfx/geometry/size.h"
9 #include "ui/views/animation/ink_drop_highlight.h" 9 #include "ui/views/animation/ink_drop_highlight.h"
10 #include "ui/views/animation/square_ink_drop_ripple.h" 10 #include "ui/views/animation/square_ink_drop_ripple.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 private: 76 private:
77 std::unique_ptr<test::InkDropHighlightTestApi> test_api_; 77 std::unique_ptr<test::InkDropHighlightTestApi> test_api_;
78 78
79 DISALLOW_COPY_AND_ASSIGN(TestInkDropHighlight); 79 DISALLOW_COPY_AND_ASSIGN(TestInkDropHighlight);
80 }; 80 };
81 81
82 } // namespace 82 } // namespace
83 83
84 TestInkDropHost::TestInkDropHost() 84 TestInkDropHost::TestInkDropHost()
85 : num_ink_drop_layers_(0), 85 : num_ink_drop_layers_added_(0),
86 num_ink_drop_layers_removed_(0),
86 should_show_highlight_(false), 87 should_show_highlight_(false),
87 ripple_overrides_highlight_(true), 88 ripple_overrides_highlight_(true),
88 disable_timers_for_test_(false) {} 89 disable_timers_for_test_(false) {}
89 90
90 TestInkDropHost::~TestInkDropHost() {} 91 TestInkDropHost::~TestInkDropHost() {}
91 92
92 void TestInkDropHost::AddInkDropLayer(ui::Layer* ink_drop_layer) { 93 void TestInkDropHost::AddInkDropLayer(ui::Layer* ink_drop_layer) {
93 ++num_ink_drop_layers_; 94 ++num_ink_drop_layers_added_;
94 } 95 }
95 96
96 void TestInkDropHost::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { 97 void TestInkDropHost::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
97 --num_ink_drop_layers_; 98 ++num_ink_drop_layers_removed_;
98 } 99 }
99 100
100 std::unique_ptr<InkDropRipple> TestInkDropHost::CreateInkDropRipple() const { 101 std::unique_ptr<InkDropRipple> TestInkDropHost::CreateInkDropRipple() const {
101 gfx::Size size(10, 10); 102 gfx::Size size(10, 10);
102 std::unique_ptr<InkDropRipple> ripple( 103 std::unique_ptr<InkDropRipple> ripple(
103 new TestInkDropRipple(size, 5, size, 5, gfx::Point(), SK_ColorBLACK, 104 new TestInkDropRipple(size, 5, size, 5, gfx::Point(), SK_ColorBLACK,
104 0.175f, ripple_overrides_highlight_)); 105 0.175f, ripple_overrides_highlight_));
105 if (disable_timers_for_test_) 106 if (disable_timers_for_test_)
106 ripple->GetTestApi()->SetDisableAnimationTimers(true); 107 ripple->GetTestApi()->SetDisableAnimationTimers(true);
107 return ripple; 108 return ripple;
108 } 109 }
109 110
110 std::unique_ptr<InkDropHighlight> TestInkDropHost::CreateInkDropHighlight() 111 std::unique_ptr<InkDropHighlight> TestInkDropHost::CreateInkDropHighlight()
111 const { 112 const {
112 std::unique_ptr<InkDropHighlight> highlight; 113 std::unique_ptr<InkDropHighlight> highlight;
113 if (should_show_highlight_) { 114 if (should_show_highlight_) {
114 highlight.reset(new TestInkDropHighlight(gfx::Size(10, 10), 4, 115 highlight.reset(new TestInkDropHighlight(gfx::Size(10, 10), 4,
115 gfx::PointF(), SK_ColorBLACK)); 116 gfx::PointF(), SK_ColorBLACK));
116 if (disable_timers_for_test_) 117 if (disable_timers_for_test_)
117 highlight->GetTestApi()->SetDisableAnimationTimers(true); 118 highlight->GetTestApi()->SetDisableAnimationTimers(true);
118 } 119 }
119 return highlight; 120 return highlight;
120 } 121 }
121 122
122 } // namespace views 123 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/test/test_ink_drop_host.h ('k') | ui/views/controls/button/custom_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698