| 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
|
|
|