| 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/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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 int capture_changed_event_count() const { | 160 int capture_changed_event_count() const { |
| 161 return capture_changed_event_count_; | 161 return capture_changed_event_count_; |
| 162 } | 162 } |
| 163 int capture_lost_count() const { return capture_lost_count_; } | 163 int capture_lost_count() const { return capture_lost_count_; } |
| 164 int mouse_event_count() const { return mouse_event_count_; } | 164 int mouse_event_count() const { return mouse_event_count_; } |
| 165 int touch_event_count() const { return touch_event_count_; } | 165 int touch_event_count() const { return touch_event_count_; } |
| 166 int gesture_event_count() const { return gesture_event_count_; } | 166 int gesture_event_count() const { return gesture_event_count_; } |
| 167 | 167 |
| 168 virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 168 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
| 169 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) | 169 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) |
| 170 capture_changed_event_count_++; | 170 capture_changed_event_count_++; |
| 171 mouse_event_count_++; | 171 mouse_event_count_++; |
| 172 return false; | 172 return ui::ER_UNHANDLED; |
| 173 } | 173 } |
| 174 virtual ui::TouchStatus OnTouchEvent(ui::TouchEvent* event) OVERRIDE { | 174 virtual ui::TouchStatus OnTouchEvent(ui::TouchEvent* event) OVERRIDE { |
| 175 touch_event_count_++; | 175 touch_event_count_++; |
| 176 return ui::TOUCH_STATUS_UNKNOWN; | 176 return ui::TOUCH_STATUS_UNKNOWN; |
| 177 } | 177 } |
| 178 virtual ui::EventResult OnGestureEvent( | 178 virtual ui::EventResult OnGestureEvent( |
| 179 ui::GestureEvent* event) OVERRIDE { | 179 ui::GestureEvent* event) OVERRIDE { |
| 180 gesture_event_count_++; | 180 gesture_event_count_++; |
| 181 return ui::ER_UNHANDLED; | 181 return ui::ER_UNHANDLED; |
| 182 } | 182 } |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 // The |child| window is moved to the 0,0 in screen coordinates. | 1026 // The |child| window is moved to the 0,0 in screen coordinates. |
| 1027 // |GetBoundsInRootWindow()| should return 0,0. | 1027 // |GetBoundsInRootWindow()| should return 0,0. |
| 1028 child->SetBounds(gfx::Rect(100, 100, 100, 100)); | 1028 child->SetBounds(gfx::Rect(100, 100, 100, 100)); |
| 1029 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString()); | 1029 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString()); |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 class MouseEnterExitWindowDelegate : public TestWindowDelegate { | 1032 class MouseEnterExitWindowDelegate : public TestWindowDelegate { |
| 1033 public: | 1033 public: |
| 1034 MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {} | 1034 MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {} |
| 1035 | 1035 |
| 1036 virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 1036 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
| 1037 switch (event->type()) { | 1037 switch (event->type()) { |
| 1038 case ui::ET_MOUSE_ENTERED: | 1038 case ui::ET_MOUSE_ENTERED: |
| 1039 entered_ = true; | 1039 entered_ = true; |
| 1040 break; | 1040 break; |
| 1041 case ui::ET_MOUSE_EXITED: | 1041 case ui::ET_MOUSE_EXITED: |
| 1042 exited_ = true; | 1042 exited_ = true; |
| 1043 break; | 1043 break; |
| 1044 default: | 1044 default: |
| 1045 break; | 1045 break; |
| 1046 } | 1046 } |
| 1047 return false; | 1047 return ui::ER_UNHANDLED; |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 bool entered() const { return entered_; } | 1050 bool entered() const { return entered_; } |
| 1051 bool exited() const { return exited_; } | 1051 bool exited() const { return exited_; } |
| 1052 | 1052 |
| 1053 // Clear the entered / exited states. | 1053 // Clear the entered / exited states. |
| 1054 void ResetExpectations() { | 1054 void ResetExpectations() { |
| 1055 entered_ = false; | 1055 entered_ = false; |
| 1056 exited_ = false; | 1056 exited_ = false; |
| 1057 } | 1057 } |
| (...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2537 // Move |w2| to be a child of |w1|. | 2537 // Move |w2| to be a child of |w1|. |
| 2538 w1->AddChild(w2.get()); | 2538 w1->AddChild(w2.get()); |
| 2539 // Sine we moved in the same root, observer shouldn't be notified. | 2539 // Sine we moved in the same root, observer shouldn't be notified. |
| 2540 EXPECT_EQ("0 0", observer.CountStringAndReset()); | 2540 EXPECT_EQ("0 0", observer.CountStringAndReset()); |
| 2541 // |w2| should still have focus after moving. | 2541 // |w2| should still have focus after moving. |
| 2542 EXPECT_TRUE(w2->HasFocus()); | 2542 EXPECT_TRUE(w2->HasFocus()); |
| 2543 } | 2543 } |
| 2544 | 2544 |
| 2545 } // namespace test | 2545 } // namespace test |
| 2546 } // namespace aura | 2546 } // namespace aura |
| OLD | NEW |