| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
| 6 * @fileoverview Fake implementation of chrome.languageSettingsPrivate | 6 * @fileoverview Fake implementation of chrome.languageSettingsPrivate |
| 7 * for testing. | 7 * for testing. |
| 8 */ | 8 */ |
| 9 cr.define('settings', function() { | 9 cr.define('settings', function() { |
| 10 /** | 10 /** |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 }, { | 66 }, { |
| 67 // Norwegian language codes don't start with "no-" but should still | 67 // Norwegian language codes don't start with "no-" but should still |
| 68 // fall under the Norwegian macrolanguage. | 68 // fall under the Norwegian macrolanguage. |
| 69 // TODO(michaelpg): Test this is ordered correctly. | 69 // TODO(michaelpg): Test this is ordered correctly. |
| 70 code: "nb", | 70 code: "nb", |
| 71 displayName: "Norwegian Bokmål", | 71 displayName: "Norwegian Bokmål", |
| 72 nativeDisplayName: "norsk bokmål", | 72 nativeDisplayName: "norsk bokmål", |
| 73 supportsSpellcheck: true, | 73 supportsSpellcheck: true, |
| 74 supportsUI: true, | 74 supportsUI: true, |
| 75 }]; | 75 }]; |
| 76 |
| 77 /** @type {!Array<!chrome.languageSettingsPrivate.InputMethod>} */ |
| 78 this.componentExtensionImes = [{ |
| 79 id: '_comp_ime_fgoepimhcoialccpbmpnnblemnepkkaoxkb:us::eng', |
| 80 displayName: 'US keyboard', |
| 81 languageCodes: ['en', 'en-US'], |
| 82 enabled: true, |
| 83 }, { |
| 84 id: '_comp_ime_fgoepimhcoialccpbmpnnblemnepkkaoxkb:us:dvorak:eng', |
| 85 displayName: 'US Dvorak keyboard', |
| 86 languageCodes: ['en', 'en-US'], |
| 87 enabled: true, |
| 88 }]; |
| 76 } | 89 } |
| 77 | 90 |
| 78 FakeLanguageSettingsPrivate.prototype = { | 91 FakeLanguageSettingsPrivate.prototype = { |
| 79 // Methods for use in testing. | 92 // Methods for use in testing. |
| 80 | 93 |
| 81 /** @param {SettingsPrefsElement} */ | 94 /** @param {SettingsPrefsElement} */ |
| 82 setSettingsPrefs: function(settingsPrefs) { | 95 setSettingsPrefs: function(settingsPrefs) { |
| 83 this.settingsPrefs_ = settingsPrefs; | 96 this.settingsPrefs_ = settingsPrefs; |
| 84 }, | 97 }, |
| 85 | 98 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 getTranslateTargetLanguage: function(callback) { | 157 getTranslateTargetLanguage: function(callback) { |
| 145 setTimeout(callback.bind(null, 'en')); | 158 setTimeout(callback.bind(null, 'en')); |
| 146 }, | 159 }, |
| 147 | 160 |
| 148 /** | 161 /** |
| 149 * Gets all supported input methods, including third-party IMEs. Chrome OS | 162 * Gets all supported input methods, including third-party IMEs. Chrome OS |
| 150 * only. | 163 * only. |
| 151 * @param {function(!chrome.languageSettingsPrivate.InputMethodLists):void} | 164 * @param {function(!chrome.languageSettingsPrivate.InputMethodLists):void} |
| 152 * callback | 165 * callback |
| 153 */ | 166 */ |
| 154 getInputMethodLists: wrapAssertNotReached('getInputMethodLists'), | 167 getInputMethodLists: function(callback) { |
| 168 if (!cr.isChromeOS) |
| 169 assertNotReached(); |
| 170 callback({ |
| 171 componentExtensionImes: |
| 172 JSON.parse(JSON.stringify(this.componentExtensionImes)), |
| 173 thirdPartyExtensionImes: [], |
| 174 }); |
| 175 }, |
| 155 | 176 |
| 156 /** | 177 /** |
| 157 * Adds the input method to the current user's list of enabled input | 178 * Adds the input method to the current user's list of enabled input |
| 158 * methods, enabling the input method for the current user. Chrome OS only. | 179 * methods, enabling the input method for the current user. Chrome OS only. |
| 159 * @param {string} inputMethodId | 180 * @param {string} inputMethodId |
| 160 */ | 181 */ |
| 161 addInputMethod: wrapAssertNotReached('addInputMethod'), | 182 addInputMethod: wrapAssertNotReached('addInputMethod'), |
| 162 | 183 |
| 163 /** | 184 /** |
| 164 * Removes the input method from the current user's list of enabled input | 185 * Removes the input method from the current user's list of enabled input |
| (...skipping 24 matching lines...) Expand all Loading... |
| 189 | 210 |
| 190 /** | 211 /** |
| 191 * Called when an input method is removed. | 212 * Called when an input method is removed. |
| 192 * @type {!ChromeEvent} | 213 * @type {!ChromeEvent} |
| 193 */ | 214 */ |
| 194 onInputMethodRemoved: new FakeChromeEvent(), | 215 onInputMethodRemoved: new FakeChromeEvent(), |
| 195 }; | 216 }; |
| 196 | 217 |
| 197 return {FakeLanguageSettingsPrivate: FakeLanguageSettingsPrivate}; | 218 return {FakeLanguageSettingsPrivate: FakeLanguageSettingsPrivate}; |
| 198 }); | 219 }); |
| OLD | NEW |