| 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 <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 #undef None | 8 #undef None |
| 9 #undef Bool | 9 #undef Bool |
| 10 #undef RootWindow | 10 #undef RootWindow |
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 Shell::GetPrimaryRootWindow()->GetHost()->event_processor(); | 876 Shell::GetPrimaryRootWindow()->GetHost()->event_processor(); |
| 877 Shell::GetInstance()->AddPreTargetHandler(&buffer); | 877 Shell::GetInstance()->AddPreTargetHandler(&buffer); |
| 878 Shell::GetInstance()->sticky_keys_controller()->Enable(true); | 878 Shell::GetInstance()->sticky_keys_controller()->Enable(true); |
| 879 | 879 |
| 880 scoped_ptr<ui::MouseEvent> ev; | 880 scoped_ptr<ui::MouseEvent> ev; |
| 881 SendActivateStickyKeyPattern(dispatcher, ui::VKEY_CONTROL); | 881 SendActivateStickyKeyPattern(dispatcher, ui::VKEY_CONTROL); |
| 882 buffer.PopEvents(&events); | 882 buffer.PopEvents(&events); |
| 883 | 883 |
| 884 // Test mouse press event is correctly modified and has correct DIP location. | 884 // Test mouse press event is correctly modified and has correct DIP location. |
| 885 gfx::Point physical_location(400, 400); | 885 gfx::Point physical_location(400, 400); |
| 886 gfx::Point dip_location(physical_location.x() / scale_factor, | 886 gfx::PointF dip_location(physical_location.x() / scale_factor, |
| 887 physical_location.y() / scale_factor); | 887 physical_location.y() / scale_factor); |
| 888 ev.reset(GenerateMouseEventAt(true, physical_location)); | 888 ev.reset(GenerateMouseEventAt(true, physical_location)); |
| 889 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(ev.get()); | 889 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(ev.get()); |
| 890 buffer.PopEvents(&events); | 890 buffer.PopEvents(&events); |
| 891 EXPECT_EQ(1u, events.size()); | 891 EXPECT_EQ(1u, events.size()); |
| 892 EXPECT_EQ(ui::ET_MOUSE_PRESSED, events[0]->type()); | 892 EXPECT_EQ(ui::ET_MOUSE_PRESSED, events[0]->type()); |
| 893 EXPECT_TRUE(events[0]->flags() & ui::EF_CONTROL_DOWN); | 893 EXPECT_TRUE(events[0]->flags() & ui::EF_CONTROL_DOWN); |
| 894 EXPECT_EQ(dip_location.ToString(), | 894 EXPECT_EQ(dip_location.ToString(), |
| 895 static_cast<ui::MouseEvent*>(events[0])->location().ToString()); | 895 static_cast<ui::MouseEvent*>(events[0])->location().ToString()); |
| 896 | 896 |
| 897 // Test mouse release event is correctly modified and modifier release | 897 // Test mouse release event is correctly modified and modifier release |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 static_cast<ui::KeyEvent*>(events[1])->key_code()); | 998 static_cast<ui::KeyEvent*>(events[1])->key_code()); |
| 999 | 999 |
| 1000 Shell::GetInstance()->RemovePreTargetHandler(&buffer); | 1000 Shell::GetInstance()->RemovePreTargetHandler(&buffer); |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 INSTANTIATE_TEST_CASE_P(DPIScaleFactors, | 1003 INSTANTIATE_TEST_CASE_P(DPIScaleFactors, |
| 1004 StickyKeysMouseDispatchTest, | 1004 StickyKeysMouseDispatchTest, |
| 1005 ::testing::Values(1, 2)); | 1005 ::testing::Values(1, 2)); |
| 1006 | 1006 |
| 1007 } // namespace ash | 1007 } // namespace ash |
| OLD | NEW |