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 <X11/XKBlib.h> |
| 6 #include <X11/Xlib.h> |
| 7 #include <X11/Xutil.h> |
| 8 #include <X11/extensions/XInput2.h> |
5 #include <cstring> | 9 #include <cstring> |
6 #include <set> | 10 #include <set> |
7 | 11 #include <utility> |
8 #include <X11/extensions/XInput2.h> | |
9 #include <X11/Xlib.h> | |
10 #include <X11/Xutil.h> | |
11 #include <X11/XKBlib.h> | |
12 | 12 |
13 // Generically-named #defines from Xlib that conflict with symbols in GTest. | 13 // Generically-named #defines from Xlib that conflict with symbols in GTest. |
14 #undef Bool | 14 #undef Bool |
15 #undef None | 15 #undef None |
16 | 16 |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "ui/events/devices/x11/device_data_manager_x11.h" | 19 #include "ui/events/devices/x11/device_data_manager_x11.h" |
20 #include "ui/events/devices/x11/touch_factory_x11.h" | 20 #include "ui/events/devices/x11/touch_factory_x11.h" |
21 #include "ui/events/event.h" | 21 #include "ui/events/event.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 DeviceDataManagerX11* device_data_manager = | 371 DeviceDataManagerX11* device_data_manager = |
372 static_cast<DeviceDataManagerX11*>( | 372 static_cast<DeviceDataManagerX11*>( |
373 DeviceDataManager::GetInstance()); | 373 DeviceDataManager::GetInstance()); |
374 int blocked_device_id = 1; | 374 int blocked_device_id = 1; |
375 int other_device_id = 2; | 375 int other_device_id = 2; |
376 int master_device_id = 3; | 376 int master_device_id = 3; |
377 device_data_manager->DisableDevice(blocked_device_id); | 377 device_data_manager->DisableDevice(blocked_device_id); |
378 | 378 |
379 scoped_ptr<std::set<KeyboardCode> > excepted_keys(new std::set<KeyboardCode>); | 379 scoped_ptr<std::set<KeyboardCode> > excepted_keys(new std::set<KeyboardCode>); |
380 excepted_keys->insert(VKEY_B); | 380 excepted_keys->insert(VKEY_B); |
381 device_data_manager->SetDisabledKeyboardAllowedKeys(excepted_keys.Pass()); | 381 device_data_manager->SetDisabledKeyboardAllowedKeys(std::move(excepted_keys)); |
382 | 382 |
383 ScopedXI2Event xev; | 383 ScopedXI2Event xev; |
384 // A is not allowed on the blocked keyboard, and should return ET_UNKNOWN. | 384 // A is not allowed on the blocked keyboard, and should return ET_UNKNOWN. |
385 xev.InitGenericKeyEvent(master_device_id, | 385 xev.InitGenericKeyEvent(master_device_id, |
386 blocked_device_id, | 386 blocked_device_id, |
387 ui::ET_KEY_PRESSED, | 387 ui::ET_KEY_PRESSED, |
388 ui::VKEY_A, | 388 ui::VKEY_A, |
389 0); | 389 0); |
390 EXPECT_EQ(ui::ET_UNKNOWN, ui::EventTypeFromNative(xev)); | 390 EXPECT_EQ(ui::ET_UNKNOWN, ui::EventTypeFromNative(xev)); |
391 | 391 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 ui::SetUpPointerDevicesForTest(devices); | 500 ui::SetUpPointerDevicesForTest(devices); |
501 | 501 |
502 ScopedXI2Event xev; | 502 ScopedXI2Event xev; |
503 xev.InitScrollEvent(device_id, 1, 2, 3, 4, 1); | 503 xev.InitScrollEvent(device_id, 1, 2, 3, 4, 1); |
504 // We shouldn't produce a mouse move event on a mouse wheel | 504 // We shouldn't produce a mouse move event on a mouse wheel |
505 // scroll. These events are only produced for some mice. | 505 // scroll. These events are only produced for some mice. |
506 EXPECT_EQ(ui::ET_UNKNOWN, ui::EventTypeFromNative(xev)); | 506 EXPECT_EQ(ui::ET_UNKNOWN, ui::EventTypeFromNative(xev)); |
507 } | 507 } |
508 | 508 |
509 } // namespace ui | 509 } // namespace ui |
OLD | NEW |