summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-09 01:51:38 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-09 01:51:38 +0000
commitfc7b9b54bbe270171035a6483c658f0fc2aa166c (patch)
treee64b43979bd885796d954f903df1dcc36f3a0179 /chrome
parent67a5090d80fcc4426d5fb3f53244446925764114 (diff)
downloadchromium_src-fc7b9b54bbe270171035a6483c658f0fc2aa166c.zip
chromium_src-fc7b9b54bbe270171035a6483c658f0fc2aa166c.tar.gz
chromium_src-fc7b9b54bbe270171035a6483c658f0fc2aa166c.tar.bz2
Add realistic data to InputMethodLibraryStubImpl.
This will make it easy to test chrome os version of chrome on regular linux desktops, as well as writing unit tests. BUG=none TEST=manually Review URL: http://codereview.chromium.org/3085023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55373 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/cros/input_method_library.cc136
1 files changed, 133 insertions, 3 deletions
diff --git a/chrome/browser/chromeos/cros/input_method_library.cc b/chrome/browser/chromeos/cros/input_method_library.cc
index b78f133..637a153 100644
--- a/chrome/browser/chromeos/cros/input_method_library.cc
+++ b/chrome/browser/chromeos/cros/input_method_library.cc
@@ -528,16 +528,18 @@ class InputMethodLibraryStubImpl : public InputMethodLibrary {
void RemoveObserver(Observer* observer) {}
InputMethodDescriptors* GetActiveInputMethods() {
- return CreateFallbackInputMethodDescriptors();
+ return CreateRealisticInputMethodDescriptors();
}
size_t GetNumActiveInputMethods() {
- return CreateFallbackInputMethodDescriptors()->size();
+ scoped_ptr<InputMethodDescriptors> descriptors(
+ CreateRealisticInputMethodDescriptors());
+ return descriptors->size();
}
InputMethodDescriptors* GetSupportedInputMethods() {
- return CreateFallbackInputMethodDescriptors();
+ return CreateRealisticInputMethodDescriptors();
}
void ChangeInputMethod(const std::string& input_method_id) {}
@@ -576,6 +578,134 @@ class InputMethodLibraryStubImpl : public InputMethodLibrary {
virtual void SetDeferImeStartup(bool defer) {}
private:
+ // Creates realistic input method descriptors that can be used for
+ // testing Chrome OS version of chrome on regular Linux desktops.
+ InputMethodDescriptors* CreateRealisticInputMethodDescriptors() {
+ InputMethodDescriptors* descriptions = new InputMethodDescriptors;
+ // The list is created from output of gen_engines.py in libcros.
+ descriptions->push_back(InputMethodDescriptor(
+ "chewing", "Chewing", "us", "zh_TW"));
+ descriptions->push_back(InputMethodDescriptor(
+ "hangul", "Korean", "us", "ko"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:fa:isiri", "isiri (m17n)", "us", "fa"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:he:kbd", "kbd (m17n)", "us", "he"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:ar:kbd", "kbd (m17n)", "us", "ar"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:hi:itrans", "itrans (m17n)", "us", "hi"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:vi:vni", "vni (m17n)", "us", "vi"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:vi:viqr", "viqr (m17n)", "us", "vi"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:vi:tcvn", "tcvn (m17n)", "us", "vi"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:vi:telex", "telex (m17n)", "us", "vi"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:zh:cangjie", "cangjie (m17n)", "us", "zh"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:zh:quick", "quick (m17n)", "us", "zh"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:th:tis820", "tis820 (m17n)", "us", "th"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:th:kesmanee", "kesmanee (m17n)", "us", "th"));
+ descriptions->push_back(InputMethodDescriptor(
+ "m17n:th:pattachote", "pattachote (m17n)", "us", "th"));
+ descriptions->push_back(InputMethodDescriptor(
+ "mozc-jp", "Mozc (Japanese keyboard layout)", "jp", "ja"));
+ descriptions->push_back(InputMethodDescriptor(
+ "mozc", "Mozc (US keyboard layout)", "us", "ja"));
+ descriptions->push_back(InputMethodDescriptor(
+ "mozc-dv", "Mozc (US Dvorak keyboard layout)", "us(dvorak)", "ja"));
+ descriptions->push_back(InputMethodDescriptor(
+ "pinyin", "Pinyin", "us", "zh"));
+ descriptions->push_back(InputMethodDescriptor(
+ "bopomofo", "Bopomofo", "us", "zh"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:us::eng", "USA", "us", "eng"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:us:dvorak:eng", "USA - Dvorak", "us(dvorak)", "eng"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:be::ger", "Belgium", "be", "ger"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:be::nld", "Belgium", "be", "nld"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:be::fra", "Belgium", "be", "fra"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:br::por", "Brazil", "br", "por"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:bg::bul", "Bulgaria", "bg", "bul"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:ca::fra", "Canada", "ca", "fra"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:ca:eng:eng", "Canada - English", "ca(eng)", "eng"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:hr::scr", "Croatia", "hr", "scr"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:cz::cze", "Czechia", "cz", "cze"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:dk::dan", "Denmark", "dk", "dan"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:nl::nld", "Netherlands", "nl", "nld"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:ee::est", "Estonia", "ee", "est"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:fi::fin", "Finland", "fi", "fin"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:fr::fra", "France", "fr", "fra"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:de::ger", "Germany", "de", "ger"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:gr::gre", "Greece", "gr", "gre"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:hu::hun", "Hungary", "hu", "hun"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:it::ita", "Italy", "it", "ita"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:jp::jpn", "Japan", "jp", "jpn"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:lt::lit", "Lithuania", "lt", "lit"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:lv::lav", "Latvia", "lv", "lav"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:no::nor", "Norway", "no", "nor"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:pl::pol", "Poland", "pl", "pol"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:pt::por", "Portugal", "pt", "por"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:ro::rum", "Romania", "ro", "rum"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:ru::rus", "Russia", "ru", "rus"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:rs::srp", "Serbia", "rs", "srp"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:si::slv", "Slovenia", "si", "slv"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:sk::slo", "Slovakia", "sk", "slo"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:es::spa", "Spain", "es", "spa"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:es:cat:cat",
+ "Spain - Catalan variant with middle-dot L", "es(cat)", "cat"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:se::swe", "Sweden", "se", "swe"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:ch::ger", "Switzerland", "ch", "ger"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:ch:fr:fra", "Switzerland - French", "ch(fr)", "fra"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:tr::tur", "Turkey", "tr", "tur"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:ua::ukr", "Ukraine", "ua", "ukr"));
+ descriptions->push_back(InputMethodDescriptor(
+ "xkb:gb:extd:eng", "United Kingdom - Extended - Winkeys", "gb(extd)",
+ "eng"));
+ return descriptions;
+}
+
InputMethodDescriptor previous_input_method_;
InputMethodDescriptor current_input_method_;
ImePropertyList current_ime_properties_;