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

Side by Side Diff: app/keyboard_code_conversion_unittest.cc

Issue 3337006: Revert 58388 - Revert 58215 - Revert 58186 - Move the keyboard files from bas... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « app/keyboard_code_conversion_mac.mm ('k') | app/keyboard_code_conversion_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "app/keyboard_code_conversion.h"
6 #include "app/keyboard_codes.h"
7 #include "base/logging.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace app {
11
12 TEST(KeyCodeFromKeyIdentifierTest, MatchOnIdentifier) {
13 EXPECT_EQ(app::VKEY_APPS, KeyCodeFromKeyIdentifier("Apps"));
14 EXPECT_EQ(app::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("Nonsense"));
15 }
16
17 TEST(KeyCodeFromKeyIdentifierTest, MatchOnCharacter) {
18 EXPECT_EQ(app::VKEY_A, KeyCodeFromKeyIdentifier("a"));
19 EXPECT_EQ(app::VKEY_A, KeyCodeFromKeyIdentifier("A"));
20 EXPECT_EQ(app::VKEY_OEM_PERIOD, KeyCodeFromKeyIdentifier(">"));
21
22 std::string non_printing_char(" ");
23 non_printing_char[0] = static_cast<char>(1);
24 EXPECT_EQ(app::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier(non_printing_char));
25 }
26
27 TEST(KeyCodeFromKeyIdentifierTest, MatchOnUnicodeCodepoint) {
28 EXPECT_EQ(app::VKEY_A, KeyCodeFromKeyIdentifier("U+0041"));
29 EXPECT_EQ(app::VKEY_A, KeyCodeFromKeyIdentifier("U+0061"));
30 EXPECT_EQ(app::VKEY_DELETE, KeyCodeFromKeyIdentifier("U+007F"));
31
32 // this one exists in the map, but has no valid VKEY
33 EXPECT_EQ(app::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("U+030A"));
34
35 // this one is not in the map
36 EXPECT_EQ(app::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("U+0001"));
37 }
38
39 TEST(KeyCodeFromKeyIdentifierTest, DoesNotMatchEmptyString) {
40 EXPECT_EQ(app::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier(""));
41 }
42
43 } // namespace app
OLDNEW
« no previous file with comments | « app/keyboard_code_conversion_mac.mm ('k') | app/keyboard_code_conversion_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698