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/ui/webui/options/language_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/language_options_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/test/base/testing_browser_process_test.h" | |
12 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
13 | 12 |
14 #if defined(OS_CHROMEOS) | 13 #if defined(OS_CHROMEOS) |
15 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 14 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
16 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler
.h" | 15 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler
.h" |
17 #endif // defined(OS_CHROMEOS) | 16 #endif // defined(OS_CHROMEOS) |
18 | 17 |
19 #if defined(OS_CHROMEOS) | 18 #if defined(OS_CHROMEOS) |
20 | 19 |
21 using chromeos::input_method::InputMethodDescriptor; | 20 using chromeos::input_method::InputMethodDescriptor; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 ASSERT_TRUE(entry->GetString("id", &input_method_id)); | 84 ASSERT_TRUE(entry->GetString("id", &input_method_id)); |
86 ASSERT_TRUE(entry->GetString("displayName", &display_name)); | 85 ASSERT_TRUE(entry->GetString("displayName", &display_name)); |
87 ASSERT_TRUE(entry->GetDictionary("languageCodeSet", &language_code_set)); | 86 ASSERT_TRUE(entry->GetDictionary("languageCodeSet", &language_code_set)); |
88 EXPECT_EQ("mozc", input_method_id); | 87 EXPECT_EQ("mozc", input_method_id); |
89 // Commented out. See above. | 88 // Commented out. See above. |
90 // EXPECT_EQ("Japanese input method (for US keyboard)", display_name); | 89 // EXPECT_EQ("Japanese input method (for US keyboard)", display_name); |
91 ASSERT_TRUE(language_code_set->HasKey("ja")); | 90 ASSERT_TRUE(language_code_set->HasKey("ja")); |
92 } | 91 } |
93 | 92 |
94 TEST(LanguageOptionsHandlerTest, GetLanguageList) { | 93 TEST(LanguageOptionsHandlerTest, GetLanguageList) { |
95 ScopedTestingBrowserProcess browser_process; | |
96 | |
97 InputMethodDescriptors descriptors = CreateInputMethodDescriptors(); | 94 InputMethodDescriptors descriptors = CreateInputMethodDescriptors(); |
98 scoped_ptr<ListValue> list( | 95 scoped_ptr<ListValue> list( |
99 chromeos::CrosLanguageOptionsHandler::GetLanguageList(descriptors)); | 96 chromeos::CrosLanguageOptionsHandler::GetLanguageList(descriptors)); |
100 ASSERT_EQ(8U, list->GetSize()); | 97 ASSERT_EQ(8U, list->GetSize()); |
101 | 98 |
102 DictionaryValue* entry = NULL; | 99 DictionaryValue* entry = NULL; |
103 std::string language_code; | 100 std::string language_code; |
104 std::string display_name; | 101 std::string display_name; |
105 std::string native_display_name; | 102 std::string native_display_name; |
106 | 103 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // fail when we add support for the language. | 184 // fail when we add support for the language. |
188 // EXPECT_FALSE(dictionary->HasKey("no")); | 185 // EXPECT_FALSE(dictionary->HasKey("no")); |
189 } | 186 } |
190 #endif // !defined(OS_MACOSX) | 187 #endif // !defined(OS_MACOSX) |
191 | 188 |
192 TEST(LanguageOptionsHandlerTest, GetSpellCheckLanguageCodeSet) { | 189 TEST(LanguageOptionsHandlerTest, GetSpellCheckLanguageCodeSet) { |
193 scoped_ptr<DictionaryValue> dictionary( | 190 scoped_ptr<DictionaryValue> dictionary( |
194 LanguageOptionsHandler::GetSpellCheckLanguageCodeSet()); | 191 LanguageOptionsHandler::GetSpellCheckLanguageCodeSet()); |
195 EXPECT_TRUE(dictionary->HasKey("en-US")); | 192 EXPECT_TRUE(dictionary->HasKey("en-US")); |
196 } | 193 } |
OLD | NEW |