Home | History | Annotate | Download | only in translate

Lines Matching refs:infobar

84   // Returns the translate infobar if there is 1 infobar and it is a translate
85 // infobar.
92 // If there is 1 infobar and it is a translate infobar, closes it and returns
95 InfoBarDelegate* infobar = GetTranslateInfoBar();
96 if (!infobar)
98 infobar->InfoBarDismissed(); // Simulates closing the infobar.
99 contents()->RemoveInfoBar(infobar);
103 // Checks whether |infobar| has been removed and clears the removed infobar
111 // Returns true if at least one infobar was closed.
125 // If there is 1 infobar and it is a translate infobar, deny translation and
128 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
129 if (!infobar)
131 infobar->TranslationDeclined();
132 contents()->RemoveInfoBar(infobar);
284 // We should have an infobar.
285 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
286 ASSERT_TRUE(infobar != NULL);
287 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type());
291 infobar->Translate();
293 // The "Translating..." infobar should be showing.
294 infobar = GetTranslateInfoBar();
295 ASSERT_TRUE(infobar != NULL);
296 EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATING, infobar->type());
313 // The after translate infobar should be showing.
314 infobar = GetTranslateInfoBar();
315 ASSERT_TRUE(infobar != NULL);
316 EXPECT_EQ(TranslateInfoBarDelegate::AFTER_TRANSLATE, infobar->type());
320 std::string new_original_lang = infobar->GetLanguageCodeAt(0);
321 infobar->SetOriginalLanguage(0);
328 // infobar is now invalid.
331 infobar = new_infobar;
335 std::string new_target_lang = infobar->GetLanguageCodeAt(1);
336 infobar->SetTargetLanguage(1);
343 // infobar is now invalid.
352 // We should have an infobar.
353 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
354 ASSERT_TRUE(infobar != NULL);
355 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type());
359 infobar->Translate();
366 // And we should have an error infobar showing.
367 infobar = GetTranslateInfoBar();
368 ASSERT_TRUE(infobar != NULL);
369 EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATION_ERROR, infobar->type());
379 // We should not have an infobar as we don't know the language.
390 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
391 ASSERT_TRUE(infobar != NULL);
392 EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATION_ERROR, infobar->type());
393 EXPECT_TRUE(infobar->IsError());
394 infobar->MessageInfoBarButtonPressed();
402 // The after translate infobar should be showing.
403 infobar = GetTranslateInfoBar();
404 ASSERT_TRUE(infobar != NULL);
405 EXPECT_EQ(TranslateInfoBarDelegate::AFTER_TRANSLATE, infobar->type());
406 EXPECT_EQ("fr", infobar->GetOriginalLanguageCode());
407 EXPECT_EQ("en", infobar->GetTargetLanguageCode());
417 infobar = GetTranslateInfoBar();
418 ASSERT_TRUE(infobar != NULL);
419 EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATION_ERROR, infobar->type());
420 EXPECT_EQ(TranslateErrors::IDENTICAL_LANGUAGES, infobar->error());
430 infobar = GetTranslateInfoBar();
431 ASSERT_TRUE(infobar != NULL);
432 EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATION_ERROR, infobar->type());
433 EXPECT_EQ(TranslateErrors::UNKNOWN_LANGUAGE, infobar->error());
440 // true if we expect a translate infobar for that language.
488 // We should not have a translate infobar.
489 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
490 ASSERT_TRUE(infobar == NULL);
497 infobar = GetTranslateInfoBar();
498 EXPECT_EQ(kExpectations[i], infobar != NULL);
501 if (infobar != NULL)
512 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
513 ASSERT_TRUE(infobar != NULL);
514 infobar->Translate();
549 // Send a new PageContents, we should not show an infobar.
553 // Do the same steps but simulate closing the infobar this time.
561 // Test that reloading the page brings back the infobar.
566 // Close the infobar.
569 // Reload should bring back the infobar.
586 // location bar brings back the infobar.
593 // Close the infobar.
615 // Tests that a closed translate infobar does not reappear when navigating
621 // Close the infobar.
624 // Navigate in page, no infobar should be shown.
629 // Navigate out of page, a new infobar should show.
634 // Tests that a closed translate infobar does not reappear when navigating
640 // Close the infobar.
653 // Navigate out of page, a new infobar should show.
668 // Navigate in page, no infobar should be shown.
672 // Navigate out of page, a new infobar should show.
677 // Tests that after translating and closing the infobar, the infobar does not
684 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
685 ASSERT_TRUE(infobar != NULL);
686 infobar->Translate();
691 // Close the infobar.
694 // Navigate in page, no infobar should be shown.
698 // Navigate out of page, a new infobar should show.
706 // Tests that the after translate the infobar still shows when navigating
713 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
714 ASSERT_TRUE(infobar != NULL);
715 infobar->Translate();
719 // The after translate infobar is showing.
720 infobar = GetTranslateInfoBar();
721 ASSERT_TRUE(infobar != NULL);
723 // Navigate in page, the same infobar should still be shown.
728 EXPECT_EQ(infobar, GetTranslateInfoBar());
730 // Navigate out of page, a new infobar should show.
734 // The old infobar is gone.
735 EXPECT_TRUE(CheckInfoBarRemovedAndReset(infobar));
740 // Tests that no translate infobar is shown when navigating to a page in an
756 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
757 ASSERT_TRUE(infobar != NULL);
759 infobar->Translate();
766 // An error infobar should be showing to report that we don't support this
768 infobar = GetTranslateInfoBar();
769 ASSERT_TRUE(infobar != NULL);
770 EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATION_ERROR, infobar->type());
772 // This infobar should have a button (so the string should not be empty).
773 ASSERT_FALSE(infobar->GetMessageInfoBarButtonText().empty());
775 // Pressing the button on that infobar should revert to the original language.
777 infobar->MessageInfoBarButtonPressed();
781 // And it should have removed the infobar.
785 // Tests that no translate infobar is shown when Chrome is in a language that
812 // An infobar should be shown.
813 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
814 EXPECT_TRUE(infobar != NULL);
819 // Navigate to a new page, that should close the previous infobar.
822 infobar = GetTranslateInfoBar();
823 EXPECT_TRUE(infobar == NULL);
826 // a translate infobar.
828 infobar = GetTranslateInfoBar();
829 EXPECT_TRUE(infobar == NULL);
838 // An infobar should be shown.
855 // Close the infobar.
861 // There should not be a translate infobar.
873 // There should be a translate infobar.
884 // An infobar should be shown.
901 // Close the infobar.
907 // There should not be a translate infobar.
919 // There should be a translate infobar.
940 // The translating infobar should be showing.
941 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
942 ASSERT_TRUE(infobar != NULL);
943 EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATING, infobar->type());
971 // behavior, which is show a "before translate" infobar.
976 infobar = GetTranslateInfoBar();
977 ASSERT_TRUE(infobar != NULL);
978 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type());
1011 // The "translating..." infobar should be showing.
1012 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
1013 ASSERT_TRUE(infobar != NULL);
1014 EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATING, infobar->type());
1041 infobar = GetTranslateInfoBar();
1042 ASSERT_TRUE(infobar != NULL);
1043 infobar->Translate();
1056 infobar = GetTranslateInfoBar();
1057 ASSERT_TRUE(infobar != NULL);
1058 infobar->Translate();
1088 // translate" infobar when the translation is accepted/declined 3 times,
1099 TranslateInfoBarDelegate* infobar;
1107 infobar = GetTranslateInfoBar();
1108 ASSERT_TRUE(infobar != NULL);
1109 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type());
1111 EXPECT_FALSE(infobar->ShouldShowAlwaysTranslateButton());
1112 infobar->Translate();
1115 EXPECT_TRUE(infobar->ShouldShowAlwaysTranslateButton());
1121 infobar->AlwaysTranslatePageLanguage();
1139 infobar = GetTranslateInfoBar();
1140 ASSERT_TRUE(infobar != NULL);
1141 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type());
1143 EXPECT_FALSE(infobar->ShouldShowNeverTranslateButton());
1144 infobar->TranslationDeclined();
1146 EXPECT_TRUE(infobar->ShouldShowNeverTranslateButton());
1152 infobar->NeverTranslatePageLanguage();
1154 // No translation should have occured and the infobar should be gone.
1160 // Tests that we don't show a translate infobar when a page instructs that it
1166 // We should not have an infobar.
1183 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
1184 ASSERT_TRUE(infobar != NULL);
1186 infobar->Translate();
1196 infobar = GetTranslateInfoBar();
1197 ASSERT_TRUE(infobar != NULL);
1199 infobar->Translate();