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

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

Issue 11592011: events: Update mouse-event handlers to not return EventResult. (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_dispatcher_unittest.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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 165
166 int capture_changed_event_count() const { 166 int capture_changed_event_count() const {
167 return capture_changed_event_count_; 167 return capture_changed_event_count_;
168 } 168 }
169 int capture_lost_count() const { return capture_lost_count_; } 169 int capture_lost_count() const { return capture_lost_count_; }
170 int mouse_event_count() const { return mouse_event_count_; } 170 int mouse_event_count() const { return mouse_event_count_; }
171 int touch_event_count() const { return touch_event_count_; } 171 int touch_event_count() const { return touch_event_count_; }
172 int gesture_event_count() const { return gesture_event_count_; } 172 int gesture_event_count() const { return gesture_event_count_; }
173 173
174 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE { 174 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE {
175 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) 175 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED)
176 capture_changed_event_count_++; 176 capture_changed_event_count_++;
177 mouse_event_count_++; 177 mouse_event_count_++;
178 return ui::ER_UNHANDLED;
179 } 178 }
180 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { 179 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
181 touch_event_count_++; 180 touch_event_count_++;
182 } 181 }
183 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { 182 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE {
184 gesture_event_count_++; 183 gesture_event_count_++;
185 } 184 }
186 virtual void OnCaptureLost() OVERRIDE { 185 virtual void OnCaptureLost() OVERRIDE {
187 capture_lost_count_++; 186 capture_lost_count_++;
188 } 187 }
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 // The |child| window is moved to the 0,0 in screen coordinates. 1064 // The |child| window is moved to the 0,0 in screen coordinates.
1066 // |GetBoundsInRootWindow()| should return 0,0. 1065 // |GetBoundsInRootWindow()| should return 0,0.
1067 child->SetBounds(gfx::Rect(100, 100, 100, 100)); 1066 child->SetBounds(gfx::Rect(100, 100, 100, 100));
1068 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString()); 1067 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString());
1069 } 1068 }
1070 1069
1071 class MouseEnterExitWindowDelegate : public TestWindowDelegate { 1070 class MouseEnterExitWindowDelegate : public TestWindowDelegate {
1072 public: 1071 public:
1073 MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {} 1072 MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {}
1074 1073
1075 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE { 1074 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE {
1076 switch (event->type()) { 1075 switch (event->type()) {
1077 case ui::ET_MOUSE_ENTERED: 1076 case ui::ET_MOUSE_ENTERED:
1078 entered_ = true; 1077 entered_ = true;
1079 break; 1078 break;
1080 case ui::ET_MOUSE_EXITED: 1079 case ui::ET_MOUSE_EXITED:
1081 exited_ = true; 1080 exited_ = true;
1082 break; 1081 break;
1083 default: 1082 default:
1084 break; 1083 break;
1085 } 1084 }
1086 return ui::ER_UNHANDLED;
1087 } 1085 }
1088 1086
1089 bool entered() const { return entered_; } 1087 bool entered() const { return entered_; }
1090 bool exited() const { return exited_; } 1088 bool exited() const { return exited_; }
1091 1089
1092 // Clear the entered / exited states. 1090 // Clear the entered / exited states.
1093 void ResetExpectations() { 1091 void ResetExpectations() {
1094 entered_ = false; 1092 entered_ = false;
1095 exited_ = false; 1093 exited_ = false;
1096 } 1094 }
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 // Move |w2| to be a child of |w1|. 2590 // Move |w2| to be a child of |w1|.
2593 w1->AddChild(w2.get()); 2591 w1->AddChild(w2.get());
2594 // Sine we moved in the same root, observer shouldn't be notified. 2592 // Sine we moved in the same root, observer shouldn't be notified.
2595 EXPECT_EQ("0 0", observer.CountStringAndReset()); 2593 EXPECT_EQ("0 0", observer.CountStringAndReset());
2596 // |w2| should still have focus after moving. 2594 // |w2| should still have focus after moving.
2597 EXPECT_TRUE(w2->HasFocus()); 2595 EXPECT_TRUE(w2->HasFocus());
2598 } 2596 }
2599 2597
2600 } // namespace test 2598 } // namespace test
2601 } // namespace aura 2599 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/test_window_delegate.cc ('k') | ui/base/events/event_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698