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

Side by Side Diff: chrome/browser/translate/translate_manager_browsertest.cc

Issue 8253002: Move PageTransition into content namespace. While I'm touching all these files, I've also updated... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/translate/translate_manager.cc ('k') | chrome/browser/ui/auto_login_prompter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 6 #include <algorithm>
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 681
682 // Simulate navigating to a page and getting its language. 682 // Simulate navigating to a page and getting its language.
683 SimulateNavigation(url, "fr", true); 683 SimulateNavigation(url, "fr", true);
684 684
685 // Close the infobar. 685 // Close the infobar.
686 EXPECT_TRUE(CloseTranslateInfoBar()); 686 EXPECT_TRUE(CloseTranslateInfoBar());
687 687
688 // Create a pending navigation and simulate a page load. That should be the 688 // Create a pending navigation and simulate a page load. That should be the
689 // equivalent of typing the URL again in the location bar. 689 // equivalent of typing the URL again in the location bar.
690 NavEntryCommittedObserver nav_observer(contents()); 690 NavEntryCommittedObserver nav_observer(contents());
691 contents()->controller().LoadURL(url, GURL(), PageTransition::TYPED, 691 contents()->controller().LoadURL(url, GURL(), content::PAGE_TRANSITION_TYPED,
692 std::string()); 692 std::string());
693 rvh()->SendNavigate(0, url); 693 rvh()->SendNavigate(0, url);
694 694
695 // Test that we are really getting a same page navigation, the test would be 695 // Test that we are really getting a same page navigation, the test would be
696 // useless if it was not the case. 696 // useless if it was not the case.
697 const content::LoadCommittedDetails& nav_details = 697 const content::LoadCommittedDetails& nav_details =
698 nav_observer.get_load_commited_details(); 698 nav_observer.get_load_commited_details();
699 EXPECT_TRUE(nav_details.entry != NULL); // There was a navigation. 699 EXPECT_TRUE(nav_details.entry != NULL); // There was a navigation.
700 EXPECT_EQ(NavigationType::SAME_PAGE, nav_details.type); 700 EXPECT_EQ(NavigationType::SAME_PAGE, nav_details.type);
701 701
(...skipping 26 matching lines...) Expand all
728 // in a subframe. (http://crbug.com/48215) 728 // in a subframe. (http://crbug.com/48215)
729 TEST_F(TranslateManagerTest, CloseInfoBarInSubframeNavigation) { 729 TEST_F(TranslateManagerTest, CloseInfoBarInSubframeNavigation) {
730 // Simulate navigating to a page and getting its language. 730 // Simulate navigating to a page and getting its language.
731 SimulateNavigation(GURL("http://www.google.fr"), "fr", true); 731 SimulateNavigation(GURL("http://www.google.fr"), "fr", true);
732 732
733 // Close the infobar. 733 // Close the infobar.
734 EXPECT_TRUE(CloseTranslateInfoBar()); 734 EXPECT_TRUE(CloseTranslateInfoBar());
735 735
736 // Simulate a sub-frame auto-navigating. 736 // Simulate a sub-frame auto-navigating.
737 rvh()->SendNavigateWithTransition(1, GURL("http://pub.com"), 737 rvh()->SendNavigateWithTransition(1, GURL("http://pub.com"),
738 PageTransition::AUTO_SUBFRAME); 738 content::PAGE_TRANSITION_AUTO_SUBFRAME);
739 EXPECT_TRUE(GetTranslateInfoBar() == NULL); 739 EXPECT_TRUE(GetTranslateInfoBar() == NULL);
740 740
741 // Simulate the user navigating in a sub-frame. 741 // Simulate the user navigating in a sub-frame.
742 rvh()->SendNavigateWithTransition(2, GURL("http://pub.com"), 742 rvh()->SendNavigateWithTransition(2, GURL("http://pub.com"),
743 PageTransition::MANUAL_SUBFRAME); 743 content::PAGE_TRANSITION_MANUAL_SUBFRAME);
744 EXPECT_TRUE(GetTranslateInfoBar() == NULL); 744 EXPECT_TRUE(GetTranslateInfoBar() == NULL);
745 745
746 // Navigate out of page, a new infobar should show. 746 // Navigate out of page, a new infobar should show.
747 SimulateNavigation(GURL("http://www.google.fr/foot"), "fr", true); 747 SimulateNavigation(GURL("http://www.google.fr/foot"), "fr", true);
748 EXPECT_TRUE(GetTranslateInfoBar() != NULL); 748 EXPECT_TRUE(GetTranslateInfoBar() != NULL);
749 } 749 }
750 750
751 751
752 752
753 // Tests that denying translation is sticky when navigating in page. 753 // Tests that denying translation is sticky when navigating in page.
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 NULL); 1333 NULL);
1334 // Now simulate the URL fetch. 1334 // Now simulate the URL fetch.
1335 SimulateTranslateScriptURLFetch(true); 1335 SimulateTranslateScriptURLFetch(true);
1336 // Now the message should have been sent. 1336 // Now the message should have been sent.
1337 int page_id = 0; 1337 int page_id = 0;
1338 std::string original_lang, target_lang; 1338 std::string original_lang, target_lang;
1339 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); 1339 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang));
1340 EXPECT_EQ("es", original_lang); 1340 EXPECT_EQ("es", original_lang);
1341 EXPECT_EQ("en", target_lang); 1341 EXPECT_EQ("en", target_lang);
1342 } 1342 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_manager.cc ('k') | chrome/browser/ui/auto_login_prompter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698