| 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/sticky_keys/sticky_keys_controller.h" | 5 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 6 | 6 |
| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 ui::MouseEvent* GenerateSynthesizedMouseEventAt(ui::EventType event_type, | 162 ui::MouseEvent* GenerateSynthesizedMouseEventAt(ui::EventType event_type, |
| 163 const gfx::Point& location) { | 163 const gfx::Point& location) { |
| 164 ui::MouseEvent* event; | 164 ui::MouseEvent* event; |
| 165 if (event_type == ui::ET_MOUSEWHEEL) { | 165 if (event_type == ui::ET_MOUSEWHEEL) { |
| 166 event = new ui::MouseWheelEvent( | 166 event = new ui::MouseWheelEvent( |
| 167 gfx::Vector2d(), location, location, ui::EventTimeForNow(), | 167 gfx::Vector2d(), location, location, ui::EventTimeForNow(), |
| 168 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 168 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| 169 } else { | 169 } else { |
| 170 event = new ui::MouseEvent( | 170 event = new ui::MouseEvent( |
| 171 event_type, location, location, ui::EventTimeForNow(), | 171 event_type, location, location, ui::EventTimeForNow(), |
| 172 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 172 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 173 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 173 } | 174 } |
| 174 ui::Event::DispatcherApi dispatcher(event); | 175 ui::Event::DispatcherApi dispatcher(event); |
| 175 dispatcher.set_target(target_); | 176 dispatcher.set_target(target_); |
| 176 return event; | 177 return event; |
| 177 } | 178 } |
| 178 | 179 |
| 179 // Creates a synthesized mouse press or release event. | 180 // Creates a synthesized mouse press or release event. |
| 180 ui::MouseEvent* GenerateSynthesizedMouseClickEvent( | 181 ui::MouseEvent* GenerateSynthesizedMouseClickEvent( |
| 181 ui::EventType type, | 182 ui::EventType type, |
| 182 const gfx::Point& location) { | 183 const gfx::Point& location) { |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 gfx::Point(0, 0))); | 743 gfx::Point(0, 0))); |
| 743 released = false; | 744 released = false; |
| 744 mod_down_flags = 0; | 745 mod_down_flags = 0; |
| 745 sticky_key.HandleMouseEvent(*mev.get(), &mod_down_flags, &released); | 746 sticky_key.HandleMouseEvent(*mev.get(), &mod_down_flags, &released); |
| 746 EXPECT_TRUE(mod_down_flags & ui::EF_CONTROL_DOWN); | 747 EXPECT_TRUE(mod_down_flags & ui::EF_CONTROL_DOWN); |
| 747 EXPECT_TRUE(released); | 748 EXPECT_TRUE(released); |
| 748 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, sticky_key.current_state()); | 749 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, sticky_key.current_state()); |
| 749 } | 750 } |
| 750 | 751 |
| 751 } // namespace ash | 752 } // namespace ash |
| OLD | NEW |