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

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

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 832
833 GURL url("http://www.google.fr"); 833 GURL url("http://www.google.fr");
834 SimulateNavigation(url, "fr", true); 834 SimulateNavigation(url, "fr", true);
835 835
836 EXPECT_TRUE(CloseTranslateInfoBar()); 836 EXPECT_TRUE(CloseTranslateInfoBar());
837 837
838 // Create a pending navigation and simulate a page load. That should be the 838 // Create a pending navigation and simulate a page load. That should be the
839 // equivalent of typing the URL again in the location bar. 839 // equivalent of typing the URL again in the location bar.
840 NavEntryCommittedObserver nav_observer(web_contents()); 840 NavEntryCommittedObserver nav_observer(web_contents());
841 web_contents()->GetController().LoadURL( 841 web_contents()->GetController().LoadURL(
842 url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); 842 url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
843 rvh_tester()->SendNavigateWithTransition( 843 rvh_tester()->SendNavigateWithTransition(
844 0, url, content::PAGE_TRANSITION_TYPED); 844 0, url, ui::PAGE_TRANSITION_TYPED);
845 845
846 // Test that we are really getting a same page navigation, the test would be 846 // Test that we are really getting a same page navigation, the test would be
847 // useless if it was not the case. 847 // useless if it was not the case.
848 const content::LoadCommittedDetails& nav_details = 848 const content::LoadCommittedDetails& nav_details =
849 nav_observer.load_committed_details(); 849 nav_observer.load_committed_details();
850 EXPECT_TRUE(nav_details.entry != NULL); // There was a navigation. 850 EXPECT_TRUE(nav_details.entry != NULL); // There was a navigation.
851 EXPECT_EQ(content::NAVIGATION_TYPE_SAME_PAGE, nav_details.type); 851 EXPECT_EQ(content::NAVIGATION_TYPE_SAME_PAGE, nav_details.type);
852 852
853 // The TranslateManager class processes the navigation entry committed 853 // The TranslateManager class processes the navigation entry committed
854 // notification in a posted task; process that task. 854 // notification in a posted task; process that task.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 887
888 EXPECT_TRUE(CloseTranslateInfoBar()); 888 EXPECT_TRUE(CloseTranslateInfoBar());
889 889
890 content::RenderFrameHostTester* subframe_tester = 890 content::RenderFrameHostTester* subframe_tester =
891 content::RenderFrameHostTester::For( 891 content::RenderFrameHostTester::For(
892 content::RenderFrameHostTester::For(main_rfh()) 892 content::RenderFrameHostTester::For(main_rfh())
893 ->AppendChild("subframe")); 893 ->AppendChild("subframe"));
894 894
895 // Simulate a sub-frame auto-navigating. 895 // Simulate a sub-frame auto-navigating.
896 subframe_tester->SendNavigateWithTransition( 896 subframe_tester->SendNavigateWithTransition(
897 1, GURL("http://pub.com"), content::PAGE_TRANSITION_AUTO_SUBFRAME); 897 1, GURL("http://pub.com"), ui::PAGE_TRANSITION_AUTO_SUBFRAME);
898 EXPECT_TRUE(GetTranslateInfoBar() == NULL); 898 EXPECT_TRUE(GetTranslateInfoBar() == NULL);
899 899
900 // Simulate the user navigating in a sub-frame. 900 // Simulate the user navigating in a sub-frame.
901 subframe_tester->SendNavigateWithTransition( 901 subframe_tester->SendNavigateWithTransition(
902 2, GURL("http://pub.com"), content::PAGE_TRANSITION_MANUAL_SUBFRAME); 902 2, GURL("http://pub.com"), ui::PAGE_TRANSITION_MANUAL_SUBFRAME);
903 EXPECT_TRUE(GetTranslateInfoBar() == NULL); 903 EXPECT_TRUE(GetTranslateInfoBar() == NULL);
904 904
905 // Navigate out of page, a new infobar should show. 905 // Navigate out of page, a new infobar should show.
906 SimulateNavigation(GURL("http://www.google.fr/foot"), "fr", true); 906 SimulateNavigation(GURL("http://www.google.fr/foot"), "fr", true);
907 EXPECT_TRUE(GetTranslateInfoBar() != NULL); 907 EXPECT_TRUE(GetTranslateInfoBar() != NULL);
908 } 908 }
909 909
910 // Tests that denying translation is sticky when navigating in page. 910 // Tests that denying translation is sticky when navigating in page.
911 TEST_F(TranslateManagerRenderViewHostTest, DenyTranslateInPageNavigation) { 911 TEST_F(TranslateManagerRenderViewHostTest, DenyTranslateInPageNavigation) {
912 // TODO(port): Test corresponding bubble translate UX: http://crbug.com/383235 912 // TODO(port): Test corresponding bubble translate UX: http://crbug.com/383235
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); 1671 menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0);
1672 1672
1673 // Check the bubble exists instead of the infobar. 1673 // Check the bubble exists instead of the infobar.
1674 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); 1674 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
1675 ASSERT_TRUE(infobar == NULL); 1675 ASSERT_TRUE(infobar == NULL);
1676 TranslateBubbleModel* bubble = factory->model(); 1676 TranslateBubbleModel* bubble = factory->model();
1677 ASSERT_TRUE(bubble != NULL); 1677 ASSERT_TRUE(bubble != NULL);
1678 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, 1678 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING,
1679 bubble->GetViewState()); 1679 bubble->GetViewState());
1680 } 1680 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698