| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 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/logging.h" |
| 6 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 #if defined(USE_VIRTUAL_KEYBOARD) |
| 10 // Since USE_VIRTUAL_KEYBOARD build only supports a few keyboard layouts, we |
| 11 // skip the tests for now. |
| 12 #define TestInputMethodIdIsWhitelisted DISABLED_TestInputMethodIdIsWhitelisted |
| 13 #define TestXkbLayoutIsSupported DISABLED_TestXkbLayoutIsSupported |
| 14 #endif // USE_VIRTUAL_KEYBOARD |
| 15 |
| 16 namespace chromeos { |
| 17 namespace input_method { |
| 18 |
| 19 namespace { |
| 20 |
| 21 class InputMethodWhitelistTest : public testing::Test { |
| 22 protected: |
| 23 const InputMethodWhitelist whitelist_; |
| 24 }; |
| 25 |
| 26 } // namespace |
| 27 |
| 28 TEST_F(InputMethodWhitelistTest, TestInputMethodIdIsWhitelisted) { |
| 29 EXPECT_TRUE(whitelist_.InputMethodIdIsWhitelisted("mozc")); |
| 30 EXPECT_TRUE(whitelist_.InputMethodIdIsWhitelisted("xkb:us:dvorak:eng")); |
| 31 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("mozc,")); |
| 32 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("mozc,xkb:us:dvorak:eng")); |
| 33 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("not-supported-id")); |
| 34 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted(",")); |
| 35 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("")); |
| 36 } |
| 37 |
| 38 TEST_F(InputMethodWhitelistTest, TestXkbLayoutIsSupported) { |
| 39 EXPECT_TRUE(whitelist_.XkbLayoutIsSupported("us")); |
| 40 EXPECT_TRUE(whitelist_.XkbLayoutIsSupported("us(dvorak)")); |
| 41 EXPECT_TRUE(whitelist_.XkbLayoutIsSupported("fr")); |
| 42 EXPECT_FALSE(whitelist_.XkbLayoutIsSupported("us,")); |
| 43 EXPECT_FALSE(whitelist_.XkbLayoutIsSupported("us,fr")); |
| 44 EXPECT_FALSE(whitelist_.XkbLayoutIsSupported("xkb:us:dvorak:eng")); |
| 45 EXPECT_FALSE(whitelist_.XkbLayoutIsSupported("mozc")); |
| 46 EXPECT_FALSE(whitelist_.XkbLayoutIsSupported(",")); |
| 47 EXPECT_FALSE(whitelist_.XkbLayoutIsSupported("")); |
| 48 } |
| 49 |
| 50 } // namespace input_method |
| 51 } // namespace chromeos |
| OLD | NEW |