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