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 #include "chrome/browser/ui/browser_navigator_browsertest.h" | 5 #include "chrome/browser/ui/browser_navigator_browsertest.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/tabs/tab_strip_model.h" | 9 #include "chrome/browser/tabs/tab_strip_model.h" |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 p.url = singleton_url; | 879 p.url = singleton_url; |
880 p.window_action = browser::NavigateParams::SHOW_WINDOW; | 880 p.window_action = browser::NavigateParams::SHOW_WINDOW; |
881 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; | 881 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; |
882 browser::Navigate(&p); | 882 browser::Navigate(&p); |
883 ui_test_utils::WaitForNavigationInCurrentTab(browser()); | 883 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
884 | 884 |
885 // The tab should not be sad anymore. | 885 // The tab should not be sad anymore. |
886 EXPECT_FALSE(tab_contents->is_crashed()); | 886 EXPECT_FALSE(tab_contents->is_crashed()); |
887 } | 887 } |
888 | 888 |
| 889 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 890 NavigateFromDefaultToOptionsInSameTab) { |
| 891 browser()->OpenOptionsDialog(); |
| 892 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 893 EXPECT_EQ(1, browser()->tab_count()); |
| 894 EXPECT_EQ(GURL("chrome://settings/browser"), |
| 895 browser()->GetSelectedTabContents()->GetURL()); |
| 896 } |
| 897 |
| 898 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 899 NavigateFromBlankToOptionsInSameTab) { |
| 900 browser::NavigateParams p(MakeNavigateParams()); |
| 901 p.url = GURL("about:blank"); |
| 902 browser::Navigate(&p); |
| 903 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 904 |
| 905 browser()->OpenOptionsDialog(); |
| 906 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 907 EXPECT_EQ(1, browser()->tab_count()); |
| 908 EXPECT_EQ(GURL("chrome://settings/browser"), |
| 909 browser()->GetSelectedTabContents()->GetURL()); |
| 910 } |
| 911 |
| 912 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 913 NavigateFromNTPToOptionsInSameTab) { |
| 914 browser::NavigateParams p(MakeNavigateParams()); |
| 915 p.url = GURL("chrome://newtab"); |
| 916 browser::Navigate(&p); |
| 917 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 918 EXPECT_EQ(1, browser()->tab_count()); |
| 919 EXPECT_EQ(GURL("chrome://newtab"), |
| 920 browser()->GetSelectedTabContents()->GetURL()); |
| 921 |
| 922 browser()->OpenOptionsDialog(); |
| 923 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 924 EXPECT_EQ(1, browser()->tab_count()); |
| 925 EXPECT_EQ(GURL("chrome://settings/browser"), |
| 926 browser()->GetSelectedTabContents()->GetURL()); |
| 927 } |
| 928 |
| 929 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 930 NavigateFromPageToOptionsInNewTab) { |
| 931 browser::NavigateParams p(MakeNavigateParams()); |
| 932 browser::Navigate(&p); |
| 933 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 934 EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedTabContents()->GetURL()); |
| 935 EXPECT_EQ(1u, BrowserList::size()); |
| 936 EXPECT_EQ(1, browser()->tab_count()); |
| 937 |
| 938 browser()->OpenOptionsDialog(); |
| 939 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 940 EXPECT_EQ(2, browser()->tab_count()); |
| 941 EXPECT_EQ(GURL("chrome://settings/browser"), |
| 942 browser()->GetSelectedTabContents()->GetURL()); |
| 943 } |
| 944 |
| 945 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 946 NavigateFromNTPToOptionsSingleton) { |
| 947 browser()->OpenOptionsDialog(); |
| 948 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 949 EXPECT_EQ(1, browser()->tab_count()); |
| 950 |
| 951 browser()->NewTab(); |
| 952 EXPECT_EQ(2, browser()->tab_count()); |
| 953 |
| 954 browser()->OpenOptionsDialog(); |
| 955 EXPECT_EQ(2, browser()->tab_count()); |
| 956 EXPECT_EQ(GURL("chrome://settings"), |
| 957 browser()->GetSelectedTabContents()->GetURL()); |
| 958 } |
| 959 |
| 960 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 961 NavigateFromNTPToOptionsPageInSameTab) { |
| 962 browser()->ShowOptionsTab("personal"); |
| 963 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 964 EXPECT_EQ(1, browser()->tab_count()); |
| 965 EXPECT_EQ(GURL("chrome://settings/personal"), |
| 966 browser()->GetSelectedTabContents()->GetURL()); |
| 967 |
| 968 browser()->NewTab(); |
| 969 EXPECT_EQ(2, browser()->tab_count()); |
| 970 |
| 971 browser()->ShowOptionsTab("personal"); |
| 972 EXPECT_EQ(2, browser()->tab_count()); |
| 973 EXPECT_EQ(GURL("chrome://settings/personal"), |
| 974 browser()->GetSelectedTabContents()->GetURL()); |
| 975 } |
| 976 |
| 977 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 978 NavigateFromOtherTabToSingletonOptions) { |
| 979 browser()->OpenOptionsDialog(); |
| 980 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 981 browser()->AddSelectedTabWithURL(GetGoogleURL(), PageTransition::LINK); |
| 982 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 983 |
| 984 browser()->OpenOptionsDialog(); |
| 985 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 986 EXPECT_EQ(2, browser()->tab_count()); |
| 987 EXPECT_EQ(GURL("chrome://settings/browser"), |
| 988 browser()->GetSelectedTabContents()->GetURL()); |
| 989 } |
| 990 |
889 } // namespace | 991 } // namespace |
OLD | NEW |