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

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

Issue 13060003: Extract Extension IME related utility. (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 | « chrome/browser/chromeos/input_method/input_method_util.cc ('k') | chromeos/chromeos.gyp » ('j') | 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 EXPECT_TRUE(util_.IsValidInputMethodId("xkb:us:colemak:eng")); 300 EXPECT_TRUE(util_.IsValidInputMethodId("xkb:us:colemak:eng"));
301 EXPECT_TRUE(util_.IsValidInputMethodId("mozc")); 301 EXPECT_TRUE(util_.IsValidInputMethodId("mozc"));
302 EXPECT_FALSE(util_.IsValidInputMethodId("unsupported-input-method")); 302 EXPECT_FALSE(util_.IsValidInputMethodId("unsupported-input-method"));
303 } 303 }
304 304
305 TEST_F(InputMethodUtilTest, TestIsKeyboardLayout) { 305 TEST_F(InputMethodUtilTest, TestIsKeyboardLayout) {
306 EXPECT_TRUE(InputMethodUtil::IsKeyboardLayout("xkb:us::eng")); 306 EXPECT_TRUE(InputMethodUtil::IsKeyboardLayout("xkb:us::eng"));
307 EXPECT_FALSE(InputMethodUtil::IsKeyboardLayout("mozc")); 307 EXPECT_FALSE(InputMethodUtil::IsKeyboardLayout("mozc"));
308 } 308 }
309 309
310 TEST_F(InputMethodUtilTest, TestExtensionInputMethod) {
311 EXPECT_TRUE(InputMethodUtil::IsExtensionInputMethod(
312 kExtensionImePrefix + std::string("123abc")));
313 EXPECT_FALSE(InputMethodUtil::IsExtensionInputMethod(""));
314 EXPECT_FALSE(InputMethodUtil::IsExtensionInputMethod("mozc"));
315 }
316
317 TEST_F(InputMethodUtilTest, TestGetKeyboardLayoutName) { 310 TEST_F(InputMethodUtilTest, TestGetKeyboardLayoutName) {
318 // Unsupported case. 311 // Unsupported case.
319 EXPECT_EQ("", util_.GetKeyboardLayoutName("UNSUPPORTED_ID")); 312 EXPECT_EQ("", util_.GetKeyboardLayoutName("UNSUPPORTED_ID"));
320 313
321 // Supported cases (samples). 314 // Supported cases (samples).
322 EXPECT_EQ("jp", util_.GetKeyboardLayoutName("mozc-jp")); 315 EXPECT_EQ("jp", util_.GetKeyboardLayoutName("mozc-jp"));
323 EXPECT_EQ("us", util_.GetKeyboardLayoutName("pinyin")); 316 EXPECT_EQ("us", util_.GetKeyboardLayoutName("pinyin"));
324 EXPECT_EQ("us(dvorak)", util_.GetKeyboardLayoutName("pinyin-dv")); 317 EXPECT_EQ("us(dvorak)", util_.GetKeyboardLayoutName("pinyin-dv"));
325 EXPECT_EQ("us", util_.GetKeyboardLayoutName("m17n:ar:kbd")); 318 EXPECT_EQ("us", util_.GetKeyboardLayoutName("m17n:ar:kbd"));
326 EXPECT_EQ("es", util_.GetKeyboardLayoutName("xkb:es::spa")); 319 EXPECT_EQ("es", util_.GetKeyboardLayoutName("xkb:es::spa"));
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 EXPECT_FALSE(display_name.empty()) 550 EXPECT_FALSE(display_name.empty())
558 << "Invalid language code " << language_code; 551 << "Invalid language code " << language_code;
559 // On error, GetDisplayNameForLocale() returns the |language_code| as-is. 552 // On error, GetDisplayNameForLocale() returns the |language_code| as-is.
560 EXPECT_NE(language_code, UTF16ToUTF8(display_name)) 553 EXPECT_NE(language_code, UTF16ToUTF8(display_name))
561 << "Invalid language code " << language_code; 554 << "Invalid language code " << language_code;
562 } 555 }
563 } 556 }
564 557
565 } // namespace input_method 558 } // namespace input_method
566 } // namespace chromeos 559 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_util.cc ('k') | chromeos/chromeos.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698