| 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" | |
| 12 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 15 | 14 |
| 16 namespace chromeos { | 15 namespace chromeos { |
| 17 namespace input_method { | 16 namespace input_method { |
| 18 | 17 |
| 19 namespace { | 18 namespace { |
| 20 InputMethodDescriptor GetDesc(const std::string& id, | 19 InputMethodDescriptor GetDesc(const std::string& id, |
| 21 const std::string& raw_layout, | 20 const std::string& raw_layout, |
| 22 const std::string& language_code) { | 21 const std::string& language_code) { |
| 23 return InputMethodDescriptor::CreateInputMethodDescriptor( | 22 return InputMethodDescriptor::CreateInputMethodDescriptor( |
| 24 id, raw_layout, language_code); | 23 id, raw_layout, language_code); |
| 25 } | 24 } |
| 26 } // namespace | 25 } // namespace |
| 27 | 26 |
| 28 class InputMethodUtilTest : public TestingBrowserProcessTest { | 27 class InputMethodUtilTest : public testing::Test { |
| 29 public: | 28 public: |
| 30 static void SetUpTestCase() { | 29 static void SetUpTestCase() { |
| 31 // Reload the internal maps before running tests, with the stub | 30 // Reload the internal maps before running tests, with the stub |
| 32 // libcros enabled, so that test data is loaded properly. | 31 // libcros enabled, so that test data is loaded properly. |
| 33 ScopedStubCrosEnabler stub_cros_enabler; | 32 ScopedStubCrosEnabler stub_cros_enabler; |
| 34 ReloadInternalMaps(); | 33 ReloadInternalMaps(); |
| 35 } | 34 } |
| 36 | 35 |
| 37 private: | 36 private: |
| 38 // Ensure we always use the stub libcros in each test. | 37 // Ensure we always use the stub libcros in each test. |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 std::vector<std::string> language_codes; | 322 std::vector<std::string> language_codes; |
| 324 GetLanguageCodesFromInputMethodIds(input_method_ids, &language_codes); | 323 GetLanguageCodesFromInputMethodIds(input_method_ids, &language_codes); |
| 325 ASSERT_EQ(3U, language_codes.size()); | 324 ASSERT_EQ(3U, language_codes.size()); |
| 326 EXPECT_EQ("en-US", language_codes[0]); | 325 EXPECT_EQ("en-US", language_codes[0]); |
| 327 EXPECT_EQ("ja", language_codes[1]); | 326 EXPECT_EQ("ja", language_codes[1]); |
| 328 EXPECT_EQ("fr", language_codes[2]); | 327 EXPECT_EQ("fr", language_codes[2]); |
| 329 } | 328 } |
| 330 | 329 |
| 331 } // namespace input_method | 330 } // namespace input_method |
| 332 } // namespace chromeos | 331 } // namespace chromeos |
| OLD | NEW |