Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3830)

Unified Diff: chrome/renderer/translate/translate_helper_unittest.cc

Issue 14494004: Added the 'Translation Logs' tab to chrome://translate-internals/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (Rebasing) Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/translate/translate_helper_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/translate/translate_helper_unittest.cc
diff --git a/chrome/renderer/translate/translate_helper_unittest.cc b/chrome/renderer/translate/translate_helper_unittest.cc
index ee0495a6d1395181c5686f18996c3a594818e5f9..e1d1175b95985a97855660d202a9da477488edee 100644
--- a/chrome/renderer/translate/translate_helper_unittest.cc
+++ b/chrome/renderer/translate/translate_helper_unittest.cc
@@ -87,9 +87,14 @@ TEST_F(TranslateHelperTest, CLDDisagreeWithWrongLanguageCode) {
"<body>This is a page apparently written in English. Even though "
"content-language is provided, the value will be ignored if the value "
"is suspicious.</body></html>");
+ std::string cld_language;
+ bool is_cld_reliable;
std::string language =
- TranslateHelper::DeterminePageLanguage(std::string("ja"), contents);
+ TranslateHelper::DeterminePageLanguage(std::string("ja"), contents,
+ &cld_language, &is_cld_reliable);
EXPECT_EQ(chrome::kUnknownLanguageCode, language);
+ EXPECT_EQ("en", cld_language);
+ EXPECT_TRUE(is_cld_reliable);
}
// Tests that the language meta tag providing "en-US" style information is
@@ -100,9 +105,14 @@ TEST_F(TranslateHelperTest, CLDAgreeWithLanguageCodeHavingCountryCode) {
"<body>This is a page apparently written in English. Even though "
"content-language is provided, the value will be ignored if the value "
"is suspicious.</body></html>");
+ std::string cld_language;
+ bool is_cld_reliable;
std::string language =
- TranslateHelper::DeterminePageLanguage(std::string("en-US"), contents);
+ TranslateHelper::DeterminePageLanguage(std::string("en-US"), contents,
+ &cld_language, &is_cld_reliable);
EXPECT_EQ("en-US", language);
+ EXPECT_EQ("en", cld_language);
+ EXPECT_TRUE(is_cld_reliable);
}
// Tests that the language meta tag providing wrong information is ignored and
@@ -113,7 +123,12 @@ TEST_F(TranslateHelperTest, InvalidLanguageMetaTagProviding) {
"<body>This is a page apparently written in English. Even though "
"content-language is provided, the value will be ignored and CLD's"
" language will be adopted if the value is invalid.</body></html>");
+ std::string cld_language;
+ bool is_cld_reliable;
std::string language =
- TranslateHelper::DeterminePageLanguage(std::string("utf-8"), contents);
+ TranslateHelper::DeterminePageLanguage(std::string("utf-8"), contents,
+ &cld_language, &is_cld_reliable);
EXPECT_EQ("en", language);
+ EXPECT_EQ("en", cld_language);
+ EXPECT_TRUE(is_cld_reliable);
}
« no previous file with comments | « chrome/renderer/translate/translate_helper_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698