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

Unified Diff: components/translate/common/translate_util_unittest.cc

Issue 25531002: Move language detection to a component (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Run translate unittests on iOS Created 7 years, 2 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 | « components/translate/common/translate_util.cc ('k') | components/translate/language_detection/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/translate/common/translate_util_unittest.cc
diff --git a/chrome/common/translate/translate_util_unittest.cc b/components/translate/common/translate_util_unittest.cc
similarity index 65%
rename from chrome/common/translate/translate_util_unittest.cc
rename to components/translate/common/translate_util_unittest.cc
index c0ebcc0a5b6b30414cea20e253b5ca1b3e9f5aee..f53996b2bb0b855984a977dad1f290d84bb9a4f7 100644
--- a/chrome/common/translate/translate_util_unittest.cc
+++ b/components/translate/common/translate_util_unittest.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/common/translate/translate_util.h"
+#include "components/translate/common/translate_util.h"
#include "base/command_line.h"
-#include "chrome/common/chrome_switches.h"
+#include "components/translate/common/translate_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -16,34 +16,34 @@ TEST_F(TranslateUtilTest, ToTranslateLanguageSynonym) {
std::string language;
language = std::string("nb");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
+ translate::ToTranslateLanguageSynonym(&language);
EXPECT_EQ("no", language);
language = std::string("he");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
+ translate::ToTranslateLanguageSynonym(&language);
EXPECT_EQ("iw", language);
language = std::string("jv");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
+ translate::ToTranslateLanguageSynonym(&language);
EXPECT_EQ("jw", language);
language = std::string("fil");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
+ translate::ToTranslateLanguageSynonym(&language);
EXPECT_EQ("tl", language);
// Preserve a sub code if the language has a synonym.
language = std::string("he-IL");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
+ translate::ToTranslateLanguageSynonym(&language);
EXPECT_EQ("iw-IL", language);
// Don't preserve a sub code if the language has just a similitude.
language = std::string("nb-NO");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
+ translate::ToTranslateLanguageSynonym(&language);
EXPECT_EQ("nb-NO", language);
// Preserve the argument if it doesn't have its synonym.
language = std::string("en");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
+ translate::ToTranslateLanguageSynonym(&language);
EXPECT_EQ("en", language);
}
@@ -52,45 +52,45 @@ TEST_F(TranslateUtilTest, ToChromeLanguageSynonym) {
std::string language;
language = std::string("no");
- TranslateUtil::ToChromeLanguageSynonym(&language);
+ translate::ToChromeLanguageSynonym(&language);
EXPECT_EQ("nb", language);
language = std::string("iw");
- TranslateUtil::ToChromeLanguageSynonym(&language);
+ translate::ToChromeLanguageSynonym(&language);
EXPECT_EQ("he", language);
language = std::string("jw");
- TranslateUtil::ToChromeLanguageSynonym(&language);
+ translate::ToChromeLanguageSynonym(&language);
EXPECT_EQ("jv", language);
language = std::string("tl");
- TranslateUtil::ToChromeLanguageSynonym(&language);
+ translate::ToChromeLanguageSynonym(&language);
EXPECT_EQ("fil", language);
// Preserve a sub code if the language has a synonym.
language = std::string("iw-IL");
- TranslateUtil::ToChromeLanguageSynonym(&language);
+ translate::ToChromeLanguageSynonym(&language);
EXPECT_EQ("he-IL", language);
// Don't preserve a sub code if the language has just a similitude.
language = std::string("no-NO");
- TranslateUtil::ToChromeLanguageSynonym(&language);
+ translate::ToChromeLanguageSynonym(&language);
EXPECT_EQ("no-NO", language);
// Preserve the argument if it doesn't have its synonym.
language = std::string("en");
- TranslateUtil::ToChromeLanguageSynonym(&language);
+ translate::ToChromeLanguageSynonym(&language);
EXPECT_EQ("en", language);
}
TEST_F(TranslateUtilTest, SecurityOrigin) {
- GURL origin = TranslateUtil::GetTranslateSecurityOrigin();
- EXPECT_EQ(std::string(TranslateUtil::kSecurityOrigin), origin.spec());
+ GURL origin = translate::GetTranslateSecurityOrigin();
+ EXPECT_EQ(std::string(translate::kSecurityOrigin), origin.spec());
const std::string running_origin("http://www.tamurayukari.com/");
CommandLine* command_line = CommandLine::ForCurrentProcess();
- command_line->AppendSwitchASCII(switches::kTranslateSecurityOrigin,
+ command_line->AppendSwitchASCII(translate::switches::kTranslateSecurityOrigin,
running_origin);
- GURL modified_origin = TranslateUtil::GetTranslateSecurityOrigin();
+ GURL modified_origin = translate::GetTranslateSecurityOrigin();
EXPECT_EQ(running_origin, modified_origin.spec());
}
« no previous file with comments | « components/translate/common/translate_util.cc ('k') | components/translate/language_detection/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698