Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc

Issue 959923002: Fix CapsLock remapping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/events/ozone/evdev/event_modifiers_evdev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <linux/input.h> 5 #include <linux/input.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 ui::MockEventConverterEvdevImpl* dev = device(); 337 ui::MockEventConverterEvdevImpl* dev = device();
338 338
339 struct input_event mock_kernel_queue[] = { 339 struct input_event mock_kernel_queue[] = {
340 {{0, 0}, EV_MSC, MSC_SCAN, 0x70039}, 340 {{0, 0}, EV_MSC, MSC_SCAN, 0x70039},
341 {{0, 0}, EV_KEY, KEY_CAPSLOCK, 1}, 341 {{0, 0}, EV_KEY, KEY_CAPSLOCK, 1},
342 {{0, 0}, EV_SYN, SYN_REPORT, 0}, 342 {{0, 0}, EV_SYN, SYN_REPORT, 0},
343 343
344 {{0, 0}, EV_MSC, MSC_SCAN, 0x70039}, 344 {{0, 0}, EV_MSC, MSC_SCAN, 0x70039},
345 {{0, 0}, EV_KEY, KEY_CAPSLOCK, 0}, 345 {{0, 0}, EV_KEY, KEY_CAPSLOCK, 0},
346 {{0, 0}, EV_SYN, SYN_REPORT, 0}, 346 {{0, 0}, EV_SYN, SYN_REPORT, 0},
347
348 {{0, 0}, EV_MSC, MSC_SCAN, 0x70014},
349 {{0, 0}, EV_KEY, KEY_Q, 1},
350 {{0, 0}, EV_SYN, SYN_REPORT, 0},
351
352 {{0, 0}, EV_MSC, MSC_SCAN, 0x70014},
353 {{0, 0}, EV_KEY, KEY_Q, 0},
354 {{0, 0}, EV_SYN, SYN_REPORT, 0},
355
356 {{0, 0}, EV_MSC, MSC_SCAN, 0x70039},
357 {{0, 0}, EV_KEY, KEY_CAPSLOCK, 1},
358 {{0, 0}, EV_SYN, SYN_REPORT, 0},
359
360 {{0, 0}, EV_MSC, MSC_SCAN, 0x70039},
361 {{0, 0}, EV_KEY, KEY_CAPSLOCK, 0},
362 {{0, 0}, EV_SYN, SYN_REPORT, 0},
363 }; 347 };
364 348
365 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); 349 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue));
366 EXPECT_EQ(6u, size()); 350 EXPECT_EQ(2u, size());
367 351
368 ui::KeyEvent* event; 352 ui::KeyEvent* event;
369 353
370 event = dispatched_event(0); 354 event = dispatched_event(0);
371 EXPECT_EQ(ui::ET_KEY_PRESSED, event->type()); 355 EXPECT_EQ(ui::ET_KEY_PRESSED, event->type());
372 EXPECT_EQ(ui::VKEY_CAPITAL, event->key_code()); 356 EXPECT_EQ(ui::VKEY_CAPITAL, event->key_code());
373 EXPECT_EQ(ui::EF_CAPS_LOCK_DOWN, event->flags()); 357 EXPECT_EQ(ui::EF_MOD3_DOWN, event->flags());
374 358
375 event = dispatched_event(1); 359 event = dispatched_event(1);
376 EXPECT_EQ(ui::ET_KEY_RELEASED, event->type()); 360 EXPECT_EQ(ui::ET_KEY_RELEASED, event->type());
377 EXPECT_EQ(ui::VKEY_CAPITAL, event->key_code()); 361 EXPECT_EQ(ui::VKEY_CAPITAL, event->key_code());
378 EXPECT_EQ(ui::EF_CAPS_LOCK_DOWN, event->flags()); 362 EXPECT_EQ(ui::EF_NONE, event->flags());
379
380 event = dispatched_event(2);
381 EXPECT_EQ(ui::ET_KEY_PRESSED, event->type());
382 EXPECT_EQ(ui::VKEY_Q, event->key_code());
383 EXPECT_EQ(ui::EF_CAPS_LOCK_DOWN, event->flags());
384
385 event = dispatched_event(3);
386 EXPECT_EQ(ui::ET_KEY_RELEASED, event->type());
387 EXPECT_EQ(ui::VKEY_Q, event->key_code());
388 EXPECT_EQ(ui::EF_CAPS_LOCK_DOWN, event->flags());
389
390 event = dispatched_event(4);
391 EXPECT_EQ(ui::ET_KEY_PRESSED, event->type());
392 EXPECT_EQ(ui::VKEY_CAPITAL, event->key_code());
393 EXPECT_EQ(0, event->flags());
394
395 event = dispatched_event(5);
396 EXPECT_EQ(ui::ET_KEY_RELEASED, event->type());
397 EXPECT_EQ(ui::VKEY_CAPITAL, event->key_code());
398 EXPECT_EQ(0, event->flags());
399 } 363 }
400 364
401 TEST_F(EventConverterEvdevImplTest, MouseButton) { 365 TEST_F(EventConverterEvdevImplTest, MouseButton) {
402 ui::MockEventConverterEvdevImpl* dev = device(); 366 ui::MockEventConverterEvdevImpl* dev = device();
403 367
404 struct input_event mock_kernel_queue[] = { 368 struct input_event mock_kernel_queue[] = {
405 {{0, 0}, EV_KEY, BTN_LEFT, 1}, 369 {{0, 0}, EV_KEY, BTN_LEFT, 1},
406 {{0, 0}, EV_SYN, SYN_REPORT, 0}, 370 {{0, 0}, EV_SYN, SYN_REPORT, 0},
407 371
408 {{0, 0}, EV_KEY, BTN_LEFT, 0}, 372 {{0, 0}, EV_KEY, BTN_LEFT, 0},
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 {{0, 0}, EV_KEY, BTN_TOUCH, 1}, 413 {{0, 0}, EV_KEY, BTN_TOUCH, 1},
450 {{0, 0}, EV_SYN, SYN_REPORT, 0}, 414 {{0, 0}, EV_SYN, SYN_REPORT, 0},
451 415
452 {{0, 0}, EV_KEY, BTN_TOUCH, 0}, 416 {{0, 0}, EV_KEY, BTN_TOUCH, 0},
453 {{0, 0}, EV_SYN, SYN_REPORT, 0}, 417 {{0, 0}, EV_SYN, SYN_REPORT, 0},
454 }; 418 };
455 419
456 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); 420 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue));
457 EXPECT_EQ(0u, size()); 421 EXPECT_EQ(0u, size());
458 } 422 }
OLDNEW
« no previous file with comments | « no previous file | ui/events/ozone/evdev/event_modifiers_evdev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698