OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/prefs/pref_change_registrar.h" | 10 #include "chrome/browser/prefs/pref_change_registrar.h" |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
714 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); | 714 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); |
715 ASSERT_TRUE(infobar != NULL); | 715 ASSERT_TRUE(infobar != NULL); |
716 infobar->Translate(); | 716 infobar->Translate(); |
717 SimulateURLFetch(true); // Simulate the translate script being retrieved. | 717 SimulateURLFetch(true); // Simulate the translate script being retrieved. |
718 rvh()->TestOnMessageReceived(ViewHostMsg_PageTranslated(0, 0, "fr", "en", | 718 rvh()->TestOnMessageReceived(ViewHostMsg_PageTranslated(0, 0, "fr", "en", |
719 TranslateErrors::NONE)); | 719 TranslateErrors::NONE)); |
720 // The after translate infobar is showing. | 720 // The after translate infobar is showing. |
721 infobar = GetTranslateInfoBar(); | 721 infobar = GetTranslateInfoBar(); |
722 ASSERT_TRUE(infobar != NULL); | 722 ASSERT_TRUE(infobar != NULL); |
723 | 723 |
724 // Navigate in page, the same infobar should still be shown. | |
jeremy
2011/05/17 14:52:15
I've removed this part of the test since the navig
| |
725 ClearRemovedInfoBars(); | |
726 SimulateNavigation(GURL("http://www.google.fr/#ref1"), "fr", | |
727 true); | |
728 EXPECT_FALSE(InfoBarRemoved()); | |
729 EXPECT_EQ(infobar, GetTranslateInfoBar()); | |
730 | |
731 // Navigate out of page, a new infobar should show. | 724 // Navigate out of page, a new infobar should show. |
732 // See note in TranslateCloseInfoBarInPageNavigation test on why it is | 725 // See note in TranslateCloseInfoBarInPageNavigation test on why it is |
733 // important to navigate to a page in a different language for this test. | 726 // important to navigate to a page in a different language for this test. |
734 SimulateNavigation(GURL("http://www.google.de"), "de", true); | 727 SimulateNavigation(GURL("http://www.google.de"), "de", true); |
735 // The old infobar is gone. | 728 // The old infobar is gone. |
736 EXPECT_TRUE(CheckInfoBarRemovedAndReset(infobar)); | 729 EXPECT_TRUE(CheckInfoBarRemovedAndReset(infobar)); |
737 // And there is a new one. | 730 // And there is a new one. |
738 EXPECT_TRUE(GetTranslateInfoBar() != NULL); | 731 EXPECT_TRUE(GetTranslateInfoBar() != NULL); |
739 } | 732 } |
740 | 733 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1204 NULL); | 1197 NULL); |
1205 // Now simulate the URL fetch. | 1198 // Now simulate the URL fetch. |
1206 SimulateURLFetch(true); | 1199 SimulateURLFetch(true); |
1207 // Now the message should have been sent. | 1200 // Now the message should have been sent. |
1208 int page_id = 0; | 1201 int page_id = 0; |
1209 std::string original_lang, target_lang; | 1202 std::string original_lang, target_lang; |
1210 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); | 1203 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); |
1211 EXPECT_EQ("es", original_lang); | 1204 EXPECT_EQ("es", original_lang); |
1212 EXPECT_EQ("en", target_lang); | 1205 EXPECT_EQ("en", target_lang); |
1213 } | 1206 } |
OLD | NEW |