OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/status/input_method_menu.h" | 5 #include "chrome/browser/chromeos/status/input_method_menu.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/chromeos/cros/cros_library.h" | 8 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 9 #include "chrome/test/base/testing_browser_process.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
10 | 11 |
11 namespace chromeos { | 12 namespace chromeos { |
12 | 13 |
13 using input_method::InputMethodDescriptor; | 14 using input_method::InputMethodDescriptor; |
14 | 15 |
15 namespace { | 16 namespace { |
16 InputMethodDescriptor GetDesc(const std::string& id, | 17 InputMethodDescriptor GetDesc(const std::string& id, |
17 const std::string& raw_layout, | 18 const std::string& raw_layout, |
18 const std::string& language_code) { | 19 const std::string& language_code) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 { | 105 { |
105 InputMethodDescriptor desc = GetDesc("m17n:zh:quick", "us", "zh-TW"); | 106 InputMethodDescriptor desc = GetDesc("m17n:zh:quick", "us", "zh-TW"); |
106 EXPECT_EQ(UTF8ToWide("\xe9\x80\x9f"), | 107 EXPECT_EQ(UTF8ToWide("\xe9\x80\x9f"), |
107 InputMethodMenu::GetTextForIndicator(desc)); | 108 InputMethodMenu::GetTextForIndicator(desc)); |
108 } | 109 } |
109 } | 110 } |
110 | 111 |
111 | 112 |
112 // Test whether the function returns language name for non-ambiguous languages. | 113 // Test whether the function returns language name for non-ambiguous languages. |
113 TEST(InputMethodMenuTest, GetTextForMenuTest) { | 114 TEST(InputMethodMenuTest, GetTextForMenuTest) { |
| 115 ScopedTestingBrowserProcess browser_process; |
114 // For most languages input method or keyboard layout name is returned. | 116 // For most languages input method or keyboard layout name is returned. |
115 // See below for exceptions. | 117 // See below for exceptions. |
116 { | 118 { |
117 InputMethodDescriptor desc = GetDesc("m17n:fa:isiri", "us", "fa"); | 119 InputMethodDescriptor desc = GetDesc("m17n:fa:isiri", "us", "fa"); |
118 EXPECT_EQ(L"Persian input method (ISIRI 2901 layout)", | 120 EXPECT_EQ(L"Persian input method (ISIRI 2901 layout)", |
119 InputMethodMenu::GetTextForMenu(desc)); | 121 InputMethodMenu::GetTextForMenu(desc)); |
120 } | 122 } |
121 { | 123 { |
122 InputMethodDescriptor desc = GetDesc("mozc-hangul", "us", "ko"); | 124 InputMethodDescriptor desc = GetDesc("mozc-hangul", "us", "ko"); |
123 EXPECT_EQ(L"Korean input method", | 125 EXPECT_EQ(L"Korean input method", |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 { | 203 { |
202 InputMethodDescriptor desc = GetDesc("invalid-id", "us", "xx"); | 204 InputMethodDescriptor desc = GetDesc("invalid-id", "us", "xx"); |
203 // You can safely ignore the "Resouce ID is not found for: invalid-id" | 205 // You can safely ignore the "Resouce ID is not found for: invalid-id" |
204 // error. | 206 // error. |
205 EXPECT_EQ(L"invalid-id", | 207 EXPECT_EQ(L"invalid-id", |
206 InputMethodMenu::GetTextForMenu(desc)); | 208 InputMethodMenu::GetTextForMenu(desc)); |
207 } | 209 } |
208 } | 210 } |
209 | 211 |
210 } // namespace chromeos | 212 } // namespace chromeos |
OLD | NEW |