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

Unified Diff: chrome/browser/chromeos/input_method/input_method_whitelist_unittest.cc

Issue 9701095: cleanup: Split ibus_controller.h into 5 headers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix Created 8 years, 9 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
Index: chrome/browser/chromeos/input_method/input_method_whitelist_unittest.cc
diff --git a/chrome/browser/chromeos/input_method/input_method_whitelist_unittest.cc b/chrome/browser/chromeos/input_method/input_method_whitelist_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..705266a313ffec94db538067120523e9802a49a7
--- /dev/null
+++ b/chrome/browser/chromeos/input_method/input_method_whitelist_unittest.cc
@@ -0,0 +1,51 @@
+// Copyright (c) 2012 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 "base/logging.h"
+#include "chrome/browser/chromeos/input_method/input_method_whitelist.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+#if defined(USE_VIRTUAL_KEYBOARD)
+// Since USE_VIRTUAL_KEYBOARD build only supports a few keyboard layouts, we
+// skip the tests for now.
+#define TestInputMethodIdIsWhitelisted DISABLED_TestInputMethodIdIsWhitelisted
+#define TestXkbLayoutIsSupported DISABLED_TestXkbLayoutIsSupported
+#endif // USE_VIRTUAL_KEYBOARD
+
+namespace chromeos {
+namespace input_method {
+
+namespace {
+
+class InputMethodWhitelistTest : public testing::Test {
+ protected:
+ const InputMethodWhitelist whitelist_;
+};
+
+} // namespace
+
+TEST_F(InputMethodWhitelistTest, TestInputMethodIdIsWhitelisted) {
+ EXPECT_TRUE(whitelist_.InputMethodIdIsWhitelisted("mozc"));
+ EXPECT_TRUE(whitelist_.InputMethodIdIsWhitelisted("xkb:us:dvorak:eng"));
+ EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("mozc,"));
+ EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("mozc,xkb:us:dvorak:eng"));
+ EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("not-supported-id"));
+ EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted(","));
+ EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted(""));
+}
+
+TEST_F(InputMethodWhitelistTest, TestXkbLayoutIsSupported) {
+ EXPECT_TRUE(whitelist_.XkbLayoutIsSupported("us"));
+ EXPECT_TRUE(whitelist_.XkbLayoutIsSupported("us(dvorak)"));
+ EXPECT_TRUE(whitelist_.XkbLayoutIsSupported("fr"));
+ EXPECT_FALSE(whitelist_.XkbLayoutIsSupported("us,"));
+ EXPECT_FALSE(whitelist_.XkbLayoutIsSupported("us,fr"));
+ EXPECT_FALSE(whitelist_.XkbLayoutIsSupported("xkb:us:dvorak:eng"));
+ EXPECT_FALSE(whitelist_.XkbLayoutIsSupported("mozc"));
+ EXPECT_FALSE(whitelist_.XkbLayoutIsSupported(","));
+ EXPECT_FALSE(whitelist_.XkbLayoutIsSupported(""));
+}
+
+} // namespace input_method
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698