| 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 "ui/events/keycodes/dom4/keycode_converter.h" | 5 #include "ui/events/keycodes/dom4/keycode_converter.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 using ui::KeycodeConverter; | 12 using ui::KeycodeConverter; |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 #if defined(OS_WIN) | 16 #if defined(OS_LINUX) |
| 17 const size_t kExpectedMappedKeyCount = 138; | |
| 18 #elif defined(OS_LINUX) | |
| 19 const size_t kExpectedMappedKeyCount = 145; | 17 const size_t kExpectedMappedKeyCount = 145; |
| 20 #elif defined(OS_MACOSX) | |
| 21 const size_t kExpectedMappedKeyCount = 118; | |
| 22 #else | 18 #else |
| 23 const size_t kExpectedMappedKeyCount = 0; | 19 const size_t kExpectedMappedKeyCount = 0; |
| 24 #endif | 20 #endif |
| 25 | 21 |
| 26 const uint32_t kUsbNonExistentKeycode = 0xffffff; | 22 const uint32_t kUsbNonExistentKeycode = 0xffffff; |
| 27 const uint32_t kUsbUsBackslash = 0x070031; | 23 const uint32_t kUsbUsBackslash = 0x070031; |
| 28 const uint32_t kUsbNonUsHash = 0x070032; | 24 const uint32_t kUsbNonUsHash = 0x070032; |
| 29 | 25 |
| 30 TEST(UsbKeycodeMap, Basic) { | 26 TEST(UsbKeycodeMap, Basic) { |
| 31 // Verify that the first element in the table is the "invalid" code. | 27 // Verify that the first element in the table is the "invalid" code. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 99 } |
| 104 | 100 |
| 105 TEST(UsbKeycodeMap, UsBackslashIsNonUsHash) { | 101 TEST(UsbKeycodeMap, UsBackslashIsNonUsHash) { |
| 106 // Verify that UsbKeycodeToNativeKeycode treats the non-US "hash" key | 102 // Verify that UsbKeycodeToNativeKeycode treats the non-US "hash" key |
| 107 // as equivalent to the US "backslash" key. | 103 // as equivalent to the US "backslash" key. |
| 108 EXPECT_EQ(ui::KeycodeConverter::UsbKeycodeToNativeKeycode(kUsbUsBackslash), | 104 EXPECT_EQ(ui::KeycodeConverter::UsbKeycodeToNativeKeycode(kUsbUsBackslash), |
| 109 ui::KeycodeConverter::UsbKeycodeToNativeKeycode(kUsbNonUsHash)); | 105 ui::KeycodeConverter::UsbKeycodeToNativeKeycode(kUsbNonUsHash)); |
| 110 } | 106 } |
| 111 | 107 |
| 112 } // namespace | 108 } // namespace |
| OLD | NEW |