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/ui/webui/options2/language_options_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/language_options_handler2.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 #if defined(OS_CHROMEOS) | 12 #if defined(OS_CHROMEOS) |
13 #include "chrome/browser/chromeos/input_method/input_method_descriptor.h" | 13 #include "chrome/browser/chromeos/input_method/input_method_descriptor.h" |
14 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" | 14 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" |
| 15 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" |
15 #include "chrome/browser/ui/webui/options2/chromeos/cros_language_options_handle
r2.h" | 16 #include "chrome/browser/ui/webui/options2/chromeos/cros_language_options_handle
r2.h" |
16 | 17 |
17 using chromeos::input_method::InputMethodDescriptor; | 18 using chromeos::input_method::InputMethodDescriptor; |
18 using chromeos::input_method::InputMethodDescriptors; | 19 using chromeos::input_method::InputMethodDescriptors; |
| 20 using chromeos::input_method::InputMethodManager; |
19 using chromeos::input_method::InputMethodWhitelist; | 21 using chromeos::input_method::InputMethodWhitelist; |
| 22 using chromeos::input_method::MockInputMethodManager; |
20 | 23 |
21 namespace { | 24 namespace { |
22 | 25 |
23 class LanguageOptionsHandlerTest : public testing::Test { | 26 class LanguageOptionsHandlerTest : public testing::Test { |
| 27 public: |
| 28 LanguageOptionsHandlerTest() { |
| 29 InputMethodManager::InitializeForTesting(new MockInputMethodManager); |
| 30 } |
| 31 virtual ~LanguageOptionsHandlerTest() { |
| 32 InputMethodManager::Shutdown(); |
| 33 } |
| 34 |
24 protected: | 35 protected: |
25 InputMethodDescriptors CreateInputMethodDescriptors() { | 36 InputMethodDescriptors CreateInputMethodDescriptors() { |
26 InputMethodDescriptors descriptors; | 37 InputMethodDescriptors descriptors; |
27 descriptors.push_back(GetDesc("xkb:us::eng", "us", "en-US")); | 38 descriptors.push_back(GetDesc("xkb:us::eng", "us", "en-US")); |
28 descriptors.push_back(GetDesc("xkb:fr::fra", "fr", "fr")); | 39 descriptors.push_back(GetDesc("xkb:fr::fra", "fr", "fr")); |
29 descriptors.push_back(GetDesc("xkb:be::fra", "be", "fr")); | 40 descriptors.push_back(GetDesc("xkb:be::fra", "be", "fr")); |
30 descriptors.push_back(GetDesc("mozc", "us", "ja")); | 41 descriptors.push_back(GetDesc("mozc", "us", "ja")); |
31 return descriptors; | 42 return descriptors; |
32 } | 43 } |
33 | 44 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // fail when we add support for the language. | 212 // fail when we add support for the language. |
202 // EXPECT_FALSE(dictionary->HasKey("no")); | 213 // EXPECT_FALSE(dictionary->HasKey("no")); |
203 } | 214 } |
204 #endif // !defined(OS_MACOSX) | 215 #endif // !defined(OS_MACOSX) |
205 | 216 |
206 TEST_F(LanguageOptionsHandlerTest, GetSpellCheckLanguageCodeSet) { | 217 TEST_F(LanguageOptionsHandlerTest, GetSpellCheckLanguageCodeSet) { |
207 scoped_ptr<DictionaryValue> dictionary( | 218 scoped_ptr<DictionaryValue> dictionary( |
208 options2::LanguageOptionsHandler::GetSpellCheckLanguageCodeSet()); | 219 options2::LanguageOptionsHandler::GetSpellCheckLanguageCodeSet()); |
209 EXPECT_TRUE(dictionary->HasKey("en-US")); | 220 EXPECT_TRUE(dictionary->HasKey("en-US")); |
210 } | 221 } |
OLD | NEW |