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

Side by Side Diff: chromeos/ime/extension_ime_util_unittest.cc

Issue 12583012: Introduce IsMemberOfExtension function into ExtensionIMEUtil. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/ime/extension_ime_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chromeos/ime/extension_ime_util.h" 5 #include "chromeos/ime/extension_ime_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace chromeos { 11 namespace chromeos {
12 12
13 TEST(ExtensionIMEUtilTest, GetInputMethodIDTest) { 13 TEST(ExtensionIMEUtilTest, GetInputMethodIDTest) {
14 EXPECT_EQ("_ext_ime_ABCDE12345", 14 EXPECT_EQ("_ext_ime_ABCDE12345",
15 extension_ime_util::GetInputMethodID("ABCDE", "12345")); 15 extension_ime_util::GetInputMethodID("ABCDE", "12345"));
16 } 16 }
17 17
18 TEST(ExtensionIMEUtilTest, IsExtensionIMETest) { 18 TEST(ExtensionIMEUtilTest, IsExtensionIMETest) {
19 EXPECT_TRUE(extension_ime_util::IsExtensionIME( 19 EXPECT_TRUE(extension_ime_util::IsExtensionIME(
20 extension_ime_util::GetInputMethodID("abcde", "12345"))); 20 extension_ime_util::GetInputMethodID("abcde", "12345")));
21 EXPECT_FALSE(extension_ime_util::IsExtensionIME("")); 21 EXPECT_FALSE(extension_ime_util::IsExtensionIME(""));
22 EXPECT_FALSE(extension_ime_util::IsExtensionIME("mozc")); 22 EXPECT_FALSE(extension_ime_util::IsExtensionIME("mozc"));
23 } 23 }
24 24
25 TEST(ExtensionIMEUtilTest, IsMemberOfExtension) {
26 const char* extention1 = "abcdefg";
27 const char* extention2 = "hijklmn";
28 const char* engine_id1 = "12345";
29 const char* engine_id2 = "67890";
30
31 const std::string extention_1_engine_1 =
32 extension_ime_util::GetInputMethodID(extention1, engine_id1);
33 const std::string extention_1_engine_2 =
34 extension_ime_util::GetInputMethodID(extention1, engine_id2);
35
36 EXPECT_TRUE(extension_ime_util::IsMemberOfExtension(extention_1_engine_1,
37 extention1));
38 EXPECT_TRUE(extension_ime_util::IsMemberOfExtension(extention_1_engine_2,
39 extention1));
40 EXPECT_FALSE(extension_ime_util::IsMemberOfExtension(extention_1_engine_1,
41 extention2));
42 EXPECT_FALSE(extension_ime_util::IsMemberOfExtension(extention_1_engine_2,
43 extention2));
44 }
45
25 } // namespace chromeos 46 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/ime/extension_ime_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698