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

Unified Diff: chrome/browser/tab_restore_browsertest.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tab_restore_browsertest.cc
===================================================================
--- chrome/browser/tab_restore_browsertest.cc (revision 145001)
+++ chrome/browser/tab_restore_browsertest.cc (working copy)
@@ -11,6 +11,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/find_bar/find_notification_details.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/chrome_notification_types.h"
@@ -63,11 +64,11 @@
}
void CloseTab(int index) {
- content::WebContents* new_tab = browser()->GetWebContentsAt(index);
+ content::WebContents* new_tab = chrome::GetWebContentsAt(browser(), index);
ui_test_utils::WindowedNotificationObserver tab_close_observer(
content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
content::NotificationService::AllSources());
- browser()->CloseTabContents(new_tab);
+ chrome::CloseWebContents(browser(), new_tab);
tab_close_observer.Wait();
}
@@ -161,7 +162,7 @@
// And make sure everything looks right.
EXPECT_EQ(starting_tab_count + 1, browser()->tab_count());
EXPECT_EQ(closed_tab_index, browser()->active_index());
- EXPECT_EQ(url1_, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser())->GetURL());
}
// Close a tab not at the end of the current window, then restore it. The tab
@@ -180,7 +181,7 @@
// And make sure everything looks right.
EXPECT_EQ(starting_tab_count + 3, browser()->tab_count());
EXPECT_EQ(closed_tab_index, browser()->active_index());
- EXPECT_EQ(url1_, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser())->GetURL());
}
// Close a tab, switch windows, then restore the tab. The tab should be in its
@@ -206,7 +207,7 @@
// And make sure everything looks right.
EXPECT_EQ(starting_tab_count + 3, browser()->tab_count());
EXPECT_EQ(closed_tab_index, browser()->active_index());
- EXPECT_EQ(url1_, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser())->GetURL());
}
// Close a tab, open a new window, close the first window, then restore the
@@ -234,7 +235,7 @@
// Tab should be in a new window.
Browser* browser = GetBrowser(1);
- content::WebContents* web_contents = browser->GetActiveWebContents();
+ content::WebContents* web_contents = chrome::GetActiveWebContents(browser);
// And make sure the URLs matches.
EXPECT_EQ(url2_, web_contents->GetURL());
GoBack(browser);
@@ -294,7 +295,7 @@
// Restore the closed tab.
ASSERT_NO_FATAL_FAILURE(RestoreTab(1, closed_tab_index));
EXPECT_EQ(starting_tab_count + 3, browser->tab_count());
- EXPECT_EQ(url1_, browser->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser)->GetURL());
}
// Open a window with two tabs, close both (closing the window), then restore
@@ -330,12 +331,12 @@
ASSERT_NO_FATAL_FAILURE(RestoreTab(1, 0));
Browser* browser = GetBrowser(1);
EXPECT_EQ(1, browser->tab_count());
- EXPECT_EQ(url2_, browser->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(url2_, chrome::GetActiveWebContents(browser)->GetURL());
// Restore the next-to-last-closed tab into the same window.
ASSERT_NO_FATAL_FAILURE(RestoreTab(1, 0));
EXPECT_EQ(2, browser->tab_count());
- EXPECT_EQ(url1_, browser->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser)->GetURL());
}
// Tests that a duplicate history entry is not created when we restore a page
@@ -354,7 +355,8 @@
EXPECT_EQ(++tab_count, browser()->tab_count());
// Navigate to another same-site URL.
- content::WebContents* tab = browser()->GetWebContentsAt(tab_count - 1);
+ content::WebContents* tab =
+ chrome::GetWebContentsAt(browser(), tab_count - 1);
ui_test_utils::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
@@ -378,9 +380,9 @@
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, tab_count - 1));
// And make sure the URLs match.
- EXPECT_EQ(http_url2, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(http_url2, chrome::GetActiveWebContents(browser())->GetURL());
GoBack(browser());
- EXPECT_EQ(http_url1, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(http_url1, chrome::GetActiveWebContents(browser())->GetURL());
}
// Tests that the SiteInstances used for entries in a restored tab's history
@@ -426,9 +428,9 @@
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, tab_count - 1));
// And make sure the URLs match.
- EXPECT_EQ(url1_, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser())->GetURL());
GoBack(browser());
- EXPECT_EQ(http_url1, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(http_url1, chrome::GetActiveWebContents(browser())->GetURL());
// Navigating to a new URL should clear the forward list, because the max
// page ID of the renderer should have been updated when we restored the tab.
@@ -436,7 +438,7 @@
browser(), http_url2, CURRENT_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
EXPECT_FALSE(chrome::CanGoForward(browser()));
- EXPECT_EQ(http_url2, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(http_url2, chrome::GetActiveWebContents(browser())->GetURL());
}
IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindow) {
@@ -480,11 +482,11 @@
load_stop_observer.Wait();
content::WebContents* restored_tab =
- browser->GetWebContentsAt(initial_tab_count);
+ chrome::GetWebContentsAt(browser, initial_tab_count);
EnsureTabFinishedRestoring(restored_tab);
EXPECT_EQ(url1_, restored_tab->GetURL());
- restored_tab = browser->GetWebContentsAt(initial_tab_count + 1);
+ restored_tab = chrome::GetWebContentsAt(browser, initial_tab_count + 1);
EnsureTabFinishedRestoring(restored_tab);
EXPECT_EQ(url2_, restored_tab->GetURL());
}
@@ -502,7 +504,7 @@
// Restore the closed tab.
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 1));
- TabContents* tab = browser()->GetTabContentsAt(1);
+ TabContents* tab = chrome::GetTabContentsAt(browser(), 1);
EnsureTabFinishedRestoring(tab->web_contents());
// See if content is as expected.
@@ -531,7 +533,7 @@
// Restore the closed tab.
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 1));
- TabContents* tab = browser()->GetTabContentsAt(1);
+ TabContents* tab = chrome::GetTabContentsAt(browser(), 1);
EnsureTabFinishedRestoring(tab->web_contents());
ASSERT_EQ(http_url, tab->web_contents()->GetURL());
« no previous file with comments | « chrome/browser/tab_contents/view_source_browsertest.cc ('k') | chrome/browser/task_manager/task_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698