OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "chromeos/ime/input_method_whitelist.h" | 6 #include "chromeos/ime/input_method_whitelist.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace chromeos { | 9 namespace chromeos { |
10 namespace input_method { | 10 namespace input_method { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 class InputMethodWhitelistTest : public testing::Test { | 14 class InputMethodWhitelistTest : public testing::Test { |
15 protected: | 15 protected: |
16 const InputMethodWhitelist whitelist_; | 16 const InputMethodWhitelist whitelist_; |
17 }; | 17 }; |
18 | 18 |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 TEST_F(InputMethodWhitelistTest, TestInputMethodIdIsWhitelisted) { | 21 TEST_F(InputMethodWhitelistTest, TestInputMethodIdIsWhitelisted) { |
22 EXPECT_TRUE(whitelist_.InputMethodIdIsWhitelisted("pinyin")); | |
23 EXPECT_TRUE(whitelist_.InputMethodIdIsWhitelisted("xkb:us:dvorak:eng")); | 22 EXPECT_TRUE(whitelist_.InputMethodIdIsWhitelisted("xkb:us:dvorak:eng")); |
24 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("mozc,")); | 23 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("mozc,")); |
25 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted( | 24 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted( |
26 "mozc-pinyin,xkb:us:dvorak:eng")); | 25 "mozc-pinyin,xkb:us:dvorak:eng")); |
27 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("not-supported-id")); | 26 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("not-supported-id")); |
28 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted(",")); | 27 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted(",")); |
29 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("")); | 28 EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("")); |
30 } | 29 } |
31 | 30 |
32 } // namespace input_method | 31 } // namespace input_method |
33 } // namespace chromeos | 32 } // namespace chromeos |
OLD | NEW |