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

Side by Side Diff: chrome/browser/ui/browser_navigator_browsertest.cc

Issue 9015022: Replace most of Browser::GetSelectedTabContents calls into Browser::GetSelectedWebContents. I've ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
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 #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/prefs/incognito_mode_prefs.h" 10 #include "chrome/browser/prefs/incognito_mode_prefs.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/tabs/tab_strip_model.h" 13 #include "chrome/browser/tabs/tab_strip_model.h"
14 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list.h"
15 #include "chrome/browser/ui/browser_navigator.h" 15 #include "chrome/browser/ui/browser_navigator.h"
16 #include "chrome/browser/ui/browser_window.h" 16 #include "chrome/browser/ui/browser_window.h"
17 #include "chrome/browser/ui/omnibox/location_bar.h" 17 #include "chrome/browser/ui/omnibox/location_bar.h"
18 #include "chrome/browser/ui/omnibox/omnibox_view.h" 18 #include "chrome/browser/ui/omnibox/omnibox_view.h"
19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
22 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
23 #include "chrome/test/base/ui_test_utils.h" 23 #include "chrome/test/base/ui_test_utils.h"
24 #include "content/browser/tab_contents/tab_contents.h" 24 #include "content/browser/tab_contents/tab_contents.h"
25 #include "content/browser/tab_contents/tab_contents_view.h" 25 #include "content/browser/tab_contents/tab_contents_view.h"
26 #include "content/public/browser/notification_service.h" 26 #include "content/public/browser/notification_service.h"
27 #include "content/public/browser/notification_types.h" 27 #include "content/public/browser/notification_types.h"
28 28
29 using content::WebContents;
30
29 namespace { 31 namespace {
30 32
31 GURL GetGoogleURL() { 33 GURL GetGoogleURL() {
32 return GURL("http://www.google.com/"); 34 return GURL("http://www.google.com/");
33 } 35 }
34 36
35 GURL GetSettingsURL() { 37 GURL GetSettingsURL() {
36 return GURL(chrome::kChromeUISettingsURL); 38 return GURL(chrome::kChromeUISettingsURL);
37 } 39 }
38 40
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 TabContentsWrapper* BrowserNavigatorTest::CreateTabContents() { 86 TabContentsWrapper* BrowserNavigatorTest::CreateTabContents() {
85 return Browser::TabContentsFactory( 87 return Browser::TabContentsFactory(
86 browser()->profile(), 88 browser()->profile(),
87 NULL, 89 NULL,
88 MSG_ROUTING_NONE, 90 MSG_ROUTING_NONE,
89 browser()->GetSelectedTabContents(), 91 browser()->GetSelectedTabContents(),
90 NULL); 92 NULL);
91 } 93 }
92 94
93 void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) { 95 void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) {
94 GURL old_url = browser()->GetSelectedTabContents()->GetURL(); 96 GURL old_url = browser()->GetSelectedWebContents()->GetURL();
95 browser::NavigateParams p(MakeNavigateParams()); 97 browser::NavigateParams p(MakeNavigateParams());
96 p.disposition = disposition; 98 p.disposition = disposition;
97 browser::Navigate(&p); 99 browser::Navigate(&p);
98 100
99 // Nothing should have happened as a result of Navigate(); 101 // Nothing should have happened as a result of Navigate();
100 EXPECT_EQ(1, browser()->tab_count()); 102 EXPECT_EQ(1, browser()->tab_count());
101 EXPECT_EQ(1u, BrowserList::size()); 103 EXPECT_EQ(1u, BrowserList::size());
102 EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL()); 104 EXPECT_EQ(old_url, browser()->GetSelectedWebContents()->GetURL());
103 } 105 }
104 106
105 void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) { 107 void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) {
106 Browser* incognito_browser = CreateIncognitoBrowser(); 108 Browser* incognito_browser = CreateIncognitoBrowser();
107 109
108 EXPECT_EQ(2u, BrowserList::size()); 110 EXPECT_EQ(2u, BrowserList::size());
109 EXPECT_EQ(1, browser()->tab_count()); 111 EXPECT_EQ(1, browser()->tab_count());
110 EXPECT_EQ(1, incognito_browser->tab_count()); 112 EXPECT_EQ(1, incognito_browser->tab_count());
111 113
112 // Navigate to the page. 114 // Navigate to the page.
113 browser::NavigateParams p(MakeNavigateParams(incognito_browser)); 115 browser::NavigateParams p(MakeNavigateParams(incognito_browser));
114 p.disposition = SINGLETON_TAB; 116 p.disposition = SINGLETON_TAB;
115 p.url = url; 117 p.url = url;
116 p.window_action = browser::NavigateParams::SHOW_WINDOW; 118 p.window_action = browser::NavigateParams::SHOW_WINDOW;
117 browser::Navigate(&p); 119 browser::Navigate(&p);
118 120
119 // This page should be opened in browser() window. 121 // This page should be opened in browser() window.
120 EXPECT_NE(incognito_browser, p.browser); 122 EXPECT_NE(incognito_browser, p.browser);
121 EXPECT_EQ(browser(), p.browser); 123 EXPECT_EQ(browser(), p.browser);
122 EXPECT_EQ(2, browser()->tab_count()); 124 EXPECT_EQ(2, browser()->tab_count());
123 EXPECT_EQ(url, browser()->GetSelectedTabContents()->GetURL()); 125 EXPECT_EQ(url, browser()->GetSelectedWebContents()->GetURL());
124 } 126 }
125 127
126 void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest( 128 void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest(
127 const GURL& url) { 129 const GURL& url) {
128 Browser* browser = CreateIncognitoBrowser(); 130 Browser* browser = CreateIncognitoBrowser();
129 131
130 // Set kIncognitoModeAvailability to FORCED. 132 // Set kIncognitoModeAvailability to FORCED.
131 PrefService* prefs1 = browser->profile()->GetPrefs(); 133 PrefService* prefs1 = browser->profile()->GetPrefs();
132 prefs1->SetInteger(prefs::kIncognitoModeAvailability, 134 prefs1->SetInteger(prefs::kIncognitoModeAvailability,
133 IncognitoModePrefs::FORCED); 135 IncognitoModePrefs::FORCED);
134 PrefService* prefs2 = browser->profile()->GetOriginalProfile()->GetPrefs(); 136 PrefService* prefs2 = browser->profile()->GetOriginalProfile()->GetPrefs();
135 prefs2->SetInteger(prefs::kIncognitoModeAvailability, 137 prefs2->SetInteger(prefs::kIncognitoModeAvailability,
136 IncognitoModePrefs::FORCED); 138 IncognitoModePrefs::FORCED);
137 139
138 // Navigate to the page. 140 // Navigate to the page.
139 browser::NavigateParams p(MakeNavigateParams(browser)); 141 browser::NavigateParams p(MakeNavigateParams(browser));
140 p.disposition = OFF_THE_RECORD; 142 p.disposition = OFF_THE_RECORD;
141 p.url = url; 143 p.url = url;
142 p.window_action = browser::NavigateParams::SHOW_WINDOW; 144 p.window_action = browser::NavigateParams::SHOW_WINDOW;
143 browser::Navigate(&p); 145 browser::Navigate(&p);
144 146
145 // The page should not be opened. 147 // The page should not be opened.
146 EXPECT_EQ(browser, p.browser); 148 EXPECT_EQ(browser, p.browser);
147 EXPECT_EQ(1, browser->tab_count()); 149 EXPECT_EQ(1, browser->tab_count());
148 EXPECT_EQ(GURL(chrome::kAboutBlankURL), 150 EXPECT_EQ(GURL(chrome::kAboutBlankURL),
149 browser->GetSelectedTabContents()->GetURL()); 151 browser->GetSelectedWebContents()->GetURL());
150 } 152 }
151 153
152 void BrowserNavigatorTest::Observe( 154 void BrowserNavigatorTest::Observe(
153 int type, 155 int type,
154 const content::NotificationSource& source, 156 const content::NotificationSource& source,
155 const content::NotificationDetails& details) { 157 const content::NotificationDetails& details) {
156 switch (type) { 158 switch (type) {
157 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { 159 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: {
158 ++this->created_tab_contents_count_; 160 ++this->created_tab_contents_count_;
159 break; 161 break;
160 } 162 }
161 default: 163 default:
162 break; 164 break;
163 } 165 }
164 } 166 }
165 167
166 168
167 namespace { 169 namespace {
168 170
169 // This test verifies that when a navigation occurs within a tab, the tab count 171 // This test verifies that when a navigation occurs within a tab, the tab count
170 // of the Browser remains the same and the current tab bears the loaded URL. 172 // of the Browser remains the same and the current tab bears the loaded URL.
171 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_CurrentTab) { 173 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_CurrentTab) {
172 ui_test_utils::NavigateToURL(browser(), GetGoogleURL()); 174 ui_test_utils::NavigateToURL(browser(), GetGoogleURL());
173 EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedTabContents()->GetURL()); 175 EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedWebContents()->GetURL());
174 // We should have one window with one tab. 176 // We should have one window with one tab.
175 EXPECT_EQ(1u, BrowserList::size()); 177 EXPECT_EQ(1u, BrowserList::size());
176 EXPECT_EQ(1, browser()->tab_count()); 178 EXPECT_EQ(1, browser()->tab_count());
177 } 179 }
178 180
179 // This test verifies that a singleton tab is refocused if one is already opened 181 // This test verifies that a singleton tab is refocused if one is already opened
180 // in another or an existing window, or added if it is not. 182 // in another or an existing window, or added if it is not.
181 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { 183 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) {
182 GURL singleton_url1("http://maps.google.com/"); 184 GURL singleton_url1("http://maps.google.com/");
183 185
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 // We should now have 2 tabs, the 2nd one selected. 286 // We should now have 2 tabs, the 2nd one selected.
285 EXPECT_EQ(browser(), p.browser); 287 EXPECT_EQ(browser(), p.browser);
286 EXPECT_EQ(2, browser()->tab_count()); 288 EXPECT_EQ(2, browser()->tab_count());
287 EXPECT_EQ(1, browser()->active_index()); 289 EXPECT_EQ(1, browser()->active_index());
288 } 290 }
289 291
290 // This test verifies that when a navigation results in a foreground tab, the 292 // This test verifies that when a navigation results in a foreground tab, the
291 // tab count of the Browser increases and the selected tab shifts to the new 293 // tab count of the Browser increases and the selected tab shifts to the new
292 // foreground tab. 294 // foreground tab.
293 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) { 295 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) {
294 TabContents* old_contents = browser()->GetSelectedTabContents(); 296 WebContents* old_contents = browser()->GetSelectedWebContents();
295 browser::NavigateParams p(MakeNavigateParams()); 297 browser::NavigateParams p(MakeNavigateParams());
296 p.disposition = NEW_FOREGROUND_TAB; 298 p.disposition = NEW_FOREGROUND_TAB;
297 browser::Navigate(&p); 299 browser::Navigate(&p);
298 EXPECT_NE(old_contents, browser()->GetSelectedTabContents()); 300 EXPECT_NE(old_contents, browser()->GetSelectedWebContents());
299 EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents); 301 EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents);
300 EXPECT_EQ(2, browser()->tab_count()); 302 EXPECT_EQ(2, browser()->tab_count());
301 } 303 }
302 304
303 // This test verifies that when a navigation results in a background tab, the 305 // This test verifies that when a navigation results in a background tab, the
304 // tab count of the Browser increases but the selected tab remains the same. 306 // tab count of the Browser increases but the selected tab remains the same.
305 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewBackgroundTab) { 307 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewBackgroundTab) {
306 TabContents* old_contents = browser()->GetSelectedTabContents(); 308 WebContents* old_contents = browser()->GetSelectedWebContents();
307 browser::NavigateParams p(MakeNavigateParams()); 309 browser::NavigateParams p(MakeNavigateParams());
308 p.disposition = NEW_BACKGROUND_TAB; 310 p.disposition = NEW_BACKGROUND_TAB;
309 browser::Navigate(&p); 311 browser::Navigate(&p);
310 TabContents* new_contents = browser()->GetSelectedTabContents(); 312 WebContents* new_contents = browser()->GetSelectedWebContents();
311 // The selected tab should have remained unchanged, since the new tab was 313 // The selected tab should have remained unchanged, since the new tab was
312 // opened in the background. 314 // opened in the background.
313 EXPECT_EQ(old_contents, new_contents); 315 EXPECT_EQ(old_contents, new_contents);
314 EXPECT_EQ(2, browser()->tab_count()); 316 EXPECT_EQ(2, browser()->tab_count());
315 } 317 }
316 318
317 // This test verifies that when a navigation requiring a new foreground tab 319 // This test verifies that when a navigation requiring a new foreground tab
318 // occurs in a Browser that cannot host multiple tabs, the new foreground tab 320 // occurs in a Browser that cannot host multiple tabs, the new foreground tab
319 // is created in an existing compatible Browser. 321 // is created in an existing compatible Browser.
320 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 322 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 693
692 // We should have one window - the browser() provided by the framework. 694 // We should have one window - the browser() provided by the framework.
693 EXPECT_EQ(1u, BrowserList::size()); 695 EXPECT_EQ(1u, BrowserList::size());
694 EXPECT_EQ(2, browser()->tab_count()); 696 EXPECT_EQ(2, browser()->tab_count());
695 } 697 }
696 698
697 // This test verifies that constructing params with a NULL browser has 699 // This test verifies that constructing params with a NULL browser has
698 // the same result as navigating to a new foreground tab in the (only) 700 // the same result as navigating to a new foreground tab in the (only)
699 // active browser. Tests are the same as for Disposition_NewForegroundTab. 701 // active browser. Tests are the same as for Disposition_NewForegroundTab.
700 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_NewForegroundTab) { 702 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_NewForegroundTab) {
701 TabContents* old_contents = browser()->GetSelectedTabContents(); 703 WebContents* old_contents = browser()->GetSelectedWebContents();
702 // Navigate with a NULL browser. 704 // Navigate with a NULL browser.
703 browser::NavigateParams p(MakeNavigateParams(NULL)); 705 browser::NavigateParams p(MakeNavigateParams(NULL));
704 p.disposition = NEW_FOREGROUND_TAB; 706 p.disposition = NEW_FOREGROUND_TAB;
705 p.profile = browser()->profile(); 707 p.profile = browser()->profile();
706 browser::Navigate(&p); 708 browser::Navigate(&p);
707 709
708 // Navigate() should have found browser() and create a new tab. 710 // Navigate() should have found browser() and create a new tab.
709 EXPECT_EQ(browser(), p.browser); 711 EXPECT_EQ(browser(), p.browser);
710 EXPECT_NE(old_contents, browser()->GetSelectedTabContents()); 712 EXPECT_NE(old_contents, browser()->GetSelectedWebContents());
711 EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents); 713 EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents);
712 EXPECT_EQ(2, browser()->tab_count()); 714 EXPECT_EQ(2, browser()->tab_count());
713 } 715 }
714 716
715 // This test verifies that constructing params with a NULL browser and 717 // This test verifies that constructing params with a NULL browser and
716 // a specific profile matches the specified profile. 718 // a specific profile matches the specified profile.
717 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_MatchProfile) { 719 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_MatchProfile) {
718 // Create a new browser with using the incognito profile. 720 // Create a new browser with using the incognito profile.
719 Browser* incognito = 721 Browser* incognito =
720 Browser::Create(browser()->profile()->GetOffTheRecordProfile()); 722 Browser::Create(browser()->profile()->GetOffTheRecordProfile());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 p.window_action = browser::NavigateParams::SHOW_WINDOW; 772 p.window_action = browser::NavigateParams::SHOW_WINDOW;
771 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; 773 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
772 browser::Navigate(&p); 774 browser::Navigate(&p);
773 775
774 // The last tab should now be selected and navigated to the sub-page of the 776 // The last tab should now be selected and navigated to the sub-page of the
775 // URL. 777 // URL.
776 EXPECT_EQ(browser(), p.browser); 778 EXPECT_EQ(browser(), p.browser);
777 EXPECT_EQ(3, browser()->tab_count()); 779 EXPECT_EQ(3, browser()->tab_count());
778 EXPECT_EQ(2, browser()->active_index()); 780 EXPECT_EQ(2, browser()->active_index());
779 EXPECT_EQ(GetSettingsAdvancedURL(), 781 EXPECT_EQ(GetSettingsAdvancedURL(),
780 browser()->GetSelectedTabContents()->GetURL()); 782 browser()->GetSelectedWebContents()->GetURL());
781 } 783 }
782 784
783 // This test verifies that constructing params with disposition = SINGLETON_TAB 785 // This test verifies that constructing params with disposition = SINGLETON_TAB
784 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus 786 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus
785 // the path) which is navigated to the specified URL. 787 // the path) which is navigated to the specified URL.
786 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 788 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
787 Disposition_SingletonTabExisting_IgnorePath) { 789 Disposition_SingletonTabExisting_IgnorePath) {
788 GURL singleton_url1(GetSettingsURL()); 790 GURL singleton_url1(GetSettingsURL());
789 browser()->AddSelectedTabWithURL( 791 browser()->AddSelectedTabWithURL(
790 singleton_url1, content::PAGE_TRANSITION_LINK); 792 singleton_url1, content::PAGE_TRANSITION_LINK);
(...skipping 12 matching lines...) Expand all
803 p.window_action = browser::NavigateParams::SHOW_WINDOW; 805 p.window_action = browser::NavigateParams::SHOW_WINDOW;
804 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; 806 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
805 browser::Navigate(&p); 807 browser::Navigate(&p);
806 808
807 // The middle tab should now be selected and navigated to the sub-page of the 809 // The middle tab should now be selected and navigated to the sub-page of the
808 // URL. 810 // URL.
809 EXPECT_EQ(browser(), p.browser); 811 EXPECT_EQ(browser(), p.browser);
810 EXPECT_EQ(3, browser()->tab_count()); 812 EXPECT_EQ(3, browser()->tab_count());
811 EXPECT_EQ(1, browser()->active_index()); 813 EXPECT_EQ(1, browser()->active_index());
812 EXPECT_EQ(GetSettingsAdvancedURL(), 814 EXPECT_EQ(GetSettingsAdvancedURL(),
813 browser()->GetSelectedTabContents()->GetURL()); 815 browser()->GetSelectedWebContents()->GetURL());
814 } 816 }
815 817
816 // This test verifies that constructing params with disposition = SINGLETON_TAB 818 // This test verifies that constructing params with disposition = SINGLETON_TAB
817 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus 819 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus
818 // the path) which is navigated to the specified URL. 820 // the path) which is navigated to the specified URL.
819 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 821 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
820 Disposition_SingletonTabExistingSubPath_IgnorePath) { 822 Disposition_SingletonTabExistingSubPath_IgnorePath) {
821 GURL singleton_url1(GetSettingsAdvancedURL()); 823 GURL singleton_url1(GetSettingsAdvancedURL());
822 browser()->AddSelectedTabWithURL( 824 browser()->AddSelectedTabWithURL(
823 singleton_url1, content::PAGE_TRANSITION_LINK); 825 singleton_url1, content::PAGE_TRANSITION_LINK);
(...skipping 12 matching lines...) Expand all
836 p.window_action = browser::NavigateParams::SHOW_WINDOW; 838 p.window_action = browser::NavigateParams::SHOW_WINDOW;
837 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; 839 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
838 browser::Navigate(&p); 840 browser::Navigate(&p);
839 841
840 // The middle tab should now be selected and navigated to the sub-page of the 842 // The middle tab should now be selected and navigated to the sub-page of the
841 // URL. 843 // URL.
842 EXPECT_EQ(browser(), p.browser); 844 EXPECT_EQ(browser(), p.browser);
843 EXPECT_EQ(3, browser()->tab_count()); 845 EXPECT_EQ(3, browser()->tab_count());
844 EXPECT_EQ(1, browser()->active_index()); 846 EXPECT_EQ(1, browser()->active_index());
845 EXPECT_EQ(GetSettingsPersonalURL(), 847 EXPECT_EQ(GetSettingsPersonalURL(),
846 browser()->GetSelectedTabContents()->GetURL()); 848 browser()->GetSelectedWebContents()->GetURL());
847 } 849 }
848 850
849 // This test verifies that constructing params with disposition = SINGLETON_TAB 851 // This test verifies that constructing params with disposition = SINGLETON_TAB
850 // and IGNORE_AND_STAY_PUT opens an existing tab with the matching URL (minus 852 // and IGNORE_AND_STAY_PUT opens an existing tab with the matching URL (minus
851 // the path). 853 // the path).
852 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 854 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
853 Disposition_SingletonTabExistingSubPath_IgnorePath2) { 855 Disposition_SingletonTabExistingSubPath_IgnorePath2) {
854 GURL singleton_url1(GetSettingsAdvancedURL()); 856 GURL singleton_url1(GetSettingsAdvancedURL());
855 browser()->AddSelectedTabWithURL( 857 browser()->AddSelectedTabWithURL(
856 singleton_url1, content::PAGE_TRANSITION_LINK); 858 singleton_url1, content::PAGE_TRANSITION_LINK);
(...skipping 11 matching lines...) Expand all
868 p.url = GetSettingsPersonalURL(); 870 p.url = GetSettingsPersonalURL();
869 p.window_action = browser::NavigateParams::SHOW_WINDOW; 871 p.window_action = browser::NavigateParams::SHOW_WINDOW;
870 p.path_behavior = browser::NavigateParams::IGNORE_AND_STAY_PUT; 872 p.path_behavior = browser::NavigateParams::IGNORE_AND_STAY_PUT;
871 browser::Navigate(&p); 873 browser::Navigate(&p);
872 874
873 // The middle tab should now be selected. 875 // The middle tab should now be selected.
874 EXPECT_EQ(browser(), p.browser); 876 EXPECT_EQ(browser(), p.browser);
875 EXPECT_EQ(3, browser()->tab_count()); 877 EXPECT_EQ(3, browser()->tab_count());
876 EXPECT_EQ(1, browser()->active_index()); 878 EXPECT_EQ(1, browser()->active_index());
877 EXPECT_EQ(singleton_url1, 879 EXPECT_EQ(singleton_url1,
878 browser()->GetSelectedTabContents()->GetURL()); 880 browser()->GetSelectedWebContents()->GetURL());
879 } 881 }
880 882
881 // This test verifies that constructing params with disposition = SINGLETON_TAB 883 // This test verifies that constructing params with disposition = SINGLETON_TAB
882 // and IGNORE_AND_NAVIGATE will update the current tab's URL if the currently 884 // and IGNORE_AND_NAVIGATE will update the current tab's URL if the currently
883 // selected tab is a match but has a different path. 885 // selected tab is a match but has a different path.
884 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 886 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
885 Disposition_SingletonTabFocused_IgnorePath) { 887 Disposition_SingletonTabFocused_IgnorePath) {
886 GURL singleton_url_current(GetSettingsAdvancedURL()); 888 GURL singleton_url_current(GetSettingsAdvancedURL());
887 browser()->AddSelectedTabWithURL( 889 browser()->AddSelectedTabWithURL(
888 singleton_url_current, content::PAGE_TRANSITION_LINK); 890 singleton_url_current, content::PAGE_TRANSITION_LINK);
(...skipping 10 matching lines...) Expand all
899 p.url = singleton_url_target; 901 p.url = singleton_url_target;
900 p.window_action = browser::NavigateParams::SHOW_WINDOW; 902 p.window_action = browser::NavigateParams::SHOW_WINDOW;
901 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; 903 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
902 browser::Navigate(&p); 904 browser::Navigate(&p);
903 905
904 // The second tab should still be selected, but navigated to the new path. 906 // The second tab should still be selected, but navigated to the new path.
905 EXPECT_EQ(browser(), p.browser); 907 EXPECT_EQ(browser(), p.browser);
906 EXPECT_EQ(2, browser()->tab_count()); 908 EXPECT_EQ(2, browser()->tab_count());
907 EXPECT_EQ(1, browser()->active_index()); 909 EXPECT_EQ(1, browser()->active_index());
908 EXPECT_EQ(singleton_url_target, 910 EXPECT_EQ(singleton_url_target,
909 browser()->GetSelectedTabContents()->GetURL()); 911 browser()->GetSelectedWebContents()->GetURL());
910 } 912 }
911 913
912 // This test verifies that constructing params with disposition = SINGLETON_TAB 914 // This test verifies that constructing params with disposition = SINGLETON_TAB
913 // and IGNORE_AND_NAVIGATE will open an existing matching tab with a different 915 // and IGNORE_AND_NAVIGATE will open an existing matching tab with a different
914 // query. 916 // query.
915 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 917 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
916 Disposition_SingletonTabExisting_IgnoreQuery) { 918 Disposition_SingletonTabExisting_IgnoreQuery) {
917 int initial_tab_count = browser()->tab_count(); 919 int initial_tab_count = browser()->tab_count();
918 GURL singleton_url_current("chrome://settings/internet"); 920 GURL singleton_url_current("chrome://settings/internet");
919 browser()->AddSelectedTabWithURL( 921 browser()->AddSelectedTabWithURL(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 { 958 {
957 ui_test_utils::WindowedNotificationObserver observer( 959 ui_test_utils::WindowedNotificationObserver observer(
958 content::NOTIFICATION_LOAD_STOP, 960 content::NOTIFICATION_LOAD_STOP,
959 content::NotificationService::AllSources()); 961 content::NotificationService::AllSources());
960 browser::Navigate(&params); 962 browser::Navigate(&params);
961 observer.Wait(); 963 observer.Wait();
962 } 964 }
963 965
964 EXPECT_EQ(1u, BrowserList::size()); 966 EXPECT_EQ(1u, BrowserList::size());
965 EXPECT_EQ(GURL("chrome://settings"), 967 EXPECT_EQ(GURL("chrome://settings"),
966 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); 968 browser()->GetSelectedWebContents()->GetURL().GetOrigin());
967 } 969 }
968 970
969 // Settings page is expected to always open in normal mode regardless 971 // Settings page is expected to always open in normal mode regardless
970 // of whether the user is trying to open it in incognito mode or not. 972 // of whether the user is trying to open it in incognito mode or not.
971 // This test verifies that if incognito mode is forced (by policy), settings 973 // This test verifies that if incognito mode is forced (by policy), settings
972 // page doesn't open at all. 974 // page doesn't open at all.
973 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 975 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
974 Disposition_Settings_DoNothingIfIncognitoIsForced) { 976 Disposition_Settings_DoNothingIfIncognitoIsForced) {
975 RunDoNothingIfIncognitoIsForcedTest(GetSettingsURL()); 977 RunDoNothingIfIncognitoIsForcedTest(GetSettingsURL());
976 } 978 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 NavigateFromDefaultToOptionsInSameTab) { 1041 NavigateFromDefaultToOptionsInSameTab) {
1040 { 1042 {
1041 ui_test_utils::WindowedNotificationObserver observer( 1043 ui_test_utils::WindowedNotificationObserver observer(
1042 content::NOTIFICATION_LOAD_STOP, 1044 content::NOTIFICATION_LOAD_STOP,
1043 content::NotificationService::AllSources()); 1045 content::NotificationService::AllSources());
1044 browser()->OpenOptionsDialog(); 1046 browser()->OpenOptionsDialog();
1045 observer.Wait(); 1047 observer.Wait();
1046 } 1048 }
1047 EXPECT_EQ(1, browser()->tab_count()); 1049 EXPECT_EQ(1, browser()->tab_count());
1048 EXPECT_EQ(GetSettingsURL(), 1050 EXPECT_EQ(GetSettingsURL(),
1049 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); 1051 browser()->GetSelectedWebContents()->GetURL().GetOrigin());
1050 } 1052 }
1051 1053
1052 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 1054 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1053 NavigateFromBlankToOptionsInSameTab) { 1055 NavigateFromBlankToOptionsInSameTab) {
1054 browser::NavigateParams p(MakeNavigateParams()); 1056 browser::NavigateParams p(MakeNavigateParams());
1055 p.url = GURL(chrome::kAboutBlankURL); 1057 p.url = GURL(chrome::kAboutBlankURL);
1056 ui_test_utils::NavigateToURL(&p); 1058 ui_test_utils::NavigateToURL(&p);
1057 1059
1058 { 1060 {
1059 ui_test_utils::WindowedNotificationObserver observer( 1061 ui_test_utils::WindowedNotificationObserver observer(
1060 content::NOTIFICATION_LOAD_STOP, 1062 content::NOTIFICATION_LOAD_STOP,
1061 content::NotificationService::AllSources()); 1063 content::NotificationService::AllSources());
1062 browser()->OpenOptionsDialog(); 1064 browser()->OpenOptionsDialog();
1063 observer.Wait(); 1065 observer.Wait();
1064 } 1066 }
1065 EXPECT_EQ(1, browser()->tab_count()); 1067 EXPECT_EQ(1, browser()->tab_count());
1066 EXPECT_EQ(GetSettingsURL(), 1068 EXPECT_EQ(GetSettingsURL(),
1067 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); 1069 browser()->GetSelectedWebContents()->GetURL().GetOrigin());
1068 } 1070 }
1069 1071
1070 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 1072 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1071 NavigateFromNTPToOptionsInSameTab) { 1073 NavigateFromNTPToOptionsInSameTab) {
1072 browser::NavigateParams p(MakeNavigateParams()); 1074 browser::NavigateParams p(MakeNavigateParams());
1073 p.url = GURL(chrome::kChromeUINewTabURL); 1075 p.url = GURL(chrome::kChromeUINewTabURL);
1074 ui_test_utils::NavigateToURL(&p); 1076 ui_test_utils::NavigateToURL(&p);
1075 EXPECT_EQ(1, browser()->tab_count()); 1077 EXPECT_EQ(1, browser()->tab_count());
1076 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 1078 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1077 browser()->GetSelectedTabContents()->GetURL()); 1079 browser()->GetSelectedWebContents()->GetURL());
1078 1080
1079 { 1081 {
1080 ui_test_utils::WindowedNotificationObserver observer( 1082 ui_test_utils::WindowedNotificationObserver observer(
1081 content::NOTIFICATION_LOAD_STOP, 1083 content::NOTIFICATION_LOAD_STOP,
1082 content::NotificationService::AllSources()); 1084 content::NotificationService::AllSources());
1083 browser()->OpenOptionsDialog(); 1085 browser()->OpenOptionsDialog();
1084 observer.Wait(); 1086 observer.Wait();
1085 } 1087 }
1086 EXPECT_EQ(1, browser()->tab_count()); 1088 EXPECT_EQ(1, browser()->tab_count());
1087 EXPECT_EQ(GetSettingsURL(), 1089 EXPECT_EQ(GetSettingsURL(),
1088 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); 1090 browser()->GetSelectedWebContents()->GetURL().GetOrigin());
1089 } 1091 }
1090 1092
1091 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 1093 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1092 NavigateFromPageToOptionsInNewTab) { 1094 NavigateFromPageToOptionsInNewTab) {
1093 browser::NavigateParams p(MakeNavigateParams()); 1095 browser::NavigateParams p(MakeNavigateParams());
1094 ui_test_utils::NavigateToURL(&p); 1096 ui_test_utils::NavigateToURL(&p);
1095 EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedTabContents()->GetURL()); 1097 EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedWebContents()->GetURL());
1096 EXPECT_EQ(1u, BrowserList::size()); 1098 EXPECT_EQ(1u, BrowserList::size());
1097 EXPECT_EQ(1, browser()->tab_count()); 1099 EXPECT_EQ(1, browser()->tab_count());
1098 1100
1099 { 1101 {
1100 ui_test_utils::WindowedNotificationObserver observer( 1102 ui_test_utils::WindowedNotificationObserver observer(
1101 content::NOTIFICATION_LOAD_STOP, 1103 content::NOTIFICATION_LOAD_STOP,
1102 content::NotificationService::AllSources()); 1104 content::NotificationService::AllSources());
1103 browser()->OpenOptionsDialog(); 1105 browser()->OpenOptionsDialog();
1104 observer.Wait(); 1106 observer.Wait();
1105 } 1107 }
1106 EXPECT_EQ(2, browser()->tab_count()); 1108 EXPECT_EQ(2, browser()->tab_count());
1107 EXPECT_EQ(GetSettingsURL(), 1109 EXPECT_EQ(GetSettingsURL(),
1108 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); 1110 browser()->GetSelectedWebContents()->GetURL().GetOrigin());
1109 } 1111 }
1110 1112
1111 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 1113 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1112 NavigateFromNTPToOptionsSingleton) { 1114 NavigateFromNTPToOptionsSingleton) {
1113 { 1115 {
1114 ui_test_utils::WindowedNotificationObserver observer( 1116 ui_test_utils::WindowedNotificationObserver observer(
1115 content::NOTIFICATION_LOAD_STOP, 1117 content::NOTIFICATION_LOAD_STOP,
1116 content::NotificationService::AllSources()); 1118 content::NotificationService::AllSources());
1117 browser()->OpenOptionsDialog(); 1119 browser()->OpenOptionsDialog();
1118 observer.Wait(); 1120 observer.Wait();
1119 } 1121 }
1120 EXPECT_EQ(1, browser()->tab_count()); 1122 EXPECT_EQ(1, browser()->tab_count());
1121 1123
1122 browser()->NewTab(); 1124 browser()->NewTab();
1123 EXPECT_EQ(2, browser()->tab_count()); 1125 EXPECT_EQ(2, browser()->tab_count());
1124 1126
1125 { 1127 {
1126 ui_test_utils::WindowedNotificationObserver observer( 1128 ui_test_utils::WindowedNotificationObserver observer(
1127 content::NOTIFICATION_LOAD_STOP, 1129 content::NOTIFICATION_LOAD_STOP,
1128 content::NotificationService::AllSources()); 1130 content::NotificationService::AllSources());
1129 browser()->OpenOptionsDialog(); 1131 browser()->OpenOptionsDialog();
1130 observer.Wait(); 1132 observer.Wait();
1131 } 1133 }
1132 EXPECT_EQ(2, browser()->tab_count()); 1134 EXPECT_EQ(2, browser()->tab_count());
1133 EXPECT_EQ(GetSettingsURL(), 1135 EXPECT_EQ(GetSettingsURL(),
1134 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); 1136 browser()->GetSelectedWebContents()->GetURL().GetOrigin());
1135 } 1137 }
1136 1138
1137 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 1139 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1138 NavigateFromNTPToOptionsPageInSameTab) { 1140 NavigateFromNTPToOptionsPageInSameTab) {
1139 { 1141 {
1140 ui_test_utils::WindowedNotificationObserver observer( 1142 ui_test_utils::WindowedNotificationObserver observer(
1141 content::NOTIFICATION_LOAD_STOP, 1143 content::NOTIFICATION_LOAD_STOP,
1142 content::NotificationService::AllSources()); 1144 content::NotificationService::AllSources());
1143 browser()->ShowOptionsTab(chrome::kPersonalOptionsSubPage); 1145 browser()->ShowOptionsTab(chrome::kPersonalOptionsSubPage);
1144 observer.Wait(); 1146 observer.Wait();
1145 } 1147 }
1146 EXPECT_EQ(1, browser()->tab_count()); 1148 EXPECT_EQ(1, browser()->tab_count());
1147 EXPECT_EQ(GetSettingsPersonalURL(), 1149 EXPECT_EQ(GetSettingsPersonalURL(),
1148 browser()->GetSelectedTabContents()->GetURL()); 1150 browser()->GetSelectedWebContents()->GetURL());
1149 1151
1150 browser()->NewTab(); 1152 browser()->NewTab();
1151 EXPECT_EQ(2, browser()->tab_count()); 1153 EXPECT_EQ(2, browser()->tab_count());
1152 1154
1153 { 1155 {
1154 ui_test_utils::WindowedNotificationObserver observer( 1156 ui_test_utils::WindowedNotificationObserver observer(
1155 content::NOTIFICATION_LOAD_STOP, 1157 content::NOTIFICATION_LOAD_STOP,
1156 content::NotificationService::AllSources()); 1158 content::NotificationService::AllSources());
1157 browser()->ShowOptionsTab(chrome::kPersonalOptionsSubPage); 1159 browser()->ShowOptionsTab(chrome::kPersonalOptionsSubPage);
1158 observer.Wait(); 1160 observer.Wait();
1159 } 1161 }
1160 EXPECT_EQ(2, browser()->tab_count()); 1162 EXPECT_EQ(2, browser()->tab_count());
1161 EXPECT_EQ(GetSettingsPersonalURL(), 1163 EXPECT_EQ(GetSettingsPersonalURL(),
1162 browser()->GetSelectedTabContents()->GetURL()); 1164 browser()->GetSelectedWebContents()->GetURL());
1163 } 1165 }
1164 1166
1165 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 1167 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1166 NavigateFromOtherTabToSingletonOptions) { 1168 NavigateFromOtherTabToSingletonOptions) {
1167 { 1169 {
1168 ui_test_utils::WindowedNotificationObserver observer( 1170 ui_test_utils::WindowedNotificationObserver observer(
1169 content::NOTIFICATION_LOAD_STOP, 1171 content::NOTIFICATION_LOAD_STOP,
1170 content::NotificationService::AllSources()); 1172 content::NotificationService::AllSources());
1171 browser()->OpenOptionsDialog(); 1173 browser()->OpenOptionsDialog();
1172 observer.Wait(); 1174 observer.Wait();
1173 } 1175 }
1174 { 1176 {
1175 ui_test_utils::WindowedNotificationObserver observer( 1177 ui_test_utils::WindowedNotificationObserver observer(
1176 content::NOTIFICATION_LOAD_STOP, 1178 content::NOTIFICATION_LOAD_STOP,
1177 content::NotificationService::AllSources()); 1179 content::NotificationService::AllSources());
1178 browser()->AddSelectedTabWithURL( 1180 browser()->AddSelectedTabWithURL(
1179 GetGoogleURL(), content::PAGE_TRANSITION_LINK); 1181 GetGoogleURL(), content::PAGE_TRANSITION_LINK);
1180 observer.Wait(); 1182 observer.Wait();
1181 } 1183 }
1182 1184
1183 { 1185 {
1184 ui_test_utils::WindowedNotificationObserver observer( 1186 ui_test_utils::WindowedNotificationObserver observer(
1185 content::NOTIFICATION_LOAD_STOP, 1187 content::NOTIFICATION_LOAD_STOP,
1186 content::NotificationService::AllSources()); 1188 content::NotificationService::AllSources());
1187 browser()->OpenOptionsDialog(); 1189 browser()->OpenOptionsDialog();
1188 observer.Wait(); 1190 observer.Wait();
1189 } 1191 }
1190 EXPECT_EQ(2, browser()->tab_count()); 1192 EXPECT_EQ(2, browser()->tab_count());
1191 EXPECT_EQ(GetSettingsURL(), 1193 EXPECT_EQ(GetSettingsURL(),
1192 browser()->GetSelectedTabContents()->GetURL().GetOrigin()); 1194 browser()->GetSelectedWebContents()->GetURL().GetOrigin());
1193 } 1195 }
1194 1196
1195 // Tests that when a new tab is opened from the omnibox, the focus is moved from 1197 // Tests that when a new tab is opened from the omnibox, the focus is moved from
1196 // the omnibox for the current tab. 1198 // the omnibox for the current tab.
1197 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 1199 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1198 NavigateFromOmniboxIntoNewTab) { 1200 NavigateFromOmniboxIntoNewTab) {
1199 GURL url("http://www.google.com/"); 1201 GURL url("http://www.google.com/");
1200 GURL url2("http://maps.google.com/"); 1202 GURL url2("http://maps.google.com/");
1201 1203
1202 // Navigate to url. 1204 // Navigate to url.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 NavigateFromDefaultToHistoryInSameTab) { 1236 NavigateFromDefaultToHistoryInSameTab) {
1235 { 1237 {
1236 ui_test_utils::WindowedNotificationObserver observer( 1238 ui_test_utils::WindowedNotificationObserver observer(
1237 content::NOTIFICATION_LOAD_STOP, 1239 content::NOTIFICATION_LOAD_STOP,
1238 content::NotificationService::AllSources()); 1240 content::NotificationService::AllSources());
1239 browser()->ShowHistoryTab(); 1241 browser()->ShowHistoryTab();
1240 observer.Wait(); 1242 observer.Wait();
1241 } 1243 }
1242 EXPECT_EQ(1, browser()->tab_count()); 1244 EXPECT_EQ(1, browser()->tab_count());
1243 EXPECT_EQ(GURL(chrome::kChromeUIHistoryURL), 1245 EXPECT_EQ(GURL(chrome::kChromeUIHistoryURL),
1244 browser()->GetSelectedTabContents()->GetURL()); 1246 browser()->GetSelectedWebContents()->GetURL());
1245 } 1247 }
1246 1248
1247 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 1249 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1248 NavigateFromDefaultToBookmarksInSameTab) { 1250 NavigateFromDefaultToBookmarksInSameTab) {
1249 { 1251 {
1250 ui_test_utils::WindowedNotificationObserver observer( 1252 ui_test_utils::WindowedNotificationObserver observer(
1251 content::NOTIFICATION_LOAD_STOP, 1253 content::NOTIFICATION_LOAD_STOP,
1252 content::NotificationService::AllSources()); 1254 content::NotificationService::AllSources());
1253 browser()->OpenBookmarkManager(); 1255 browser()->OpenBookmarkManager();
1254 observer.Wait(); 1256 observer.Wait();
1255 } 1257 }
1256 EXPECT_EQ(1, browser()->tab_count()); 1258 EXPECT_EQ(1, browser()->tab_count());
1257 EXPECT_EQ(GURL(chrome::kChromeUIBookmarksURL), 1259 EXPECT_EQ(GURL(chrome::kChromeUIBookmarksURL),
1258 browser()->GetSelectedTabContents()->GetURL()); 1260 browser()->GetSelectedWebContents()->GetURL());
1259 } 1261 }
1260 1262
1261 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, 1263 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
1262 NavigateFromDefaultToDownloadsInSameTab) { 1264 NavigateFromDefaultToDownloadsInSameTab) {
1263 { 1265 {
1264 ui_test_utils::WindowedNotificationObserver observer( 1266 ui_test_utils::WindowedNotificationObserver observer(
1265 content::NOTIFICATION_LOAD_STOP, 1267 content::NOTIFICATION_LOAD_STOP,
1266 content::NotificationService::AllSources()); 1268 content::NotificationService::AllSources());
1267 browser()->ShowDownloadsTab(); 1269 browser()->ShowDownloadsTab();
1268 observer.Wait(); 1270 observer.Wait();
1269 } 1271 }
1270 EXPECT_EQ(1, browser()->tab_count()); 1272 EXPECT_EQ(1, browser()->tab_count());
1271 EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL), 1273 EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL),
1272 browser()->GetSelectedTabContents()->GetURL()); 1274 browser()->GetSelectedWebContents()->GetURL());
1273 } 1275 }
1274 1276
1275 } // namespace 1277 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_init.cc ('k') | chrome/browser/ui/browser_navigator_browsertest_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698