OLD | NEW |
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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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"), ui::PAGE_TRANSITION_AUTO_SUBFRAME); | 897 0, 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"), ui::PAGE_TRANSITION_MANUAL_SUBFRAME); | 902 1, 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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); | 1669 menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); |
1670 | 1670 |
1671 // Check the bubble exists instead of the infobar. | 1671 // Check the bubble exists instead of the infobar. |
1672 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); | 1672 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); |
1673 ASSERT_TRUE(infobar == NULL); | 1673 ASSERT_TRUE(infobar == NULL); |
1674 TranslateBubbleModel* bubble = factory->model(); | 1674 TranslateBubbleModel* bubble = factory->model(); |
1675 ASSERT_TRUE(bubble != NULL); | 1675 ASSERT_TRUE(bubble != NULL); |
1676 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, | 1676 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, |
1677 bubble->GetViewState()); | 1677 bubble->GetViewState()); |
1678 } | 1678 } |
OLD | NEW |