Home | History | Annotate | Download | only in translate

Lines Matching refs:infobar

16 #include "chrome/browser/infobars/infobar.h"
147 // Returns the translate infobar if there is 1 infobar and it is a translate
148 // infobar.
154 // If there is 1 infobar and it is a translate infobar, closes it and returns
157 InfoBarDelegate* infobar = GetTranslateInfoBar();
158 if (!infobar)
160 infobar->InfoBarDismissed(); // Simulates closing the infobar.
161 infobar_service()->RemoveInfoBar(infobar);
165 // Checks whether |infobar| has been removed and clears the removed infobar
177 // If there is 1 infobar and it is a translate infobar, deny translation and
180 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
181 if (!infobar)
183 infobar->TranslationDeclined();
184 infobar_service()->RemoveInfoBar(infobar);
375 // We should have an infobar.
376 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
377 ASSERT_TRUE(infobar != NULL);
379 infobar->infobar_type());
383 infobar->Translate();
385 // The "Translating..." infobar should be showing.
386 infobar = GetTranslateInfoBar();
387 ASSERT_TRUE(infobar != NULL);
388 EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATING, infobar->infobar_type());
404 // The after translate infobar should be showing.
405 infobar = GetTranslateInfoBar();
406 ASSERT_TRUE(infobar != NULL);
407 EXPECT_EQ(TranslateInfoBarDelegate::AFTER_TRANSLATE, infobar->infobar_type());
411 std::string new_original_lang = infobar->language_code_at(0);
412 infobar->set_original_language_index(0);
413 infobar->Translate();
419 // infobar is now invalid.
422 infobar = new_infobar;
426 std::string new_target_lang = infobar->language_code_at(1);
427 infobar->set_target_language_index(1);
428 infobar->Translate();
434 // infobar is now invalid.
442 ASSERT_EQ(new_target_lang, infobar->target_language_code());
448 // We should have an infobar.
449 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
450 ASSERT_TRUE(infobar != NULL);
452 infobar->infobar_type());
456 infobar->Translate();
462 // And we should have an error infobar showing.
463 infobar = GetTranslateInfoBar();
464 ASSERT_TRUE(infobar != NULL);
466 infobar->infobar_type());
476 // We should not have an infobar as we don't know the language.
488 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
489 ASSERT_TRUE(infobar != NULL);
491 infobar->infobar_type());
492 EXPECT_TRUE(infobar->is_error());
493 infobar->MessageInfoBarButtonPressed();
500 // The after translate infobar should be showing.
501 infobar = GetTranslateInfoBar();
502 ASSERT_TRUE(infobar != NULL);
503 EXPECT_EQ(TranslateInfoBarDelegate::AFTER_TRANSLATE, infobar->infobar_type());
504 EXPECT_EQ("fr", infobar->original_language_code());
505 EXPECT_EQ("en", infobar->target_language_code());
514 infobar = GetTranslateInfoBar();
515 ASSERT_TRUE(infobar != NULL);
517 infobar->infobar_type());
518 EXPECT_EQ(TranslateErrors::IDENTICAL_LANGUAGES, infobar->error_type());
528 infobar = GetTranslateInfoBar();
529 ASSERT_TRUE(infobar != NULL);
531 infobar->infobar_type());
532 EXPECT_EQ(TranslateErrors::UNKNOWN_LANGUAGE, infobar->error_type());
553 // We should not have a translate infobar.
554 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
555 ASSERT_TRUE(infobar == NULL);
560 infobar = GetTranslateInfoBar();
563 EXPECT_EQ(expected, infobar != NULL);
565 if (infobar != NULL)
677 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
678 ASSERT_TRUE(infobar != NULL);
679 infobar->Translate();
712 // Send a new PageContents, we should not show an infobar.
716 // Do the same steps but simulate closing the infobar this time.
724 // Test that reloading the page brings back the infobar if the
731 // Reload should bring back the infobar if the page succeds
741 // Set reload attempts to a high value, we will not see the infobar
749 // location bar brings back the infobar.
777 // Tests that a closed translate infobar does not reappear when navigating
784 // Navigate in page, no infobar should be shown.
788 // Navigate out of page, a new infobar should show.
793 // Tests that a closed translate infobar does not reappear when navigating
810 // Navigate out of page, a new infobar should show.
822 // Navigate in page, no infobar should be shown.
826 // Navigate out of page, a new infobar should show.
831 infobar, the infobar does not
837 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
838 ASSERT_TRUE(infobar != NULL);
839 infobar->Translate();
846 // Navigate in page, no infobar should be shown.
850 // Navigate out of page, a new infobar should show.
858 // Tests that the after translate the infobar still shows when navigating
864 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
865 ASSERT_TRUE(infobar != NULL);
866 infobar->Translate();
869 // The after translate infobar is showing.
870 infobar = GetTranslateInfoBar();
871 ASSERT_TRUE(infobar != NULL);
873 // Navigate out of page, a new infobar should show.
877 // The old infobar is gone.
878 EXPECT_TRUE(CheckInfoBarRemovedAndReset(infobar));
883 // Tests that no translate infobar is shown when navigating to a page in an
898 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
899 ASSERT_TRUE(infobar != NULL);
901 infobar->Translate();
907 // An error infobar should be showing to report that we don't support this
909 infobar = GetTranslateInfoBar();
910 ASSERT_TRUE(infobar != NULL);
912 infobar->infobar_type());
914 // This infobar should have a button (so the string should not be empty).
915 ASSERT_FALSE(infobar->GetMessageInfoBarButtonText().empty());
917 // Pressing the button on that infobar should revert to the original language.
919 infobar->MessageInfoBarButtonPressed();
924 // And it should have removed the infobar.
928 // Tests that no translate infobar is shown and context menu is disabled, when
972 // Expect the infobar to pop up
983 // Expect the infobar to pop up
997 // An infobar should be shown.
998 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
999 EXPECT_TRUE(infobar != NULL);
1004 // Navigate to a new page, that should close the previous infobar.
1007 infobar = GetTranslateInfoBar();
1008 EXPECT_TRUE(infobar == NULL);
1011 // a translate infobar.
1013 infobar = GetTranslateInfoBar();
1014 EXPECT_TRUE(infobar == NULL);
1022 // An infobar should be shown.
1047 // There should not be a translate infobar.
1060 // There should be a translate infobar.
1070 // An infobar should be shown.
1093 // There should not be a translate infobar.
1105 // There should be a translate infobar.
1127 // The translating infobar should be showing.
1128 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
1129 ASSERT_TRUE(infobar != NULL);
1130 EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATING, infobar->infobar_type());
1157 // behavior, which is show a "before translate" infobar.
1162 infobar = GetTranslateInfoBar();
1163 ASSERT_TRUE(infobar != NULL);
1165 infobar->infobar_type());
1200 // The "translating..." infobar should be showing.
1201 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
1202 ASSERT_TRUE(infobar != NULL);
1203 EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATING, infobar->infobar_type());
1229 infobar = GetTranslateInfoBar();
1230 ASSERT_TRUE(infobar != NULL);
1231 infobar->Translate();
1244 infobar = GetTranslateInfoBar();
1245 ASSERT_TRUE(infobar != NULL);
1246 infobar->Translate();
1275 // translate" infobar when the translation is accepted/declined 3 times,
1288 TranslateInfoBarDelegate* infobar;
1299 infobar = GetTranslateInfoBar();
1300 ASSERT_TRUE(infobar != NULL);
1302 infobar->infobar_type());
1304 EXPECT_FALSE(infobar->ShouldShowAlwaysTranslateShortcut());
1305 infobar->Translate();
1308 EXPECT_TRUE(infobar->ShouldShowAlwaysTranslateShortcut());
1314 infobar->AlwaysTranslatePageLanguage();
1332 infobar = GetTranslateInfoBar();
1333 ASSERT_TRUE(infobar != NULL);
1335 infobar->infobar_type());
1337 EXPECT_FALSE(infobar->ShouldShowNeverTranslateShortcut());
1338 infobar->TranslationDeclined();
1340 EXPECT_TRUE(infobar->ShouldShowNeverTranslateShortcut());
1346 infobar->NeverTranslatePageLanguage();
1348 // No translation should have occured and the infobar should be gone.
1354 // Tests that we don't show a translate infobar when a page instructs that it
1359 // We should not have an infobar.
1375 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
1376 ASSERT_TRUE(infobar != NULL);
1378 infobar->Translate();
1387 infobar = GetTranslateInfoBar();
1388 ASSERT_TRUE(infobar != NULL);
1390 infobar->Translate();
1419 // Test that session restore restores the translate infobar and other translate