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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_util_unittest.cc

Issue 9837082: Do not try to get a display name from an input method ID which starts with "_ext_ime". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_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 (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 "chrome/browser/chromeos/input_method/input_method_util.h" 5 #include "chrome/browser/chromeos/input_method/input_method_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 12 matching lines...) Expand all
23 #define TestGetFirstLoginInputMethodIds_Us_And_Ru \ 23 #define TestGetFirstLoginInputMethodIds_Us_And_Ru \
24 DISABLED_TestGetFirstLoginInputMethodIds_Us_And_Ru 24 DISABLED_TestGetFirstLoginInputMethodIds_Us_And_Ru
25 #define TestGetInputMethodDescriptorFromXkbId \ 25 #define TestGetInputMethodDescriptorFromXkbId \
26 DISABLED_TestGetInputMethodDescriptorFromXkbId 26 DISABLED_TestGetInputMethodDescriptorFromXkbId
27 #define TestGetKeyboardLayoutName DISABLED_TestGetKeyboardLayoutName 27 #define TestGetKeyboardLayoutName DISABLED_TestGetKeyboardLayoutName
28 #define TestGetLanguageCodesFromInputMethodIds \ 28 #define TestGetLanguageCodesFromInputMethodIds \
29 DISABLED_TestGetLanguageCodesFromInputMethodIds 29 DISABLED_TestGetLanguageCodesFromInputMethodIds
30 #endif // USE_VIRTUAL_KEYBOARD 30 #endif // USE_VIRTUAL_KEYBOARD
31 31
32 namespace chromeos { 32 namespace chromeos {
33
34 extern const char* kExtensionImePrefix;
35
33 namespace input_method { 36 namespace input_method {
34 37
35 namespace { 38 namespace {
36 39
37 InputMethodDescriptor GetDesc(IBusController* controller, 40 InputMethodDescriptor GetDesc(IBusController* controller,
38 const std::string& id, 41 const std::string& id,
39 const std::string& raw_layout, 42 const std::string& raw_layout,
40 const std::string& language_code) { 43 const std::string& language_code) {
41 return controller->CreateInputMethodDescriptor(id, "", raw_layout, 44 return controller->CreateInputMethodDescriptor(id, "", raw_layout,
42 language_code); 45 language_code);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 EXPECT_FALSE(util_.StringIsSupported("####THIS_STRING_IS_NOT_SUPPORTED####")); 189 EXPECT_FALSE(util_.StringIsSupported("####THIS_STRING_IS_NOT_SUPPORTED####"));
187 EXPECT_TRUE(util_.StringIsSupported("Chinese")); 190 EXPECT_TRUE(util_.StringIsSupported("Chinese"));
188 EXPECT_TRUE(util_.StringIsSupported("_Chinese")); 191 EXPECT_TRUE(util_.StringIsSupported("_Chinese"));
189 } 192 }
190 193
191 TEST_F(InputMethodUtilTest, TestIsKeyboardLayout) { 194 TEST_F(InputMethodUtilTest, TestIsKeyboardLayout) {
192 EXPECT_TRUE(InputMethodUtil::IsKeyboardLayout("xkb:us::eng")); 195 EXPECT_TRUE(InputMethodUtil::IsKeyboardLayout("xkb:us::eng"));
193 EXPECT_FALSE(InputMethodUtil::IsKeyboardLayout("mozc")); 196 EXPECT_FALSE(InputMethodUtil::IsKeyboardLayout("mozc"));
194 } 197 }
195 198
199 TEST_F(InputMethodUtilTest, TestExtensionInputMethod) {
200 EXPECT_TRUE(InputMethodUtil::IsExtensionInputMethod(
201 kExtensionImePrefix + std::string("123abc")));
202 EXPECT_FALSE(InputMethodUtil::IsExtensionInputMethod(""));
203 EXPECT_FALSE(InputMethodUtil::IsExtensionInputMethod("mozc"));
204 }
205
196 TEST_F(InputMethodUtilTest, TestGetKeyboardLayoutName) { 206 TEST_F(InputMethodUtilTest, TestGetKeyboardLayoutName) {
197 // Unsupported case. 207 // Unsupported case.
198 EXPECT_EQ("", util_.GetKeyboardLayoutName("UNSUPPORTED_ID")); 208 EXPECT_EQ("", util_.GetKeyboardLayoutName("UNSUPPORTED_ID"));
199 209
200 // Supported cases (samples). 210 // Supported cases (samples).
201 EXPECT_EQ("jp", util_.GetKeyboardLayoutName("mozc-jp")); 211 EXPECT_EQ("jp", util_.GetKeyboardLayoutName("mozc-jp"));
202 EXPECT_EQ("us", util_.GetKeyboardLayoutName("pinyin")); 212 EXPECT_EQ("us", util_.GetKeyboardLayoutName("pinyin"));
203 EXPECT_EQ("us(dvorak)", util_.GetKeyboardLayoutName("pinyin-dv")); 213 EXPECT_EQ("us(dvorak)", util_.GetKeyboardLayoutName("pinyin-dv"));
204 EXPECT_EQ("us", util_.GetKeyboardLayoutName("m17n:ar:kbd")); 214 EXPECT_EQ("us", util_.GetKeyboardLayoutName("m17n:ar:kbd"));
205 EXPECT_EQ("es", util_.GetKeyboardLayoutName("xkb:es::spa")); 215 EXPECT_EQ("es", util_.GetKeyboardLayoutName("xkb:es::spa"));
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 EXPECT_FALSE(display_name.empty()) 453 EXPECT_FALSE(display_name.empty())
444 << "Invalid language code " << language_code; 454 << "Invalid language code " << language_code;
445 // On error, GetDisplayNameForLocale() returns the |language_code| as-is. 455 // On error, GetDisplayNameForLocale() returns the |language_code| as-is.
446 EXPECT_NE(language_code, UTF16ToUTF8(display_name)) 456 EXPECT_NE(language_code, UTF16ToUTF8(display_name))
447 << "Invalid language code " << language_code; 457 << "Invalid language code " << language_code;
448 } 458 }
449 } 459 }
450 460
451 } // namespace input_method 461 } // namespace input_method
452 } // namespace chromeos 462 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698