| Index: ui/events/x/events_x_unittest.cc
|
| diff --git a/ui/events/x/events_x_unittest.cc b/ui/events/x/events_x_unittest.cc
|
| index e64fc197221e98bb4880becdf07b6d9f7b3e5454..d8e2c8314ca967c1a968f986288e0e14a2279740 100644
|
| --- a/ui/events/x/events_x_unittest.cc
|
| +++ b/ui/events/x/events_x_unittest.cc
|
| @@ -517,6 +517,7 @@ TEST_F(EventsXTest, DisableKeyboard) {
|
| DeviceDataManager::GetInstance());
|
| unsigned int blocked_device_id = 1;
|
| unsigned int other_device_id = 2;
|
| + unsigned int master_device_id = 3;
|
| device_data_manager->DisableDevice(blocked_device_id);
|
|
|
| scoped_ptr<std::set<KeyboardCode> > excepted_keys(new std::set<KeyboardCode>);
|
| @@ -525,17 +526,33 @@ TEST_F(EventsXTest, DisableKeyboard) {
|
|
|
| ScopedXI2Event xev;
|
| // A is not allowed on the blocked keyboard, and should return ET_UNKNOWN.
|
| - xev.InitGenericKeyEvent(blocked_device_id, ui::ET_KEY_PRESSED, ui::VKEY_A, 0);
|
| + xev.InitGenericKeyEvent(master_device_id,
|
| + blocked_device_id,
|
| + ui::ET_KEY_PRESSED,
|
| + ui::VKEY_A,
|
| + 0);
|
| EXPECT_EQ(ui::ET_UNKNOWN, ui::EventTypeFromNative(xev));
|
|
|
| // The B key is allowed as an exception, and should return KEY_PRESSED.
|
| - xev.InitGenericKeyEvent(blocked_device_id, ui::ET_KEY_PRESSED, ui::VKEY_B, 0);
|
| + xev.InitGenericKeyEvent(master_device_id,
|
| + blocked_device_id,
|
| + ui::ET_KEY_PRESSED,
|
| + ui::VKEY_B,
|
| + 0);
|
| EXPECT_EQ(ui::ET_KEY_PRESSED, ui::EventTypeFromNative(xev));
|
|
|
| // Both A and B are allowed on an unblocked keyboard device.
|
| - xev.InitGenericKeyEvent(other_device_id, ui::ET_KEY_PRESSED, ui::VKEY_A, 0);
|
| + xev.InitGenericKeyEvent(master_device_id,
|
| + other_device_id,
|
| + ui::ET_KEY_PRESSED,
|
| + ui::VKEY_A,
|
| + 0);
|
| EXPECT_EQ(ui::ET_KEY_PRESSED, ui::EventTypeFromNative(xev));
|
| - xev.InitGenericKeyEvent(other_device_id, ui::ET_KEY_PRESSED, ui::VKEY_B, 0);
|
| + xev.InitGenericKeyEvent(master_device_id,
|
| + other_device_id,
|
| + ui::ET_KEY_PRESSED,
|
| + ui::VKEY_B,
|
| + 0);
|
| EXPECT_EQ(ui::ET_KEY_PRESSED, ui::EventTypeFromNative(xev));
|
|
|
| device_data_manager->EnableDevice(blocked_device_id);
|
| @@ -543,7 +560,11 @@ TEST_F(EventsXTest, DisableKeyboard) {
|
| scoped_ptr<std::set<KeyboardCode> >());
|
|
|
| // A key returns KEY_PRESSED as per usual now that keyboard was re-enabled.
|
| - xev.InitGenericKeyEvent(blocked_device_id, ui::ET_KEY_PRESSED, ui::VKEY_A, 0);
|
| + xev.InitGenericKeyEvent(master_device_id,
|
| + blocked_device_id,
|
| + ui::ET_KEY_PRESSED,
|
| + ui::VKEY_A,
|
| + 0);
|
| EXPECT_EQ(ui::ET_KEY_PRESSED, ui::EventTypeFromNative(xev));
|
| }
|
|
|
|
|