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/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/tabs/tab_strip_model.h" | 11 #include "chrome/browser/tabs/tab_strip_model.h" |
12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
13 #include "chrome/browser/ui/browser_navigator.h" | 13 #include "chrome/browser/ui/browser_navigator.h" |
14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/browser/ui/omnibox/location_bar.h" | 15 #include "chrome/browser/ui/omnibox/location_bar.h" |
16 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 16 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
20 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
21 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/browser/tab_contents/tab_contents.h" |
22 #include "content/browser/tab_contents/tab_contents_view.h" | 22 #include "content/browser/tab_contents/tab_contents_view.h" |
| 23 #include "content/public/browser/notification_service.h" |
23 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
27 GURL GetGoogleURL() { | 28 GURL GetGoogleURL() { |
28 return GURL("http://www.google.com/"); | 29 return GURL("http://www.google.com/"); |
29 } | 30 } |
30 | 31 |
31 GURL GetSettingsURL() { | 32 GURL GetSettingsURL() { |
32 return GURL(chrome::kChromeUISettingsURL); | 33 return GURL(chrome::kChromeUISettingsURL); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { | 131 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { |
131 GURL singleton_url1("http://maps.google.com/"); | 132 GURL singleton_url1("http://maps.google.com/"); |
132 | 133 |
133 // Register for a notification if an additional tab_contents was instantiated. | 134 // Register for a notification if an additional tab_contents was instantiated. |
134 // Opening a Singleton tab that is already opened should not be opening a new | 135 // Opening a Singleton tab that is already opened should not be opening a new |
135 // tab nor be creating a new TabContents object | 136 // tab nor be creating a new TabContents object |
136 content::NotificationRegistrar registrar; | 137 content::NotificationRegistrar registrar; |
137 | 138 |
138 // As the registrar object goes out of scope, this will get unregistered | 139 // As the registrar object goes out of scope, this will get unregistered |
139 registrar.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, | 140 registrar.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
140 NotificationService::AllSources()); | 141 content::NotificationService::AllSources()); |
141 | 142 |
142 browser()->AddSelectedTabWithURL( | 143 browser()->AddSelectedTabWithURL( |
143 singleton_url1, content::PAGE_TRANSITION_LINK); | 144 singleton_url1, content::PAGE_TRANSITION_LINK); |
144 browser()->AddSelectedTabWithURL( | 145 browser()->AddSelectedTabWithURL( |
145 GetGoogleURL(), content::PAGE_TRANSITION_LINK); | 146 GetGoogleURL(), content::PAGE_TRANSITION_LINK); |
146 | 147 |
147 // We should have one browser with 3 tabs, the 3rd selected. | 148 // We should have one browser with 3 tabs, the 3rd selected. |
148 EXPECT_EQ(1u, BrowserList::size()); | 149 EXPECT_EQ(1u, BrowserList::size()); |
149 EXPECT_EQ(2, browser()->active_index()); | 150 EXPECT_EQ(2, browser()->active_index()); |
150 | 151 |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 | 916 |
916 // This test verifies that the settings page isn't opened in the incognito | 917 // This test verifies that the settings page isn't opened in the incognito |
917 // window from a non-incognito window (bookmark open-in-incognito trigger). | 918 // window from a non-incognito window (bookmark open-in-incognito trigger). |
918 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 919 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
919 Disposition_Settings_UseNonIncognitoWindowForBookmark) { | 920 Disposition_Settings_UseNonIncognitoWindowForBookmark) { |
920 browser::NavigateParams params(browser(), GURL("chrome://settings"), | 921 browser::NavigateParams params(browser(), GURL("chrome://settings"), |
921 content::PAGE_TRANSITION_AUTO_BOOKMARK); | 922 content::PAGE_TRANSITION_AUTO_BOOKMARK); |
922 params.disposition = OFF_THE_RECORD; | 923 params.disposition = OFF_THE_RECORD; |
923 { | 924 { |
924 ui_test_utils::WindowedNotificationObserver observer( | 925 ui_test_utils::WindowedNotificationObserver observer( |
925 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 926 content::NOTIFICATION_LOAD_STOP, |
| 927 content::NotificationService::AllSources()); |
926 browser::Navigate(¶ms); | 928 browser::Navigate(¶ms); |
927 observer.Wait(); | 929 observer.Wait(); |
928 } | 930 } |
929 | 931 |
930 EXPECT_EQ(1u, BrowserList::size()); | 932 EXPECT_EQ(1u, BrowserList::size()); |
931 EXPECT_EQ(GURL("chrome://settings"), | 933 EXPECT_EQ(GURL("chrome://settings"), |
932 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); | 934 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); |
933 } | 935 } |
934 | 936 |
935 // This test verifies that the bookmarks page isn't opened in the incognito | 937 // This test verifies that the bookmarks page isn't opened in the incognito |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 ui_test_utils::NavigateToURL(&p); | 984 ui_test_utils::NavigateToURL(&p); |
983 | 985 |
984 // The tab should not be sad anymore. | 986 // The tab should not be sad anymore. |
985 EXPECT_FALSE(tab_contents->is_crashed()); | 987 EXPECT_FALSE(tab_contents->is_crashed()); |
986 } | 988 } |
987 | 989 |
988 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 990 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
989 NavigateFromDefaultToOptionsInSameTab) { | 991 NavigateFromDefaultToOptionsInSameTab) { |
990 { | 992 { |
991 ui_test_utils::WindowedNotificationObserver observer( | 993 ui_test_utils::WindowedNotificationObserver observer( |
992 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 994 content::NOTIFICATION_LOAD_STOP, |
| 995 content::NotificationService::AllSources()); |
993 browser()->OpenOptionsDialog(); | 996 browser()->OpenOptionsDialog(); |
994 observer.Wait(); | 997 observer.Wait(); |
995 } | 998 } |
996 EXPECT_EQ(1, browser()->tab_count()); | 999 EXPECT_EQ(1, browser()->tab_count()); |
997 EXPECT_EQ(GetSettingsURL(), | 1000 EXPECT_EQ(GetSettingsURL(), |
998 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); | 1001 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); |
999 } | 1002 } |
1000 | 1003 |
1001 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1004 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1002 NavigateFromBlankToOptionsInSameTab) { | 1005 NavigateFromBlankToOptionsInSameTab) { |
1003 browser::NavigateParams p(MakeNavigateParams()); | 1006 browser::NavigateParams p(MakeNavigateParams()); |
1004 p.url = GURL(chrome::kAboutBlankURL); | 1007 p.url = GURL(chrome::kAboutBlankURL); |
1005 ui_test_utils::NavigateToURL(&p); | 1008 ui_test_utils::NavigateToURL(&p); |
1006 | 1009 |
1007 { | 1010 { |
1008 ui_test_utils::WindowedNotificationObserver observer( | 1011 ui_test_utils::WindowedNotificationObserver observer( |
1009 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1012 content::NOTIFICATION_LOAD_STOP, |
| 1013 content::NotificationService::AllSources()); |
1010 browser()->OpenOptionsDialog(); | 1014 browser()->OpenOptionsDialog(); |
1011 observer.Wait(); | 1015 observer.Wait(); |
1012 } | 1016 } |
1013 EXPECT_EQ(1, browser()->tab_count()); | 1017 EXPECT_EQ(1, browser()->tab_count()); |
1014 EXPECT_EQ(GetSettingsURL(), | 1018 EXPECT_EQ(GetSettingsURL(), |
1015 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); | 1019 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); |
1016 } | 1020 } |
1017 | 1021 |
1018 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1022 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1019 NavigateFromNTPToOptionsInSameTab) { | 1023 NavigateFromNTPToOptionsInSameTab) { |
1020 browser::NavigateParams p(MakeNavigateParams()); | 1024 browser::NavigateParams p(MakeNavigateParams()); |
1021 p.url = GURL(chrome::kChromeUINewTabURL); | 1025 p.url = GURL(chrome::kChromeUINewTabURL); |
1022 ui_test_utils::NavigateToURL(&p); | 1026 ui_test_utils::NavigateToURL(&p); |
1023 EXPECT_EQ(1, browser()->tab_count()); | 1027 EXPECT_EQ(1, browser()->tab_count()); |
1024 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), | 1028 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), |
1025 browser()->GetSelectedTabContents()->GetURL()); | 1029 browser()->GetSelectedTabContents()->GetURL()); |
1026 | 1030 |
1027 { | 1031 { |
1028 ui_test_utils::WindowedNotificationObserver observer( | 1032 ui_test_utils::WindowedNotificationObserver observer( |
1029 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1033 content::NOTIFICATION_LOAD_STOP, |
| 1034 content::NotificationService::AllSources()); |
1030 browser()->OpenOptionsDialog(); | 1035 browser()->OpenOptionsDialog(); |
1031 observer.Wait(); | 1036 observer.Wait(); |
1032 } | 1037 } |
1033 EXPECT_EQ(1, browser()->tab_count()); | 1038 EXPECT_EQ(1, browser()->tab_count()); |
1034 EXPECT_EQ(GetSettingsURL(), | 1039 EXPECT_EQ(GetSettingsURL(), |
1035 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); | 1040 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); |
1036 } | 1041 } |
1037 | 1042 |
1038 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1043 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1039 NavigateFromPageToOptionsInNewTab) { | 1044 NavigateFromPageToOptionsInNewTab) { |
1040 browser::NavigateParams p(MakeNavigateParams()); | 1045 browser::NavigateParams p(MakeNavigateParams()); |
1041 ui_test_utils::NavigateToURL(&p); | 1046 ui_test_utils::NavigateToURL(&p); |
1042 EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedTabContents()->GetURL()); | 1047 EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedTabContents()->GetURL()); |
1043 EXPECT_EQ(1u, BrowserList::size()); | 1048 EXPECT_EQ(1u, BrowserList::size()); |
1044 EXPECT_EQ(1, browser()->tab_count()); | 1049 EXPECT_EQ(1, browser()->tab_count()); |
1045 | 1050 |
1046 { | 1051 { |
1047 ui_test_utils::WindowedNotificationObserver observer( | 1052 ui_test_utils::WindowedNotificationObserver observer( |
1048 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1053 content::NOTIFICATION_LOAD_STOP, |
| 1054 content::NotificationService::AllSources()); |
1049 browser()->OpenOptionsDialog(); | 1055 browser()->OpenOptionsDialog(); |
1050 observer.Wait(); | 1056 observer.Wait(); |
1051 } | 1057 } |
1052 EXPECT_EQ(2, browser()->tab_count()); | 1058 EXPECT_EQ(2, browser()->tab_count()); |
1053 EXPECT_EQ(GetSettingsURL(), | 1059 EXPECT_EQ(GetSettingsURL(), |
1054 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); | 1060 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); |
1055 } | 1061 } |
1056 | 1062 |
1057 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1063 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1058 NavigateFromNTPToOptionsSingleton) { | 1064 NavigateFromNTPToOptionsSingleton) { |
1059 { | 1065 { |
1060 ui_test_utils::WindowedNotificationObserver observer( | 1066 ui_test_utils::WindowedNotificationObserver observer( |
1061 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1067 content::NOTIFICATION_LOAD_STOP, |
| 1068 content::NotificationService::AllSources()); |
1062 browser()->OpenOptionsDialog(); | 1069 browser()->OpenOptionsDialog(); |
1063 observer.Wait(); | 1070 observer.Wait(); |
1064 } | 1071 } |
1065 EXPECT_EQ(1, browser()->tab_count()); | 1072 EXPECT_EQ(1, browser()->tab_count()); |
1066 | 1073 |
1067 browser()->NewTab(); | 1074 browser()->NewTab(); |
1068 EXPECT_EQ(2, browser()->tab_count()); | 1075 EXPECT_EQ(2, browser()->tab_count()); |
1069 | 1076 |
1070 { | 1077 { |
1071 ui_test_utils::WindowedNotificationObserver observer( | 1078 ui_test_utils::WindowedNotificationObserver observer( |
1072 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1079 content::NOTIFICATION_LOAD_STOP, |
| 1080 content::NotificationService::AllSources()); |
1073 browser()->OpenOptionsDialog(); | 1081 browser()->OpenOptionsDialog(); |
1074 observer.Wait(); | 1082 observer.Wait(); |
1075 } | 1083 } |
1076 EXPECT_EQ(2, browser()->tab_count()); | 1084 EXPECT_EQ(2, browser()->tab_count()); |
1077 EXPECT_EQ(GetSettingsURL(), | 1085 EXPECT_EQ(GetSettingsURL(), |
1078 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); | 1086 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); |
1079 } | 1087 } |
1080 | 1088 |
1081 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1089 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1082 NavigateFromNTPToOptionsPageInSameTab) { | 1090 NavigateFromNTPToOptionsPageInSameTab) { |
1083 { | 1091 { |
1084 ui_test_utils::WindowedNotificationObserver observer( | 1092 ui_test_utils::WindowedNotificationObserver observer( |
1085 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1093 content::NOTIFICATION_LOAD_STOP, |
| 1094 content::NotificationService::AllSources()); |
1086 browser()->ShowOptionsTab(chrome::kPersonalOptionsSubPage); | 1095 browser()->ShowOptionsTab(chrome::kPersonalOptionsSubPage); |
1087 observer.Wait(); | 1096 observer.Wait(); |
1088 } | 1097 } |
1089 EXPECT_EQ(1, browser()->tab_count()); | 1098 EXPECT_EQ(1, browser()->tab_count()); |
1090 EXPECT_EQ(GetSettingsPersonalURL(), | 1099 EXPECT_EQ(GetSettingsPersonalURL(), |
1091 browser()->GetSelectedTabContents()->GetURL()); | 1100 browser()->GetSelectedTabContents()->GetURL()); |
1092 | 1101 |
1093 browser()->NewTab(); | 1102 browser()->NewTab(); |
1094 EXPECT_EQ(2, browser()->tab_count()); | 1103 EXPECT_EQ(2, browser()->tab_count()); |
1095 | 1104 |
1096 { | 1105 { |
1097 ui_test_utils::WindowedNotificationObserver observer( | 1106 ui_test_utils::WindowedNotificationObserver observer( |
1098 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1107 content::NOTIFICATION_LOAD_STOP, |
| 1108 content::NotificationService::AllSources()); |
1099 browser()->ShowOptionsTab(chrome::kPersonalOptionsSubPage); | 1109 browser()->ShowOptionsTab(chrome::kPersonalOptionsSubPage); |
1100 observer.Wait(); | 1110 observer.Wait(); |
1101 } | 1111 } |
1102 EXPECT_EQ(2, browser()->tab_count()); | 1112 EXPECT_EQ(2, browser()->tab_count()); |
1103 EXPECT_EQ(GetSettingsPersonalURL(), | 1113 EXPECT_EQ(GetSettingsPersonalURL(), |
1104 browser()->GetSelectedTabContents()->GetURL()); | 1114 browser()->GetSelectedTabContents()->GetURL()); |
1105 } | 1115 } |
1106 | 1116 |
1107 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1117 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1108 NavigateFromOtherTabToSingletonOptions) { | 1118 NavigateFromOtherTabToSingletonOptions) { |
1109 { | 1119 { |
1110 ui_test_utils::WindowedNotificationObserver observer( | 1120 ui_test_utils::WindowedNotificationObserver observer( |
1111 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1121 content::NOTIFICATION_LOAD_STOP, |
| 1122 content::NotificationService::AllSources()); |
1112 browser()->OpenOptionsDialog(); | 1123 browser()->OpenOptionsDialog(); |
1113 observer.Wait(); | 1124 observer.Wait(); |
1114 } | 1125 } |
1115 { | 1126 { |
1116 ui_test_utils::WindowedNotificationObserver observer( | 1127 ui_test_utils::WindowedNotificationObserver observer( |
1117 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1128 content::NOTIFICATION_LOAD_STOP, |
| 1129 content::NotificationService::AllSources()); |
1118 browser()->AddSelectedTabWithURL( | 1130 browser()->AddSelectedTabWithURL( |
1119 GetGoogleURL(), content::PAGE_TRANSITION_LINK); | 1131 GetGoogleURL(), content::PAGE_TRANSITION_LINK); |
1120 observer.Wait(); | 1132 observer.Wait(); |
1121 } | 1133 } |
1122 | 1134 |
1123 { | 1135 { |
1124 ui_test_utils::WindowedNotificationObserver observer( | 1136 ui_test_utils::WindowedNotificationObserver observer( |
1125 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1137 content::NOTIFICATION_LOAD_STOP, |
| 1138 content::NotificationService::AllSources()); |
1126 browser()->OpenOptionsDialog(); | 1139 browser()->OpenOptionsDialog(); |
1127 observer.Wait(); | 1140 observer.Wait(); |
1128 } | 1141 } |
1129 EXPECT_EQ(2, browser()->tab_count()); | 1142 EXPECT_EQ(2, browser()->tab_count()); |
1130 EXPECT_EQ(GetSettingsURL(), | 1143 EXPECT_EQ(GetSettingsURL(), |
1131 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); | 1144 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); |
1132 } | 1145 } |
1133 | 1146 |
1134 // Tests that when a new tab is opened from the omnibox, the focus is moved from | 1147 // Tests that when a new tab is opened from the omnibox, the focus is moved from |
1135 // the omnibox for the current tab. | 1148 // the omnibox for the current tab. |
(...skipping 30 matching lines...) Expand all Loading... |
1166 browser()->SelectPreviousTab(); | 1179 browser()->SelectPreviousTab(); |
1167 EXPECT_EQ(0, browser()->active_index()); | 1180 EXPECT_EQ(0, browser()->active_index()); |
1168 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), | 1181 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), |
1169 VIEW_ID_LOCATION_BAR)); | 1182 VIEW_ID_LOCATION_BAR)); |
1170 } | 1183 } |
1171 | 1184 |
1172 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1185 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1173 NavigateFromDefaultToHistoryInSameTab) { | 1186 NavigateFromDefaultToHistoryInSameTab) { |
1174 { | 1187 { |
1175 ui_test_utils::WindowedNotificationObserver observer( | 1188 ui_test_utils::WindowedNotificationObserver observer( |
1176 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1189 content::NOTIFICATION_LOAD_STOP, |
| 1190 content::NotificationService::AllSources()); |
1177 browser()->ShowHistoryTab(); | 1191 browser()->ShowHistoryTab(); |
1178 observer.Wait(); | 1192 observer.Wait(); |
1179 } | 1193 } |
1180 EXPECT_EQ(1, browser()->tab_count()); | 1194 EXPECT_EQ(1, browser()->tab_count()); |
1181 EXPECT_EQ(GURL(chrome::kChromeUIHistoryURL), | 1195 EXPECT_EQ(GURL(chrome::kChromeUIHistoryURL), |
1182 browser()->GetSelectedTabContents()->GetURL()); | 1196 browser()->GetSelectedTabContents()->GetURL()); |
1183 } | 1197 } |
1184 | 1198 |
1185 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1199 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1186 NavigateFromDefaultToBookmarksInSameTab) { | 1200 NavigateFromDefaultToBookmarksInSameTab) { |
1187 { | 1201 { |
1188 ui_test_utils::WindowedNotificationObserver observer( | 1202 ui_test_utils::WindowedNotificationObserver observer( |
1189 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1203 content::NOTIFICATION_LOAD_STOP, |
| 1204 content::NotificationService::AllSources()); |
1190 browser()->OpenBookmarkManager(); | 1205 browser()->OpenBookmarkManager(); |
1191 observer.Wait(); | 1206 observer.Wait(); |
1192 } | 1207 } |
1193 EXPECT_EQ(1, browser()->tab_count()); | 1208 EXPECT_EQ(1, browser()->tab_count()); |
1194 EXPECT_EQ(GURL(chrome::kChromeUIBookmarksURL), | 1209 EXPECT_EQ(GURL(chrome::kChromeUIBookmarksURL), |
1195 browser()->GetSelectedTabContents()->GetURL()); | 1210 browser()->GetSelectedTabContents()->GetURL()); |
1196 } | 1211 } |
1197 | 1212 |
1198 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1213 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
1199 NavigateFromDefaultToDownloadsInSameTab) { | 1214 NavigateFromDefaultToDownloadsInSameTab) { |
1200 { | 1215 { |
1201 ui_test_utils::WindowedNotificationObserver observer( | 1216 ui_test_utils::WindowedNotificationObserver observer( |
1202 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 1217 content::NOTIFICATION_LOAD_STOP, |
| 1218 content::NotificationService::AllSources()); |
1203 browser()->ShowDownloadsTab(); | 1219 browser()->ShowDownloadsTab(); |
1204 observer.Wait(); | 1220 observer.Wait(); |
1205 } | 1221 } |
1206 EXPECT_EQ(1, browser()->tab_count()); | 1222 EXPECT_EQ(1, browser()->tab_count()); |
1207 EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL), | 1223 EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL), |
1208 browser()->GetSelectedTabContents()->GetURL()); | 1224 browser()->GetSelectedTabContents()->GetURL()); |
1209 } | 1225 } |
1210 | 1226 |
1211 } // namespace | 1227 } // namespace |
OLD | NEW |