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 "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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 std::vector<std::string> layouts; | 60 std::vector<std::string> layouts; |
61 std::vector<std::string> languages; | 61 std::vector<std::string> languages; |
62 layouts.push_back("us"); | 62 layouts.push_back("us"); |
63 languages.push_back("zh-CN"); | 63 languages.push_back("zh-CN"); |
64 | 64 |
65 InputMethodDescriptor pinyin_ime(pinyin_ime_id, | 65 InputMethodDescriptor pinyin_ime(pinyin_ime_id, |
66 "Pinyin input for testing", | 66 "Pinyin input for testing", |
67 layouts, | 67 layouts, |
68 languages, | 68 languages, |
| 69 false, |
69 GURL("")); | 70 GURL("")); |
70 input_methods.push_back(pinyin_ime); | 71 input_methods.push_back(pinyin_ime); |
71 | 72 |
72 languages.clear(); | 73 languages.clear(); |
73 languages.push_back("zh-TW"); | 74 languages.push_back("zh-TW"); |
74 InputMethodDescriptor zhuyin_ime(zhuyin_ime_id, | 75 InputMethodDescriptor zhuyin_ime(zhuyin_ime_id, |
75 "Zhuyin input for testing", | 76 "Zhuyin input for testing", |
76 layouts, | 77 layouts, |
77 languages, | 78 languages, |
| 79 false, |
78 GURL("")); | 80 GURL("")); |
79 input_methods.push_back(zhuyin_ime); | 81 input_methods.push_back(zhuyin_ime); |
80 | 82 |
81 util_.SetComponentExtensions(input_methods); | 83 util_.SetComponentExtensions(input_methods); |
82 } | 84 } |
83 | 85 |
84 InputMethodDescriptor GetDesc(const std::string& id, | 86 InputMethodDescriptor GetDesc(const std::string& id, |
85 const std::string& raw_layout, | 87 const std::string& raw_layout, |
86 const std::string& language_code) { | 88 const std::string& language_code) { |
87 std::vector<std::string> layouts; | 89 std::vector<std::string> layouts; |
88 layouts.push_back(raw_layout); | 90 layouts.push_back(raw_layout); |
89 std::vector<std::string> languages; | 91 std::vector<std::string> languages; |
90 languages.push_back(language_code); | 92 languages.push_back(language_code); |
91 return InputMethodDescriptor(id, | 93 return InputMethodDescriptor(id, |
92 "", | 94 "", |
93 layouts, | 95 layouts, |
94 languages, | 96 languages, |
| 97 true, |
95 GURL()); // options page url | 98 GURL()); // options page url |
96 } | 99 } |
97 | 100 |
98 static string16 GetDisplayLanguageName(const std::string& language_code) { | 101 static string16 GetDisplayLanguageName(const std::string& language_code) { |
99 return l10n_util::GetDisplayNameForLocale(language_code, "en", true); | 102 return l10n_util::GetDisplayNameForLocale(language_code, "en", true); |
100 } | 103 } |
101 | 104 |
102 FakeInputMethodDelegate delegate_; | 105 FakeInputMethodDelegate delegate_; |
103 InputMethodWhitelist whitelist_; | 106 InputMethodWhitelist whitelist_; |
104 TestableInputMethodUtil util_; | 107 TestableInputMethodUtil util_; |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 EXPECT_FALSE(display_name.empty()) | 485 EXPECT_FALSE(display_name.empty()) |
483 << "Invalid language code " << language_code; | 486 << "Invalid language code " << language_code; |
484 // On error, GetDisplayNameForLocale() returns the |language_code| as-is. | 487 // On error, GetDisplayNameForLocale() returns the |language_code| as-is. |
485 EXPECT_NE(language_code, UTF16ToUTF8(display_name)) | 488 EXPECT_NE(language_code, UTF16ToUTF8(display_name)) |
486 << "Invalid language code " << language_code; | 489 << "Invalid language code " << language_code; |
487 } | 490 } |
488 } | 491 } |
489 | 492 |
490 } // namespace input_method | 493 } // namespace input_method |
491 } // namespace chromeos | 494 } // namespace chromeos |
OLD | NEW |