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

Side by Side Diff: ui/aura/window_unittest.cc

Issue 11280290: events: Change gesture-event handler in EventHandler to not return any values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/test/test_window_delegate.cc ('k') | ui/base/events/event.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE { 173 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE {
174 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) 174 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED)
175 capture_changed_event_count_++; 175 capture_changed_event_count_++;
176 mouse_event_count_++; 176 mouse_event_count_++;
177 return ui::ER_UNHANDLED; 177 return ui::ER_UNHANDLED;
178 } 178 }
179 virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE { 179 virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
180 touch_event_count_++; 180 touch_event_count_++;
181 return ui::ER_UNHANDLED; 181 return ui::ER_UNHANDLED;
182 } 182 }
183 virtual ui::EventResult OnGestureEvent( 183 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE {
184 ui::GestureEvent* event) OVERRIDE {
185 gesture_event_count_++; 184 gesture_event_count_++;
186 return ui::ER_UNHANDLED;
187 } 185 }
188 virtual void OnCaptureLost() OVERRIDE { 186 virtual void OnCaptureLost() OVERRIDE {
189 capture_lost_count_++; 187 capture_lost_count_++;
190 } 188 }
191 189
192 private: 190 private:
193 int capture_changed_event_count_; 191 int capture_changed_event_count_;
194 int capture_lost_count_; 192 int capture_lost_count_;
195 int mouse_event_count_; 193 int mouse_event_count_;
196 int touch_event_count_; 194 int touch_event_count_;
(...skipping 19 matching lines...) Expand all
216 214
217 private: 215 private:
218 aura::Window* previous_focused_window_; 216 aura::Window* previous_focused_window_;
219 }; 217 };
220 218
221 // Keeps track of the location of the gesture. 219 // Keeps track of the location of the gesture.
222 class GestureTrackPositionDelegate : public TestWindowDelegate { 220 class GestureTrackPositionDelegate : public TestWindowDelegate {
223 public: 221 public:
224 GestureTrackPositionDelegate() {} 222 GestureTrackPositionDelegate() {}
225 223
226 virtual ui::EventResult OnGestureEvent( 224 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE {
227 ui::GestureEvent* event) OVERRIDE {
228 position_ = event->location(); 225 position_ = event->location();
229 return ui::ER_CONSUMED; 226 event->StopPropagation();
230 } 227 }
231 228
232 const gfx::Point& position() const { return position_; } 229 const gfx::Point& position() const { return position_; }
233 230
234 private: 231 private:
235 gfx::Point position_; 232 gfx::Point position_;
236 233
237 DISALLOW_COPY_AND_ASSIGN(GestureTrackPositionDelegate); 234 DISALLOW_COPY_AND_ASSIGN(GestureTrackPositionDelegate);
238 }; 235 };
239 236
(...skipping 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 // Move |w2| to be a child of |w1|. 2585 // Move |w2| to be a child of |w1|.
2589 w1->AddChild(w2.get()); 2586 w1->AddChild(w2.get());
2590 // Sine we moved in the same root, observer shouldn't be notified. 2587 // Sine we moved in the same root, observer shouldn't be notified.
2591 EXPECT_EQ("0 0", observer.CountStringAndReset()); 2588 EXPECT_EQ("0 0", observer.CountStringAndReset());
2592 // |w2| should still have focus after moving. 2589 // |w2| should still have focus after moving.
2593 EXPECT_TRUE(w2->HasFocus()); 2590 EXPECT_TRUE(w2->HasFocus());
2594 } 2591 }
2595 2592
2596 } // namespace test 2593 } // namespace test
2597 } // namespace aura 2594 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/test_window_delegate.cc ('k') | ui/base/events/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698