OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/aura/test/test_window_delegate.h" | 5 #include "ui/aura/test/test_window_delegate.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/base/events/event.h" | 9 #include "ui/base/events/event.h" |
10 #include "ui/base/hit_test.h" | 10 #include "ui/base/hit_test.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 case ui::ET_KEY_PRESSED: | 152 case ui::ET_KEY_PRESSED: |
153 key_press_count_++; | 153 key_press_count_++; |
154 break; | 154 break; |
155 case ui::ET_KEY_RELEASED: | 155 case ui::ET_KEY_RELEASED: |
156 key_release_count_++; | 156 key_release_count_++; |
157 default: | 157 default: |
158 break; | 158 break; |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 ui::EventResult EventCountDelegate::OnMouseEvent(ui::MouseEvent* event) { | 162 void EventCountDelegate::OnMouseEvent(ui::MouseEvent* event) { |
163 switch (event->type()) { | 163 switch (event->type()) { |
164 case ui::ET_MOUSE_MOVED: | 164 case ui::ET_MOUSE_MOVED: |
165 mouse_move_count_++; | 165 mouse_move_count_++; |
166 break; | 166 break; |
167 case ui::ET_MOUSE_ENTERED: | 167 case ui::ET_MOUSE_ENTERED: |
168 mouse_enter_count_++; | 168 mouse_enter_count_++; |
169 break; | 169 break; |
170 case ui::ET_MOUSE_EXITED: | 170 case ui::ET_MOUSE_EXITED: |
171 mouse_leave_count_++; | 171 mouse_leave_count_++; |
172 break; | 172 break; |
173 case ui::ET_MOUSE_PRESSED: | 173 case ui::ET_MOUSE_PRESSED: |
174 mouse_press_count_++; | 174 mouse_press_count_++; |
175 break; | 175 break; |
176 case ui::ET_MOUSE_RELEASED: | 176 case ui::ET_MOUSE_RELEASED: |
177 mouse_release_count_++; | 177 mouse_release_count_++; |
178 break; | 178 break; |
179 default: | 179 default: |
180 break; | 180 break; |
181 } | 181 } |
182 return ui::ER_UNHANDLED; | |
183 } | 182 } |
184 | 183 |
185 std::string EventCountDelegate::GetMouseMotionCountsAndReset() { | 184 std::string EventCountDelegate::GetMouseMotionCountsAndReset() { |
186 std::string result = StringPrintf("%d %d %d", | 185 std::string result = StringPrintf("%d %d %d", |
187 mouse_enter_count_, | 186 mouse_enter_count_, |
188 mouse_move_count_, | 187 mouse_move_count_, |
189 mouse_leave_count_); | 188 mouse_leave_count_); |
190 mouse_enter_count_ = 0; | 189 mouse_enter_count_ = 0; |
191 mouse_move_count_ = 0; | 190 mouse_move_count_ = 0; |
192 mouse_leave_count_ = 0; | 191 mouse_leave_count_ = 0; |
(...skipping 14 matching lines...) Expand all Loading... |
207 std::string result = StringPrintf("%d %d", | 206 std::string result = StringPrintf("%d %d", |
208 key_press_count_, | 207 key_press_count_, |
209 key_release_count_); | 208 key_release_count_); |
210 key_press_count_ = 0; | 209 key_press_count_ = 0; |
211 key_release_count_ = 0; | 210 key_release_count_ = 0; |
212 return result; | 211 return result; |
213 } | 212 } |
214 | 213 |
215 } // namespace test | 214 } // namespace test |
216 } // namespace aura | 215 } // namespace aura |
OLD | NEW |