diff options
Diffstat (limited to 'chrome/browser/ui/browser_navigator_browsertest.cc')
-rw-r--r-- | chrome/browser/ui/browser_navigator_browsertest.cc | 264 |
1 files changed, 142 insertions, 122 deletions
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index 4457ac7..97a1af2 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc @@ -93,7 +93,7 @@ Browser* BrowserNavigatorTest::CreateEmptyBrowserForApp(Browser::Type type, WebContents* BrowserNavigatorTest::CreateWebContents() { content::WebContents::CreateParams create_params(browser()->profile()); content::WebContents* base_web_contents = - chrome::GetActiveWebContents(browser()); + browser()->tab_strip_model()->GetActiveWebContents(); if (base_web_contents) { create_params.initial_size = base_web_contents->GetView()->GetContainerSize(); @@ -102,23 +102,24 @@ WebContents* BrowserNavigatorTest::CreateWebContents() { } void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) { - GURL old_url = chrome::GetActiveWebContents(browser())->GetURL(); + GURL old_url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); chrome::NavigateParams p(MakeNavigateParams()); p.disposition = disposition; chrome::Navigate(&p); // Nothing should have happened as a result of Navigate(); - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(old_url, chrome::GetActiveWebContents(browser())->GetURL()); + EXPECT_EQ(old_url, + browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); } void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) { Browser* incognito_browser = CreateIncognitoBrowser(); EXPECT_EQ(2u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(1, incognito_browser->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, incognito_browser->tab_strip_model()->count()); // Navigate to the page. chrome::NavigateParams p(MakeNavigateParams(incognito_browser)); @@ -130,8 +131,9 @@ void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) { // This page should be opened in browser() window. EXPECT_NE(incognito_browser, p.browser); EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(url, chrome::GetActiveWebContents(browser())->GetURL()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); + EXPECT_EQ(url, + browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); } void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest( @@ -155,9 +157,9 @@ void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest( // The page should not be opened. EXPECT_EQ(browser, p.browser); - EXPECT_EQ(1, browser->tab_count()); + EXPECT_EQ(1, browser->tab_strip_model()->count()); EXPECT_EQ(GURL(chrome::kAboutBlankURL), - chrome::GetActiveWebContents(browser)->GetURL()); + browser->tab_strip_model()->GetActiveWebContents()->GetURL()); } void BrowserNavigatorTest::Observe( @@ -181,10 +183,11 @@ namespace { // of the Browser remains the same and the current tab bears the loaded URL. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_CurrentTab) { ui_test_utils::NavigateToURL(browser(), GetGoogleURL()); - EXPECT_EQ(GetGoogleURL(), chrome::GetActiveWebContents(browser())->GetURL()); + EXPECT_EQ(GetGoogleURL(), + browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); // We should have one window with one tab. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); } // This test verifies that a singleton tab is refocused if one is already opened @@ -209,7 +212,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { // We should have one browser with 3 tabs, the 3rd selected. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(2, browser()->active_index()); + EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); unsigned int previous_tab_contents_count = created_tab_contents_count_ = 0; @@ -222,7 +225,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { // The middle tab should now be selected. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(1, browser()->active_index()); + EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); // No tab contents should have been created EXPECT_EQ(previous_tab_contents_count, @@ -240,8 +243,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should have one browser with 2 tabs, 2nd selected. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(1, browser()->active_index()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); // Navigate to singleton_url2. chrome::NavigateParams p(MakeNavigateParams()); @@ -251,8 +254,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should now have 2 tabs, the 2nd one selected. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(1, browser()->active_index()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); // Navigate to singleton_url2, but with respect ref set. p = MakeNavigateParams(); @@ -263,8 +266,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should now have 3 tabs, the 3th one selected. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(3, browser()->tab_count()); - EXPECT_EQ(2, browser()->active_index()); + EXPECT_EQ(3, browser()->tab_strip_model()->count()); + EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); // Navigate to singleton_url3. p = MakeNavigateParams(); @@ -275,8 +278,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should now have 4 tabs, the 4th one selected. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(4, browser()->tab_count()); - EXPECT_EQ(3, browser()->active_index()); + EXPECT_EQ(4, browser()->tab_strip_model()->count()); + EXPECT_EQ(3, browser()->tab_strip_model()->active_index()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -285,7 +288,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should have one browser with 1 tab. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(0, browser()->active_index()); + EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); // Navigate to singleton_url1. chrome::NavigateParams p(MakeNavigateParams()); @@ -295,36 +298,40 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should now have 2 tabs, the 2nd one selected. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(1, browser()->active_index()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); } // This test verifies that when a navigation results in a foreground tab, the // tab count of the Browser increases and the selected tab shifts to the new // foreground tab. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) { - WebContents* old_contents = chrome::GetActiveWebContents(browser()); + WebContents* old_contents = + browser()->tab_strip_model()->GetActiveWebContents(); chrome::NavigateParams p(MakeNavigateParams()); p.disposition = NEW_FOREGROUND_TAB; chrome::Navigate(&p); - EXPECT_NE(old_contents, chrome::GetActiveWebContents(browser())); + EXPECT_NE(old_contents, + browser()->tab_strip_model()->GetActiveWebContents()); EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(), p.target_contents); - EXPECT_EQ(2, browser()->tab_count()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); } // This test verifies that when a navigation results in a background tab, the // tab count of the Browser increases but the selected tab remains the same. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewBackgroundTab) { - WebContents* old_contents = chrome::GetActiveWebContents(browser()); + WebContents* old_contents = + browser()->tab_strip_model()->GetActiveWebContents(); chrome::NavigateParams p(MakeNavigateParams()); p.disposition = NEW_BACKGROUND_TAB; chrome::Navigate(&p); - WebContents* new_contents = chrome::GetActiveWebContents(browser()); + WebContents* new_contents = + browser()->tab_strip_model()->GetActiveWebContents(); // The selected tab should have remained unchanged, since the new tab was // opened in the background. EXPECT_EQ(old_contents, new_contents); - EXPECT_EQ(2, browser()->tab_count()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); } // This test verifies that when a navigation requiring a new foreground tab @@ -351,8 +358,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should be left with 2 windows, the popup with one tab and the browser() // provided by the framework with two. EXPECT_EQ(2u, BrowserList::size()); - EXPECT_EQ(1, popup->tab_count()); - EXPECT_EQ(2, browser()->tab_count()); + EXPECT_EQ(1, popup->tab_strip_model()->count()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); } // This test verifies that when a navigation requiring a new foreground tab @@ -386,9 +393,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // 2. the incognito popup we created originally // 3. the new incognito tabbed browser that was created by Navigate(). EXPECT_EQ(3u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(1, popup->tab_count()); - EXPECT_EQ(1, p.browser->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, popup->tab_strip_model()->count()); + EXPECT_EQ(1, p.browser->tab_strip_model()->count()); EXPECT_TRUE(p.browser->is_type_tabbed()); } @@ -413,8 +420,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup) { // We should have two windows, the browser() provided by the framework and the // new popup window. EXPECT_EQ(2u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(1, p.browser->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, p.browser->tab_strip_model()->count()); } // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP @@ -435,8 +442,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup_ExtensionId) { // We should have two windows, the browser() provided by the framework and the // new popup window. EXPECT_EQ(2u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(1, p.browser->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, p.browser->tab_strip_model()->count()); } // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP @@ -461,9 +468,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupFromPopup) { // We should have three windows, the browser() provided by the framework, // the first popup window, and the second popup window. EXPECT_EQ(3u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(1, p1.browser->tab_count()); - EXPECT_EQ(1, p2.browser->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, p1.browser->tab_strip_model()->count()); + EXPECT_EQ(1, p2.browser->tab_strip_model()->count()); } // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP @@ -486,9 +493,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should now have three windows, the app window, the app popup it created, // and the original browser() provided by the framework. EXPECT_EQ(3u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(1, app_browser->tab_count()); - EXPECT_EQ(1, p.browser->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, app_browser->tab_strip_model()->count()); + EXPECT_EQ(1, p.browser->tab_strip_model()->count()); } // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP @@ -517,10 +524,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should now have four windows, the app window, the first app popup, // the second app popup, and the original browser() provided by the framework. EXPECT_EQ(4u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(1, app_browser->tab_count()); - EXPECT_EQ(1, p1.browser->tab_count()); - EXPECT_EQ(1, p2.browser->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, app_browser->tab_strip_model()->count()); + EXPECT_EQ(1, p1.browser->tab_strip_model()->count()); + EXPECT_EQ(1, p2.browser->tab_strip_model()->count()); } // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP @@ -563,8 +570,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewWindow) { // We should now have two windows, the browser() provided by the framework and // the new normal window. EXPECT_EQ(2u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(1, p.browser->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, p.browser->tab_strip_model()->count()); } // This test verifies that navigating with WindowOpenDisposition = INCOGNITO @@ -586,8 +593,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_Incognito) { // We should now have two windows, the browser() provided by the framework and // the new incognito window. EXPECT_EQ(2u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(1, p.browser->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, p.browser->tab_strip_model()->count()); } // This test verifies that navigating with WindowOpenDisposition = INCOGNITO @@ -607,8 +614,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IncognitoRefocus) { // We should now have two windows, the browser() provided by the framework and // the incognito window we opened earlier. EXPECT_EQ(2u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(2, incognito_browser->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); + EXPECT_EQ(2, incognito_browser->tab_strip_model()->count()); } // This test verifies that no navigation action occurs when @@ -644,7 +651,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) { // We should have one window, with two tabs. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(2, browser()->tab_count()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); } #if defined(OS_WIN) @@ -681,8 +688,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_TargetContents_Popup) { // We should have two windows, the new popup and the browser() provided by the // framework. EXPECT_EQ(2u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(1, p.browser->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, p.browser->tab_strip_model()->count()); } #endif @@ -705,7 +712,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Tabstrip_InsertAtIndex) { // We should have one window - the browser() provided by the framework. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(2, browser()->tab_count()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -718,8 +725,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should have one browser with 2 tabs, the 2nd selected. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(1, browser()->active_index()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); // Navigate to a new singleton tab with a sub-page. chrome::NavigateParams p(MakeNavigateParams()); @@ -732,10 +739,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // The last tab should now be selected and navigated to the sub-page of the // URL. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(3, browser()->tab_count()); - EXPECT_EQ(2, browser()->active_index()); + EXPECT_EQ(3, browser()->tab_strip_model()->count()); + EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); EXPECT_EQ(GetContentSettingsURL(), - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -751,8 +759,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should have one browser with 3 tabs, the 3rd selected. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(3, browser()->tab_count()); - EXPECT_EQ(2, browser()->active_index()); + EXPECT_EQ(3, browser()->tab_strip_model()->count()); + EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); // Navigate to singleton_url1. chrome::NavigateParams p(MakeNavigateParams()); @@ -765,10 +773,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // The middle tab should now be selected and navigated to the sub-page of the // URL. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(3, browser()->tab_count()); - EXPECT_EQ(1, browser()->active_index()); + EXPECT_EQ(3, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); EXPECT_EQ(GetContentSettingsURL(), - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -784,8 +793,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should have one browser with 3 tabs, the 3rd selected. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(3, browser()->tab_count()); - EXPECT_EQ(2, browser()->active_index()); + EXPECT_EQ(3, browser()->tab_strip_model()->count()); + EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); // Navigate to singleton_url1. chrome::NavigateParams p(MakeNavigateParams()); @@ -798,10 +807,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // The middle tab should now be selected and navigated to the sub-page of the // URL. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(3, browser()->tab_count()); - EXPECT_EQ(1, browser()->active_index()); + EXPECT_EQ(3, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); EXPECT_EQ(GetClearBrowsingDataURL(), - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -817,8 +827,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should have one browser with 3 tabs, the 3rd selected. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(3, browser()->tab_count()); - EXPECT_EQ(2, browser()->active_index()); + EXPECT_EQ(3, browser()->tab_strip_model()->count()); + EXPECT_EQ(2, browser()->tab_strip_model()->active_index()); // Navigate to singleton_url1. chrome::NavigateParams p(MakeNavigateParams()); @@ -830,10 +840,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // The middle tab should now be selected. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(3, browser()->tab_count()); - EXPECT_EQ(1, browser()->active_index()); + EXPECT_EQ(3, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); EXPECT_EQ(singleton_url1, - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -847,8 +858,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should have one browser with 2 tabs, the 2nd selected. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(1, browser()->active_index()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); // Navigate to a different settings path. GURL singleton_url_target(GetClearBrowsingDataURL()); @@ -861,10 +872,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // The second tab should still be selected, but navigated to the new path. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(1, browser()->active_index()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); EXPECT_EQ(singleton_url_target, - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -872,13 +884,13 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // query. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting_IgnoreQuery) { - int initial_tab_count = browser()->tab_count(); + int initial_tab_count = browser()->tab_strip_model()->count(); GURL singleton_url_current("chrome://settings/internet"); chrome::AddSelectedTabWithURL(browser(), singleton_url_current, content::PAGE_TRANSITION_LINK); - EXPECT_EQ(initial_tab_count + 1, browser()->tab_count()); - EXPECT_EQ(initial_tab_count, browser()->active_index()); + EXPECT_EQ(initial_tab_count + 1, browser()->tab_strip_model()->count()); + EXPECT_EQ(initial_tab_count, browser()->tab_strip_model()->active_index()); // Navigate to a different settings path. GURL singleton_url_target( @@ -893,8 +905,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // Last tab should still be selected. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(initial_tab_count + 1, browser()->tab_count()); - EXPECT_EQ(initial_tab_count, browser()->active_index()); + EXPECT_EQ(initial_tab_count + 1, browser()->tab_strip_model()->count()); + EXPECT_EQ(initial_tab_count, browser()->tab_strip_model()->active_index()); } // This test verifies that the settings page isn't opened in the incognito @@ -923,7 +935,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(1u, BrowserList::size()); EXPECT_EQ(GetSettingsURL(), - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } // Settings page is expected to always open in normal mode regardless @@ -977,8 +990,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // We should have one browser with 2 tabs, the 2nd selected. EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(1, browser()->active_index()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); + EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); // Kill the singleton tab. web_contents->SetIsCrashed(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); @@ -1004,9 +1017,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowSettings(browser()); observer.Wait(); } - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); EXPECT_EQ(GetSettingsURL(), - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1022,9 +1036,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowSettings(browser()); observer.Wait(); } - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); EXPECT_EQ(GetSettingsURL(), - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1032,9 +1047,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::NavigateParams p(MakeNavigateParams()); p.url = GURL(chrome::kChromeUINewTabURL); ui_test_utils::NavigateToURL(&p); - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), - chrome::GetActiveWebContents(browser())->GetURL()); + browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); { content::WindowedNotificationObserver observer( @@ -1043,18 +1058,20 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowSettings(browser()); observer.Wait(); } - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); EXPECT_EQ(GetSettingsURL(), - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NavigateFromPageToOptionsInNewTab) { chrome::NavigateParams p(MakeNavigateParams()); ui_test_utils::NavigateToURL(&p); - EXPECT_EQ(GetGoogleURL(), chrome::GetActiveWebContents(browser())->GetURL()); + EXPECT_EQ(GetGoogleURL(), + browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); { content::WindowedNotificationObserver observer( @@ -1063,9 +1080,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowSettings(browser()); observer.Wait(); } - EXPECT_EQ(2, browser()->tab_count()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); EXPECT_EQ(GetSettingsURL(), - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1077,10 +1095,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowSettings(browser()); observer.Wait(); } - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); chrome::NewTab(browser()); - EXPECT_EQ(2, browser()->tab_count()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); { content::WindowedNotificationObserver observer( @@ -1089,9 +1107,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowSettings(browser()); observer.Wait(); } - EXPECT_EQ(2, browser()->tab_count()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); EXPECT_EQ(GetSettingsURL(), - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1103,12 +1122,12 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowClearBrowsingDataDialog(browser()); observer.Wait(); } - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); EXPECT_EQ(GetClearBrowsingDataURL(), - chrome::GetActiveWebContents(browser())->GetURL()); + browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); chrome::NewTab(browser()); - EXPECT_EQ(2, browser()->tab_count()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); { content::WindowedNotificationObserver observer( @@ -1117,9 +1136,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowClearBrowsingDataDialog(browser()); observer.Wait(); } - EXPECT_EQ(2, browser()->tab_count()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); EXPECT_EQ(GetClearBrowsingDataURL(), - chrome::GetActiveWebContents(browser())->GetURL()); + browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); } // Times out on mac, fails on linux. @@ -1154,9 +1173,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowSettings(browser()); observer.Wait(); } - EXPECT_EQ(2, browser()->tab_count()); + EXPECT_EQ(2, browser()->tab_strip_model()->count()); EXPECT_EQ(GetSettingsURL(), - ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); + ShortenUberURL(browser()->tab_strip_model()-> + GetActiveWebContents()->GetURL())); } // TODO(csilv): Update this for uber page. http://crbug.com/111579. @@ -1169,9 +1189,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowHistory(browser()); observer.Wait(); } - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); EXPECT_EQ(GURL(chrome::kChromeUIHistoryFrameURL), - chrome::GetActiveWebContents(browser())->GetURL()); + browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1183,9 +1203,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowBookmarkManager(browser()); observer.Wait(); } - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); EXPECT_EQ(GURL(chrome::kChromeUIBookmarksURL), - chrome::GetActiveWebContents(browser())->GetURL()); + browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1197,9 +1217,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::ShowDownloads(browser()); observer.Wait(); } - EXPECT_EQ(1, browser()->tab_count()); + EXPECT_EQ(1, browser()->tab_strip_model()->count()); EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL), - chrome::GetActiveWebContents(browser())->GetURL()); + browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |