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/layout/keyboard_layout_engine_unittest.cc

Issue 1560293002: Rename KEY_ constants to avoid conflict with <linux/input.h> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments (Wez) Created 4 years, 11 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/events/event.h" 7 #include "ui/events/event.h"
8 #include "ui/events/event_constants.h" 8 #include "ui/events/event_constants.h"
9 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
10 #include "ui/events/keycodes/dom/dom_code.h" 10 #include "ui/events/keycodes/dom/dom_code.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 "modifier_map Mod4{<HYPR>};};};"; 178 "modifier_map Mod4{<HYPR>};};};";
179 179
180 void TestLookup(const char* name, KeyboardLayoutEngine* engine) { 180 void TestLookup(const char* name, KeyboardLayoutEngine* engine) {
181 static const struct { 181 static const struct {
182 DomCode input_dom_code; 182 DomCode input_dom_code;
183 int input_flags; 183 int input_flags;
184 DomKey::Base output_dom_key; 184 DomKey::Base output_dom_key;
185 KeyboardCode output_keycode; 185 KeyboardCode output_keycode;
186 base::char16 output_character; 186 base::char16 output_character;
187 } kTestCases[] = { 187 } kTestCases[] = {
188 {DomCode::KEY_A, EF_NONE, DomKey::Constant<'a'>::Character, VKEY_A, 'a'}, 188 {DomCode::US_A, EF_NONE, DomKey::Constant<'a'>::Character, VKEY_A, 'a'},
189 {DomCode::KEY_A, EF_SHIFT_DOWN, DomKey::Constant<'A'>::Character, VKEY_A, 189 {DomCode::US_A, EF_SHIFT_DOWN, DomKey::Constant<'A'>::Character, VKEY_A,
190 'A'}, 190 'A'},
191 {DomCode::KEY_A, EF_CONTROL_DOWN, DomKey::Constant<'a'>::Character, 191 {DomCode::US_A, EF_CONTROL_DOWN, DomKey::Constant<'a'>::Character,
192 VKEY_A, 1}, 192 VKEY_A, 1},
193 }; 193 };
194 194
195 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr(engine)); 195 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr(engine));
196 196
197 for (const auto& t : kTestCases) { 197 for (const auto& t : kTestCases) {
198 DomKey dom_key; 198 DomKey dom_key;
199 KeyboardCode keycode; 199 KeyboardCode keycode;
200 SCOPED_TRACE(base::StringPrintf( 200 SCOPED_TRACE(base::StringPrintf(
201 "%s(%s, 0x%X)", name, 201 "%s(%s, 0x%X)", name,
(...skipping 16 matching lines...) Expand all
218 TestLookup("StubKeyboardLayoutEngine", new StubKeyboardLayoutEngine()); 218 TestLookup("StubKeyboardLayoutEngine", new StubKeyboardLayoutEngine());
219 219
220 XkbEvdevCodes xkb_evdev_code_converter; 220 XkbEvdevCodes xkb_evdev_code_converter;
221 XkbKeyboardLayoutEngine* xkb_engine = 221 XkbKeyboardLayoutEngine* xkb_engine =
222 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter); 222 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter);
223 xkb_engine->SetKeymapFromStringForTest(kUsLayoutXkbKeymap); 223 xkb_engine->SetKeymapFromStringForTest(kUsLayoutXkbKeymap);
224 TestLookup("XkbKeyboardLayoutEngine", xkb_engine); 224 TestLookup("XkbKeyboardLayoutEngine", xkb_engine);
225 } 225 }
226 226
227 } // namespace ui 227 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/keyboard_evdev.cc ('k') | ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698