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

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

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 #ifndef UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_HOST_H_ 5 #ifndef UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_HOST_H_
6 #define UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_HOST_H_ 6 #define UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_HOST_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/views/animation/ink_drop_host.h" 9 #include "ui/views/animation/ink_drop_host.h"
10 10
11 namespace views { 11 namespace views {
12 12
13 // A non-functional implementation of an InkDropHost that can be used during 13 // A non-functional implementation of an InkDropHost that can be used during
14 // tests. Tracks the number of hosted ink drop layers. 14 // tests. Tracks the number of hosted ink drop layers.
15 class TestInkDropHost : public InkDropHost { 15 class TestInkDropHost : public InkDropHost {
16 public: 16 public:
17 TestInkDropHost(); 17 TestInkDropHost();
18 ~TestInkDropHost() override; 18 ~TestInkDropHost() override;
19 19
20 int num_ink_drop_layers() const { return num_ink_drop_layers_; } 20 int num_ink_drop_layers_added() const { return num_ink_drop_layers_added_; }
21 int num_ink_drop_layers() const {
22 return num_ink_drop_layers_added_ - num_ink_drop_layers_removed_;
23 }
21 24
22 void set_should_show_highlight(bool should_show_highlight) { 25 void set_should_show_highlight(bool should_show_highlight) {
23 should_show_highlight_ = should_show_highlight; 26 should_show_highlight_ = should_show_highlight;
24 } 27 }
25 28
26 void set_disable_timers_for_test(bool disable_timers_for_test) { 29 void set_disable_timers_for_test(bool disable_timers_for_test) {
27 disable_timers_for_test_ = disable_timers_for_test; 30 disable_timers_for_test_ = disable_timers_for_test;
28 } 31 }
29 32
30 void set_ripple_overrides_highlight(bool overrides_highlight) { 33 void set_ripple_overrides_highlight(bool overrides_highlight) {
31 ripple_overrides_highlight_ = overrides_highlight; 34 ripple_overrides_highlight_ = overrides_highlight;
32 } 35 }
33 36
34 // TestInkDropHost: 37 // TestInkDropHost:
35 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; 38 void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
36 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; 39 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override;
37 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; 40 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override;
38 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override; 41 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override;
39 42
40 private: 43 private:
41 int num_ink_drop_layers_; 44 int num_ink_drop_layers_added_;
45 int num_ink_drop_layers_removed_;
42 46
43 bool should_show_highlight_; 47 bool should_show_highlight_;
44 48
45 bool ripple_overrides_highlight_; 49 bool ripple_overrides_highlight_;
46 50
47 // When true, the InkDropRipple/InkDropHighlight instances will have their 51 // When true, the InkDropRipple/InkDropHighlight instances will have their
48 // timers disabled after creation. 52 // timers disabled after creation.
49 bool disable_timers_for_test_; 53 bool disable_timers_for_test_;
50 54
51 DISALLOW_COPY_AND_ASSIGN(TestInkDropHost); 55 DISALLOW_COPY_AND_ASSIGN(TestInkDropHost);
52 }; 56 };
53 57
54 } // namespace views 58 } // namespace views
55 59
56 #endif // UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_HOST_H_ 60 #endif // UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_HOST_H_
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_impl_unittest.cc ('k') | ui/views/animation/test/test_ink_drop_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698