| 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/common/wm_shell.h" | 6 #include "ash/common/wm_shell.h" |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.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 16 matching lines...) Expand all Loading... |
| 27 void Reset() { events_.clear(); } | 27 void Reset() { events_.clear(); } |
| 28 | 28 |
| 29 void OnMouseEvent(ui::MouseEvent* event) override { | 29 void OnMouseEvent(ui::MouseEvent* event) override { |
| 30 if (!(event->flags() & ui::EF_LEFT_MOUSE_BUTTON)) | 30 if (!(event->flags() & ui::EF_LEFT_MOUSE_BUTTON)) |
| 31 return; | 31 return; |
| 32 // Filter out extraneous mouse events like mouse entered, exited, | 32 // Filter out extraneous mouse events like mouse entered, exited, |
| 33 // capture changed, etc. | 33 // capture changed, etc. |
| 34 ui::EventType type = event->type(); | 34 ui::EventType type = event->type(); |
| 35 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_PRESSED || | 35 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_PRESSED || |
| 36 type == ui::ET_MOUSE_RELEASED) { | 36 type == ui::ET_MOUSE_RELEASED) { |
| 37 events_.push_back(ui::MouseEvent(event->type(), event->location(), | 37 events_.push_back(ui::MouseEvent( |
| 38 event->root_location(), | 38 event->type(), event->location(), event->root_location(), |
| 39 ui::EventTimeForNow(), event->flags(), | 39 ui::EventTimeForNow(), event->flags(), event->changed_button_flags(), |
| 40 event->changed_button_flags())); | 40 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE))); |
| 41 // 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 |
| 42 // might break test assumptions. | 42 // might break test assumptions. |
| 43 event->StopPropagation(); | 43 event->StopPropagation(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 // 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 |
| 47 // 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. |
| 48 ASSERT_LT(events_.size(), 100u); | 48 ASSERT_LT(events_.size(), 100u); |
| 49 } | 49 } |
| 50 | 50 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 aura::test::EventCountDelegate delegate; | 285 aura::test::EventCountDelegate delegate; |
| 286 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( | 286 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( |
| 287 &delegate, 123, gfx::Rect(50, 50, 100, 100))); | 287 &delegate, 123, gfx::Rect(50, 50, 100, 100))); |
| 288 window->Show(); | 288 window->Show(); |
| 289 events = WaitForMouseEvents(); | 289 events = WaitForMouseEvents(); |
| 290 EXPECT_EQ(0u, events.size()); | 290 EXPECT_EQ(0u, events.size()); |
| 291 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset()); | 291 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset()); |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace ash | 294 } // namespace ash |
| OLD | NEW |