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

Unified Diff: chrome/common/translate/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 | « chrome/common/translate/translate_util.cc ('k') | chrome/renderer/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/translate/translate_util_unittest.cc
diff --git a/chrome/common/translate/translate_util_unittest.cc b/chrome/common/translate/translate_util_unittest.cc
deleted file mode 100644
index c0ebcc0a5b6b30414cea20e253b5ca1b3e9f5aee..0000000000000000000000000000000000000000
--- a/chrome/common/translate/translate_util_unittest.cc
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// 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 "base/command_line.h"
-#include "chrome/common/chrome_switches.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "url/gurl.h"
-
-typedef testing::Test TranslateUtilTest;
-
-// Tests that synonym language code is converted to one used in supporting list.
-TEST_F(TranslateUtilTest, ToTranslateLanguageSynonym) {
- std::string language;
-
- language = std::string("nb");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
- EXPECT_EQ("no", language);
-
- language = std::string("he");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
- EXPECT_EQ("iw", language);
-
- language = std::string("jv");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
- EXPECT_EQ("jw", language);
-
- language = std::string("fil");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
- EXPECT_EQ("tl", language);
-
- // Preserve a sub code if the language has a synonym.
- language = std::string("he-IL");
- TranslateUtil::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);
- EXPECT_EQ("nb-NO", language);
-
- // Preserve the argument if it doesn't have its synonym.
- language = std::string("en");
- TranslateUtil::ToTranslateLanguageSynonym(&language);
- EXPECT_EQ("en", language);
-}
-
-// Tests that synonym language code is converted to one used in Chrome internal.
-TEST_F(TranslateUtilTest, ToChromeLanguageSynonym) {
- std::string language;
-
- language = std::string("no");
- TranslateUtil::ToChromeLanguageSynonym(&language);
- EXPECT_EQ("nb", language);
-
- language = std::string("iw");
- TranslateUtil::ToChromeLanguageSynonym(&language);
- EXPECT_EQ("he", language);
-
- language = std::string("jw");
- TranslateUtil::ToChromeLanguageSynonym(&language);
- EXPECT_EQ("jv", language);
-
- language = std::string("tl");
- TranslateUtil::ToChromeLanguageSynonym(&language);
- EXPECT_EQ("fil", language);
-
- // Preserve a sub code if the language has a synonym.
- language = std::string("iw-IL");
- TranslateUtil::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);
- EXPECT_EQ("no-NO", language);
-
- // Preserve the argument if it doesn't have its synonym.
- language = std::string("en");
- TranslateUtil::ToChromeLanguageSynonym(&language);
- EXPECT_EQ("en", language);
-}
-
-TEST_F(TranslateUtilTest, SecurityOrigin) {
- GURL origin = TranslateUtil::GetTranslateSecurityOrigin();
- EXPECT_EQ(std::string(TranslateUtil::kSecurityOrigin), origin.spec());
-
- const std::string running_origin("http://www.tamurayukari.com/");
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- command_line->AppendSwitchASCII(switches::kTranslateSecurityOrigin,
- running_origin);
- GURL modified_origin = TranslateUtil::GetTranslateSecurityOrigin();
- EXPECT_EQ(running_origin, modified_origin.spec());
-}
« no previous file with comments | « chrome/common/translate/translate_util.cc ('k') | chrome/renderer/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698