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 3 // found in the LICENSE file. 4 5 #include "chrome/common/translate/translate_util.h" 6 7 #include "testing/gtest/include/gtest/gtest.h" 8 9 typedef testing::Test TranslateUtilTest; 10 11 // Tests that synonym language code is converted to one used in supporting list. 12 TEST_F(TranslateUtilTest, ToTranslateLanguageSynonym) { 13 std::string language; 14 15 language = std::string("nb"); 16 TranslateUtil::ToTranslateLanguageSynonym(&language); 17 EXPECT_EQ("no", language); 18 19 language = std::string("he"); 20 TranslateUtil::ToTranslateLanguageSynonym(&language); 21 EXPECT_EQ("iw", language); 22 23 language = std::string("jv"); 24 TranslateUtil::ToTranslateLanguageSynonym(&language); 25 EXPECT_EQ("jw", language); 26 27 language = std::string("fil"); 28 TranslateUtil::ToTranslateLanguageSynonym(&language); 29 EXPECT_EQ("tl", language); 30 } 31 32 // Tests that synonym language code is converted to one used in Chrome internal. 33 TEST_F(TranslateUtilTest, ToChromeLanguageSynonym) { 34 std::string language; 35 36 language = std::string("no"); 37 TranslateUtil::ToChromeLanguageSynonym(&language); 38 EXPECT_EQ("nb", language); 39 40 language = std::string("iw"); 41 TranslateUtil::ToChromeLanguageSynonym(&language); 42 EXPECT_EQ("he", language); 43 44 language = std::string("jw"); 45 TranslateUtil::ToChromeLanguageSynonym(&language); 46 EXPECT_EQ("jv", language); 47 48 language = std::string("tl"); 49 TranslateUtil::ToChromeLanguageSynonym(&language); 50 EXPECT_EQ("fil", language); 51 } 52