| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/autoclick/autoclick_controller.h" | 5 #include "ash/autoclick/autoclick_controller.h" |
| 6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
| 7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
| 8 #include "ui/aura/test/event_generator.h" | 8 #include "ui/aura/test/event_generator.h" |
| 9 #include "ui/aura/test/test_window_delegate.h" | 9 #include "ui/aura/test/test_window_delegate.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 28 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
| 29 if (!(event->flags() & ui::EF_LEFT_MOUSE_BUTTON)) | 29 if (!(event->flags() & ui::EF_LEFT_MOUSE_BUTTON)) |
| 30 return; | 30 return; |
| 31 // Filter out extraneous mouse events like mouse entered, exited, | 31 // Filter out extraneous mouse events like mouse entered, exited, |
| 32 // capture changed, etc. | 32 // capture changed, etc. |
| 33 ui::EventType type = event->type(); | 33 ui::EventType type = event->type(); |
| 34 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_PRESSED || | 34 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_PRESSED || |
| 35 type == ui::ET_MOUSE_RELEASED) { | 35 type == ui::ET_MOUSE_RELEASED) { |
| 36 events_.push_back(ui::MouseEvent( | 36 events_.push_back(ui::MouseEvent(event->type(), |
| 37 event->type(), | 37 gfx::ToFlooredPoint(event->location()), |
| 38 event->location(), | 38 event->root_location(), |
| 39 event->root_location(), | 39 event->flags(), |
| 40 event->flags(), | 40 event->changed_button_flags())); |
| 41 event->changed_button_flags())); | |
| 42 // Stop event propagation so we don't click on random stuff that | 41 // Stop event propagation so we don't click on random stuff that |
| 43 // might break test assumptions. | 42 // might break test assumptions. |
| 44 event->StopPropagation(); | 43 event->StopPropagation(); |
| 45 } | 44 } |
| 46 | 45 |
| 47 // If there is a possibility that we're in an infinite loop, we should | 46 // If there is a possibility that we're in an infinite loop, we should |
| 48 // exit early with a sensible error rather than letting the test time out. | 47 // exit early with a sensible error rather than letting the test time out. |
| 49 ASSERT_LT(events_.size(), 100u); | 48 ASSERT_LT(events_.size(), 100u); |
| 50 } | 49 } |
| 51 | 50 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 aura::test::EventCountDelegate delegate; | 300 aura::test::EventCountDelegate delegate; |
| 302 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( | 301 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( |
| 303 &delegate, 123, gfx::Rect(50, 50, 100, 100))); | 302 &delegate, 123, gfx::Rect(50, 50, 100, 100))); |
| 304 window->Show(); | 303 window->Show(); |
| 305 events = WaitForMouseEvents(); | 304 events = WaitForMouseEvents(); |
| 306 EXPECT_EQ(0u, events.size()); | 305 EXPECT_EQ(0u, events.size()); |
| 307 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset()); | 306 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset()); |
| 308 } | 307 } |
| 309 | 308 |
| 310 } // namespace ash | 309 } // namespace ash |
| OLD | NEW |