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

Side by Side Diff: base/keyboard_code_conversion_unittest.cc

Issue 3165064: Move the keyboard files from base/ to app/. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: latest merge Created 10 years, 4 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 | « base/base.gypi ('k') | base/win_util.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 "base/keyboard_code_conversion.h"
6 #include "base/keyboard_codes.h"
7 #include "base/logging.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace base {
11
12 TEST(KeyCodeFromKeyIdentifierTest, MatchOnIdentifier) {
13 EXPECT_EQ(base::VKEY_APPS, KeyCodeFromKeyIdentifier("Apps"));
14 EXPECT_EQ(base::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("Nonsense"));
15 }
16
17 TEST(KeyCodeFromKeyIdentifierTest, MatchOnCharacter) {
18 EXPECT_EQ(base::VKEY_A, KeyCodeFromKeyIdentifier("a"));
19 EXPECT_EQ(base::VKEY_A, KeyCodeFromKeyIdentifier("A"));
20 EXPECT_EQ(base::VKEY_OEM_PERIOD, KeyCodeFromKeyIdentifier(">"));
21
22 std::string non_printing_char(" ");
23 non_printing_char[0] = static_cast<char>(1);
24 EXPECT_EQ(base::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier(non_printing_char));
25 }
26
27 TEST(KeyCodeFromKeyIdentifierTest, MatchOnUnicodeCodepoint) {
28 EXPECT_EQ(base::VKEY_A, KeyCodeFromKeyIdentifier("U+0041"));
29 EXPECT_EQ(base::VKEY_A, KeyCodeFromKeyIdentifier("U+0061"));
30 EXPECT_EQ(base::VKEY_DELETE, KeyCodeFromKeyIdentifier("U+007F"));
31
32 // this one exists in the map, but has no valid VKEY
33 EXPECT_EQ(base::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("U+030A"));
34
35 // this one is not in the map
36 EXPECT_EQ(base::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("U+0001"));
37 }
38
39 TEST(KeyCodeFromKeyIdentifierTest, DoesNotMatchEmptyString) {
40 EXPECT_EQ(base::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier(""));
41 }
42
43 } // namespace base
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/win_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698