| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/translate/language_detection/language_detection_util.h" | 5 #include "components/translate/language_detection/language_detection_util.h" |
| 6 | 6 |
| 7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "components/translate/common/translate_constants.h" | 9 #include "components/translate/core/common/translate_constants.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 typedef testing::Test LanguageDetectionUtilTest; | 12 typedef testing::Test LanguageDetectionUtilTest; |
| 13 | 13 |
| 14 // Tests that well-known language code typos are fixed. | 14 // Tests that well-known language code typos are fixed. |
| 15 TEST_F(LanguageDetectionUtilTest, LanguageCodeTypoCorrection) { | 15 TEST_F(LanguageDetectionUtilTest, LanguageCodeTypoCorrection) { |
| 16 std::string language; | 16 std::string language; |
| 17 | 17 |
| 18 // Strip the second and later codes. | 18 // Strip the second and later codes. |
| 19 language = std::string("ja,en"); | 19 language = std::string("ja,en"); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 bool is_cld_reliable; | 164 bool is_cld_reliable; |
| 165 std::string language = translate::DeterminePageLanguage(std::string("ja"), | 165 std::string language = translate::DeterminePageLanguage(std::string("ja"), |
| 166 std::string("en"), | 166 std::string("en"), |
| 167 contents, | 167 contents, |
| 168 &cld_language, | 168 &cld_language, |
| 169 &is_cld_reliable); | 169 &is_cld_reliable); |
| 170 EXPECT_EQ("en", language); | 170 EXPECT_EQ("en", language); |
| 171 EXPECT_EQ("en", cld_language); | 171 EXPECT_EQ("en", cld_language); |
| 172 EXPECT_TRUE(is_cld_reliable); | 172 EXPECT_TRUE(is_cld_reliable); |
| 173 } | 173 } |
| OLD | NEW |