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

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

Issue 1937103003: Rename of InkDropAnimation classes to InkDropRipple. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed test_ink_drop_animation_observer.h from views.gyp and doc update. Created 4 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_ANIMATION_OBSERVER_H_
5 #ifndef UI_VIEWS_ANIMATION_TEST_TEST_ANIMATION_OBSERVER_H_ 5 #define UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_ANIMATION_OBSERVER_H_
6 #define UI_VIEWS_ANIMATION_TEST_TEST_ANIMATION_OBSERVER_H_
7 6
8 #include <algorithm> 7 #include <algorithm>
9 8
10 #include "base/macros.h" 9 #include "base/macros.h"
11 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/views/animation/ink_drop_animation_ended_reason.h" 11 #include "ui/views/animation/ink_drop_animation_ended_reason.h"
13 12
14 namespace views { 13 namespace views {
15 namespace test { 14 namespace test {
16 15
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 last_animation_ended_ordinal_ = GetNextOrdinal(); 58 last_animation_ended_ordinal_ = GetNextOrdinal();
60 last_animation_ended_reason_ = reason; 59 last_animation_ended_reason_ = reason;
61 } 60 }
62 61
63 // 62 //
64 // Collection of assertion predicates to be used with GTest test assertions. 63 // Collection of assertion predicates to be used with GTest test assertions.
65 // i.e. EXPECT_TRUE/EXPECT_FALSE and the ASSERT_ counterparts. 64 // i.e. EXPECT_TRUE/EXPECT_FALSE and the ASSERT_ counterparts.
66 // 65 //
67 // Example: 66 // Example:
68 // 67 //
69 // TestInkDropAnimationObserver observer; 68 // TestInkDropAnimationObserverHelper<int> observer;
70 // observer.set_ink_drop_animation(ink_drop_animation); 69 // event_source.set_observer(observer);
71 // EXPECT_TRUE(observer.AnimationHasNotStarted()); 70 // EXPECT_TRUE(observer.AnimationHasNotStarted());
72 // 71 //
73 72
74 // Passes *_TRUE assertions when an InkDropAnimationStarted() event has been 73 // Passes *_TRUE assertions when an AnimationStarted() event has been
75 // observed. 74 // observed.
76 testing::AssertionResult AnimationHasStarted() { 75 testing::AssertionResult AnimationHasStarted() {
77 if (last_animation_started_ordinal() > 0) { 76 if (last_animation_started_ordinal() > 0) {
78 return testing::AssertionSuccess() 77 return testing::AssertionSuccess()
79 << "Animations were started at ordinal=" 78 << "Animations were started at ordinal="
80 << last_animation_started_ordinal() << "."; 79 << last_animation_started_ordinal() << ".";
81 } 80 }
82 return testing::AssertionFailure() << "Animations have not started."; 81 return testing::AssertionFailure() << "Animations have not started.";
83 } 82 }
84 83
85 // Passes *_TRUE assertions when an InkDropAnimationStarted() event has NOT 84 // Passes *_TRUE assertions when an AnimationStarted() event has NOT been
86 // been observed. 85 // observed.
87 testing::AssertionResult AnimationHasNotStarted() { 86 testing::AssertionResult AnimationHasNotStarted() {
88 if (last_animation_started_ordinal() < 0) 87 if (last_animation_started_ordinal() < 0)
89 return testing::AssertionSuccess(); 88 return testing::AssertionSuccess();
90 return testing::AssertionFailure() << "Animations were started at ordinal=" 89 return testing::AssertionFailure() << "Animations were started at ordinal="
91 << last_animation_started_ordinal() 90 << last_animation_started_ordinal()
92 << "."; 91 << ".";
93 } 92 }
94 93
95 // Passes *_TRUE assertions when an InkDropAnimationEnded() event has been 94 // Passes *_TRUE assertions when an AnimationEnded() event has been observed.
96 // observed.
97 testing::AssertionResult AnimationHasEnded() { 95 testing::AssertionResult AnimationHasEnded() {
98 if (last_animation_ended_ordinal() > 0) { 96 if (last_animation_ended_ordinal() > 0) {
99 return testing::AssertionSuccess() << "Animations were ended at ordinal=" 97 return testing::AssertionSuccess() << "Animations were ended at ordinal="
100 << last_animation_ended_ordinal() 98 << last_animation_ended_ordinal()
101 << "."; 99 << ".";
102 } 100 }
103 return testing::AssertionFailure() << "Animations have not ended."; 101 return testing::AssertionFailure() << "Animations have not ended.";
104 } 102 }
105 103
106 // Passes *_TRUE assertions when an InkDropAnimationEnded() event has NOT been 104 // Passes *_TRUE assertions when an AnimationEnded() event has NOT been
107 // observed. 105 // observed.
108 testing::AssertionResult AnimationHasNotEnded() { 106 testing::AssertionResult AnimationHasNotEnded() {
109 if (last_animation_ended_ordinal() < 0) 107 if (last_animation_ended_ordinal() < 0)
110 return testing::AssertionSuccess(); 108 return testing::AssertionSuccess();
111 return testing::AssertionFailure() << "Animations were ended at ordinal=" 109 return testing::AssertionFailure() << "Animations were ended at ordinal="
112 << last_animation_ended_ordinal() << "."; 110 << last_animation_ended_ordinal() << ".";
113 } 111 }
114 112
115 private: 113 private:
116 // Returns the next event ordinal. The first returned ordinal will be 1. 114 // Returns the next event ordinal. The first returned ordinal will be 1.
(...skipping 16 matching lines...) Expand all
133 ContextType last_animation_ended_context_; 131 ContextType last_animation_ended_context_;
134 132
135 InkDropAnimationEndedReason last_animation_ended_reason_; 133 InkDropAnimationEndedReason last_animation_ended_reason_;
136 134
137 DISALLOW_COPY_AND_ASSIGN(TestInkDropAnimationObserverHelper); 135 DISALLOW_COPY_AND_ASSIGN(TestInkDropAnimationObserverHelper);
138 }; 136 };
139 137
140 } // namespace test 138 } // namespace test
141 } // namespace views 139 } // namespace views
142 140
143 #endif // UI_VIEWS_ANIMATION_TEST_TEST_ANIMATION_OBSERVER_H_ 141 #endif // UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_ANIMATION_OBSERVER_H_
OLDNEW
« no previous file with comments | « ui/views/animation/test/test_ink_drop_animation_observer.cc ('k') | ui/views/animation/test/test_ink_drop_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698