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

Unified Diff: chrome/renderer/translate_helper_browsertest.cc

Issue 12209114: Translate: introduce unittest for TranslateHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 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_helper.cc ('k') | chrome/renderer/translate_helper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/translate_helper_browsertest.cc
diff --git a/chrome/renderer/translate_helper_browsertest.cc b/chrome/renderer/translate_helper_browsertest.cc
index 84e44580f85be5455761c8784f4d07a6ffdc5e12..0ad7820532537a4af6d6a1415bac662819c31806 100644
--- a/chrome/renderer/translate_helper_browsertest.cc
+++ b/chrome/renderer/translate_helper_browsertest.cc
@@ -29,10 +29,6 @@ class TestTranslateHelper : public TranslateHelper {
OnTranslatePage(page_id, translate_script, source_lang, target_lang);
}
- void ConvertLanguageCodeSynonym(std::string* code) {
- TranslateHelper::ConvertLanguageCodeSynonym(code);
- }
-
MOCK_METHOD0(IsTranslateLibAvailable, bool());
MOCK_METHOD0(IsTranslateLibReady, bool());
MOCK_METHOD0(HasTranslationFinished, bool());
@@ -44,9 +40,9 @@ class TestTranslateHelper : public TranslateHelper {
DISALLOW_COPY_AND_ASSIGN(TestTranslateHelper);
};
-class TranslateHelperTest : public ChromeRenderViewTest {
+class TranslateHelperBrowserTest : public ChromeRenderViewTest {
public:
- TranslateHelperTest() : translate_helper_(NULL) {}
+ TranslateHelperBrowserTest() : translate_helper_(NULL) {}
protected:
virtual void SetUp() {
@@ -86,7 +82,7 @@ class TranslateHelperTest : public ChromeRenderViewTest {
// Tests that the browser gets notified of the translation failure if the
// translate library fails/times-out during initialization.
-TEST_F(TranslateHelperTest, TranslateLibNeverReady) {
+TEST_F(TranslateHelperBrowserTest, TranslateLibNeverReady) {
// We make IsTranslateLibAvailable true so we don't attempt to inject the
// library.
EXPECT_CALL(*translate_helper_, IsTranslateLibAvailable())
@@ -111,7 +107,7 @@ TEST_F(TranslateHelperTest, TranslateLibNeverReady) {
// Tests that the browser gets notified of the translation success when the
// translation succeeds.
-TEST_F(TranslateHelperTest, TranslateSuccess) {
+TEST_F(TranslateHelperBrowserTest, TranslateSuccess) {
// We make IsTranslateLibAvailable true so we don't attempt to inject the
// library.
EXPECT_CALL(*translate_helper_, IsTranslateLibAvailable())
@@ -154,7 +150,7 @@ TEST_F(TranslateHelperTest, TranslateSuccess) {
// Tests that the browser gets notified of the translation failure when the
// translation fails.
-TEST_F(TranslateHelperTest, TranslateFailure) {
+TEST_F(TranslateHelperBrowserTest, TranslateFailure) {
// We make IsTranslateLibAvailable true so we don't attempt to inject the
// library.
EXPECT_CALL(*translate_helper_, IsTranslateLibAvailable())
@@ -190,7 +186,7 @@ TEST_F(TranslateHelperTest, TranslateFailure) {
// Tests that when the browser translate a page for which the language is
// undefined we query the translate element to get the language.
-TEST_F(TranslateHelperTest, UndefinedSourceLang) {
+TEST_F(TranslateHelperBrowserTest, UndefinedSourceLang) {
// We make IsTranslateLibAvailable true so we don't attempt to inject the
// library.
EXPECT_CALL(*translate_helper_, IsTranslateLibAvailable())
@@ -229,7 +225,7 @@ TEST_F(TranslateHelperTest, UndefinedSourceLang) {
// Tests that starting a translation while a similar one is pending does not
// break anything.
-TEST_F(TranslateHelperTest, MultipleSimilarTranslations) {
+TEST_F(TranslateHelperBrowserTest, MultipleSimilarTranslations) {
// We make IsTranslateLibAvailable true so we don't attempt to inject the
// library.
EXPECT_CALL(*translate_helper_, IsTranslateLibAvailable())
@@ -270,7 +266,7 @@ TEST_F(TranslateHelperTest, MultipleSimilarTranslations) {
}
// Tests that starting a translation while a different one is pending works.
-TEST_F(TranslateHelperTest, MultipleDifferentTranslations) {
+TEST_F(TranslateHelperBrowserTest, MultipleDifferentTranslations) {
EXPECT_CALL(*translate_helper_, IsTranslateLibAvailable())
.Times(AtLeast(1))
.WillRepeatedly(Return(true));
@@ -307,27 +303,6 @@ TEST_F(TranslateHelperTest, MultipleDifferentTranslations) {
EXPECT_EQ(TranslateErrors::NONE, error);
}
-// Tests that synonym language code is converted to one used in supporting list.
-TEST_F(TranslateHelperTest, LanguageCodeSynonyms) {
- std::string language;
-
- language = std::string("nb");
- translate_helper_->ConvertLanguageCodeSynonym(&language);
- EXPECT_EQ(0, language.compare("no"));
-
- language = std::string("he");
- translate_helper_->ConvertLanguageCodeSynonym(&language);
- EXPECT_EQ(0, language.compare("iw"));
-
- language = std::string("jv");
- translate_helper_->ConvertLanguageCodeSynonym(&language);
- EXPECT_EQ(0, language.compare("jw"));
-
- language = std::string("fil");
- translate_helper_->ConvertLanguageCodeSynonym(&language);
- EXPECT_EQ(0, language.compare("tl"));
-}
-
// Tests that we send the right translate language message for a page and that
// we respect the "no translate" meta-tag.
TEST_F(ChromeRenderViewTest, TranslatablePage) {
« no previous file with comments | « chrome/renderer/translate_helper.cc ('k') | chrome/renderer/translate_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698