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

Unified Diff: ui/base/events/key_identifier_conversion_unittest.cc

Issue 16972006: Insert text directly from the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix include Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/events/key_identifier_conversion.cc ('k') | ui/keyboard/keyboard_ui_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/events/key_identifier_conversion_unittest.cc
diff --git a/ui/base/events/key_identifier_conversion_unittest.cc b/ui/base/events/key_identifier_conversion_unittest.cc
deleted file mode 100644
index cd862134b0779f27851a25a010c0fcf83fe86da4..0000000000000000000000000000000000000000
--- a/ui/base/events/key_identifier_conversion_unittest.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/events/key_identifier_conversion.h"
-
-#include "base/basictypes.h"
-#include "base/logging.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/base/events/event.h"
-#include "ui/base/keycodes/keyboard_codes.h"
-
-namespace ui {
-
-TEST(KeyEventFromKeyIdentifierTest, MatchOnIdentifier) {
- EXPECT_EQ(ui::VKEY_APPS, KeyEventFromKeyIdentifier("Apps").key_code());
- EXPECT_EQ(ui::VKEY_UNKNOWN,
- KeyEventFromKeyIdentifier("Nonsense").key_code());
-}
-
-TEST(KeyEventFromKeyIdentifierTest, MatchOnCharacter) {
- EXPECT_EQ(ui::VKEY_A, KeyEventFromKeyIdentifier("a").key_code());
- EXPECT_EQ(ui::VKEY_A, KeyEventFromKeyIdentifier("A").key_code());
- EXPECT_EQ(ui::VKEY_OEM_PERIOD, KeyEventFromKeyIdentifier(">").key_code());
-
- std::string non_printing_char(" ");
- non_printing_char[0] = static_cast<char>(1);
- EXPECT_EQ(ui::VKEY_UNKNOWN,
- KeyEventFromKeyIdentifier(non_printing_char).key_code());
-}
-
-TEST(KeyEventFromKeyIdentifierTest, MatchOnUnicodeCodepoint) {
- EXPECT_EQ(ui::VKEY_A, KeyEventFromKeyIdentifier("U+0041").key_code());
- EXPECT_EQ(ui::VKEY_A, KeyEventFromKeyIdentifier("U+0061").key_code());
- EXPECT_EQ(ui::VKEY_DELETE, KeyEventFromKeyIdentifier("U+007F").key_code());
-
- // this one exists in the map, but has no valid ui::VKEY
- EXPECT_EQ(ui::VKEY_UNKNOWN, KeyEventFromKeyIdentifier("U+030A").key_code());
-
- // this one is not in the map
- EXPECT_EQ(ui::VKEY_UNKNOWN, KeyEventFromKeyIdentifier("U+0001").key_code());
-}
-
-TEST(KeyEventFromKeyIdentifierTest, DoesNotMatchEmptyString) {
- EXPECT_EQ(ui::VKEY_UNKNOWN, KeyEventFromKeyIdentifier("").key_code());
-}
-
-TEST(KeyEventFromKeyIdentifierTest, ShiftModifiersAreSet) {
- EXPECT_EQ(0, KeyEventFromKeyIdentifier("1").flags());
-
- const char* keys_with_shift[] = {
- "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+",
- "{", "}", "|", ":", "<", ">", "?", "\""
- };
- int kNumKeysWithShift = arraysize(keys_with_shift);
-
- for (int i = 0; i < kNumKeysWithShift; ++i) {
- EXPECT_EQ(ui::EF_SHIFT_DOWN,
- KeyEventFromKeyIdentifier(keys_with_shift[i]).flags());
- }
-}
-
-} // namespace ui
« no previous file with comments | « ui/base/events/key_identifier_conversion.cc ('k') | ui/keyboard/keyboard_ui_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698