| 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/chromeos/input_method/input_method_util.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 11 #include "chrome/test/base/testing_browser_process_test.h" |
| 11 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 14 | 15 |
| 15 namespace chromeos { | 16 namespace chromeos { |
| 16 namespace input_method { | 17 namespace input_method { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 InputMethodDescriptor GetDesc(const std::string& id, | 20 InputMethodDescriptor GetDesc(const std::string& id, |
| 20 const std::string& raw_layout, | 21 const std::string& raw_layout, |
| 21 const std::string& language_code) { | 22 const std::string& language_code) { |
| 22 return InputMethodDescriptor::CreateInputMethodDescriptor( | 23 return InputMethodDescriptor::CreateInputMethodDescriptor( |
| 23 id, raw_layout, language_code); | 24 id, raw_layout, language_code); |
| 24 } | 25 } |
| 25 } // namespace | 26 } // namespace |
| 26 | 27 |
| 27 class InputMethodUtilTest : public testing::Test { | 28 class InputMethodUtilTest : public TestingBrowserProcessTest { |
| 28 public: | 29 public: |
| 29 static void SetUpTestCase() { | 30 static void SetUpTestCase() { |
| 30 // Reload the internal maps before running tests, with the stub | 31 // Reload the internal maps before running tests, with the stub |
| 31 // libcros enabled, so that test data is loaded properly. | 32 // libcros enabled, so that test data is loaded properly. |
| 32 ScopedStubCrosEnabler stub_cros_enabler; | 33 ScopedStubCrosEnabler stub_cros_enabler; |
| 33 ReloadInternalMaps(); | 34 ReloadInternalMaps(); |
| 34 } | 35 } |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 // Ensure we always use the stub libcros in each test. | 38 // Ensure we always use the stub libcros in each test. |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 std::vector<std::string> language_codes; | 312 std::vector<std::string> language_codes; |
| 312 GetLanguageCodesFromInputMethodIds(input_method_ids, &language_codes); | 313 GetLanguageCodesFromInputMethodIds(input_method_ids, &language_codes); |
| 313 ASSERT_EQ(3U, language_codes.size()); | 314 ASSERT_EQ(3U, language_codes.size()); |
| 314 EXPECT_EQ("en-US", language_codes[0]); | 315 EXPECT_EQ("en-US", language_codes[0]); |
| 315 EXPECT_EQ("ja", language_codes[1]); | 316 EXPECT_EQ("ja", language_codes[1]); |
| 316 EXPECT_EQ("fr", language_codes[2]); | 317 EXPECT_EQ("fr", language_codes[2]); |
| 317 } | 318 } |
| 318 | 319 |
| 319 } // namespace input_method | 320 } // namespace input_method |
| 320 } // namespace chromeos | 321 } // namespace chromeos |
| OLD | NEW |