// Copyright 2014 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/translate/core/language_detection/language_detection_util.h" #include <string> #include "base/strings/utf_string_conversions.h" #include "base/test/metrics/histogram_tester.h" #include "components/translate/core/common/translate_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace translate { namespace { // Tests that well-known language code typos are fixed. TEST(LanguageDetectionUtilTest, LanguageCodeTypoCorrection) { … } // Tests if the language codes' format is invalid. TEST(LanguageDetectionUtilTest, IsValidLanguageCode) { … } // Tests that similar language table works. TEST(LanguageDetectionUtilTest, SimilarLanguageCode) { … } // Tests that well-known languages which often have wrong server configuration // are handles. TEST(LanguageDetectionUtilTest, WellKnownWrongConfiguration) { … } // Tests that the language meta tag providing wrong information is ignored by // LanguageDetectionUtil due to disagreement between meta tag and CLD. TEST(LanguageDetectionUtilTest, CLDDisagreeWithWrongLanguageCode) { … } // Tests that the language meta tag providing "en-US" style information is // agreed by CLD. TEST(LanguageDetectionUtilTest, CLDAgreeWithLanguageCodeHavingCountryCode) { … } // Tests that the language meta tag providing wrong information is ignored and // CLD's language will be adopted by LanguageDetectionUtil due to an invalid // meta tag. TEST(LanguageDetectionUtilTest, InvalidLanguageMetaTagProviding) { … } // Tests that the language meta tag providing wrong information is ignored // because of valid html lang attribute. TEST(LanguageDetectionUtilTest, AdoptHtmlLang) { … } // Tests that languages that often have the wrong server configuration are // correctly identified. All incorrect language codes should be checked to // make sure the binary_search is correct. TEST(LanguageDetectionUtilTest, IsServerWrongConfigurationLanguage) { … } } // namespace } // namespace translate