Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Side by Side Diff: chrome/browser/ui/webui/options2/language_options_handler_unittest.cc

Issue 10857071: Options: Rename options2 namespace to options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_handler.h" 5 #include "chrome/browser/ui/webui/options2/language_options_handler.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"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 } // namespace 55 } // namespace
56 #else 56 #else
57 typedef testing::Test LanguageOptionsHandlerTest; 57 typedef testing::Test LanguageOptionsHandlerTest;
58 #endif 58 #endif
59 59
60 #if defined(OS_CHROMEOS) 60 #if defined(OS_CHROMEOS)
61 TEST_F(LanguageOptionsHandlerTest, GetInputMethodList) { 61 TEST_F(LanguageOptionsHandlerTest, GetInputMethodList) {
62 InputMethodDescriptors descriptors = CreateInputMethodDescriptors(); 62 InputMethodDescriptors descriptors = CreateInputMethodDescriptors();
63 scoped_ptr<ListValue> list( 63 scoped_ptr<ListValue> list(
64 chromeos::options2::CrosLanguageOptionsHandler::GetInputMethodList( 64 chromeos::options::CrosLanguageOptionsHandler::GetInputMethodList(
65 descriptors)); 65 descriptors));
66 ASSERT_EQ(4U, list->GetSize()); 66 ASSERT_EQ(4U, list->GetSize());
67 67
68 DictionaryValue* entry = NULL; 68 DictionaryValue* entry = NULL;
69 DictionaryValue *language_code_set = NULL; 69 DictionaryValue *language_code_set = NULL;
70 std::string input_method_id; 70 std::string input_method_id;
71 std::string display_name; 71 std::string display_name;
72 std::string language_code; 72 std::string language_code;
73 73
74 // As shown below, the list should be input method ids should appear in 74 // As shown below, the list should be input method ids should appear in
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 ASSERT_TRUE(entry->GetDictionary("languageCodeSet", &language_code_set)); 109 ASSERT_TRUE(entry->GetDictionary("languageCodeSet", &language_code_set));
110 EXPECT_EQ("mozc", input_method_id); 110 EXPECT_EQ("mozc", input_method_id);
111 // Commented out. See above. 111 // Commented out. See above.
112 // EXPECT_EQ("Japanese input method (for US keyboard)", display_name); 112 // EXPECT_EQ("Japanese input method (for US keyboard)", display_name);
113 ASSERT_TRUE(language_code_set->HasKey("ja")); 113 ASSERT_TRUE(language_code_set->HasKey("ja"));
114 } 114 }
115 115
116 TEST_F(LanguageOptionsHandlerTest, GetLanguageList) { 116 TEST_F(LanguageOptionsHandlerTest, GetLanguageList) {
117 InputMethodDescriptors descriptors = CreateInputMethodDescriptors(); 117 InputMethodDescriptors descriptors = CreateInputMethodDescriptors();
118 scoped_ptr<ListValue> list( 118 scoped_ptr<ListValue> list(
119 chromeos::options2::CrosLanguageOptionsHandler::GetLanguageList( 119 chromeos::options::CrosLanguageOptionsHandler::GetLanguageList(
120 descriptors)); 120 descriptors));
121 ASSERT_EQ(9U, list->GetSize()); 121 ASSERT_EQ(9U, list->GetSize());
122 122
123 DictionaryValue* entry = NULL; 123 DictionaryValue* entry = NULL;
124 std::string language_code; 124 std::string language_code;
125 std::string display_name; 125 std::string display_name;
126 std::string native_display_name; 126 std::string native_display_name;
127 127
128 // As shown below, the list should be sorted by the display names, 128 // As shown below, the list should be sorted by the display names,
129 // and these names should not have duplicates. 129 // and these names should not have duplicates.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 ASSERT_TRUE(entry->GetString("nativeDisplayName", &native_display_name)); 204 ASSERT_TRUE(entry->GetString("nativeDisplayName", &native_display_name));
205 EXPECT_EQ("es-419", language_code); 205 EXPECT_EQ("es-419", language_code);
206 EXPECT_EQ("Spanish (Latin America)", display_name); 206 EXPECT_EQ("Spanish (Latin America)", display_name);
207 EXPECT_EQ("espa\u00F1ol (Latinoam\u00E9rica)", native_display_name); 207 EXPECT_EQ("espa\u00F1ol (Latinoam\u00E9rica)", native_display_name);
208 } 208 }
209 #endif // defined(OS_CHROMEOS) 209 #endif // defined(OS_CHROMEOS)
210 210
211 #if !defined(OS_MACOSX) 211 #if !defined(OS_MACOSX)
212 TEST_F(LanguageOptionsHandlerTest, GetUILanguageCodeSet) { 212 TEST_F(LanguageOptionsHandlerTest, GetUILanguageCodeSet) {
213 scoped_ptr<DictionaryValue> dictionary( 213 scoped_ptr<DictionaryValue> dictionary(
214 options2::LanguageOptionsHandler::GetUILanguageCodeSet()); 214 options::LanguageOptionsHandler::GetUILanguageCodeSet());
215 EXPECT_TRUE(dictionary->HasKey("en-US")); 215 EXPECT_TRUE(dictionary->HasKey("en-US"));
216 // Note that we don't test a false case, as such an expectation will 216 // Note that we don't test a false case, as such an expectation will
217 // fail when we add support for the language. 217 // fail when we add support for the language.
218 // EXPECT_FALSE(dictionary->HasKey("no")); 218 // EXPECT_FALSE(dictionary->HasKey("no"));
219 } 219 }
220 #endif // !defined(OS_MACOSX) 220 #endif // !defined(OS_MACOSX)
221 221
222 TEST_F(LanguageOptionsHandlerTest, GetSpellCheckLanguageCodeSet) { 222 TEST_F(LanguageOptionsHandlerTest, GetSpellCheckLanguageCodeSet) {
223 scoped_ptr<DictionaryValue> dictionary( 223 scoped_ptr<DictionaryValue> dictionary(
224 options2::LanguageOptionsHandler::GetSpellCheckLanguageCodeSet()); 224 options::LanguageOptionsHandler::GetSpellCheckLanguageCodeSet());
225 EXPECT_TRUE(dictionary->HasKey("en-US")); 225 EXPECT_TRUE(dictionary->HasKey("en-US"));
226 } 226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698