diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-29 22:22:03 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-29 22:22:03 +0000 |
commit | 52877dbc6c22a02dc7d1dd6f22de2c2b3e7eac17 (patch) | |
tree | f39b0d32959778625fdeb00f178061a6411213c3 /chrome/browser/browser_commands_unittest.cc | |
parent | 78ce87fbedda14f033aaaf474b94c4966e8bf3d0 (diff) | |
download | chromium_src-52877dbc6c22a02dc7d1dd6f22de2c2b3e7eac17.zip chromium_src-52877dbc6c22a02dc7d1dd6f22de2c2b3e7eac17.tar.gz chromium_src-52877dbc6c22a02dc7d1dd6f22de2c2b3e7eac17.tar.bz2 |
Move tab functions off Browser into browser_tabstrip and browser_tabrestore.
http://crbug.com/133576
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10702029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145015 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_commands_unittest.cc')
-rw-r--r-- | chrome/browser/browser_commands_unittest.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc index 1f9544d..c0385db 100644 --- a/chrome/browser/browser_commands_unittest.cc +++ b/chrome/browser/browser_commands_unittest.cc @@ -7,6 +7,7 @@ #include "chrome/browser/ui/browser_command_controller.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/testing_profile.h" @@ -36,7 +37,7 @@ TEST_F(BrowserCommandsTest, TabNavigationAccelerators) { AddTab(browser(), about_blank); // Select the second tab. - browser()->ActivateTabAt(1, false); + chrome::ActivateTabAt(browser(), 1, false); CommandUpdater* updater = browser()->command_controller()->command_updater(); @@ -82,7 +83,7 @@ TEST_F(BrowserCommandsTest, DuplicateTab) { // Verify the stack of urls. content::NavigationController& controller = - browser()->GetWebContentsAt(1)->GetController(); + chrome::GetWebContentsAt(browser(), 1)->GetController(); ASSERT_EQ(3, controller.GetEntryCount()); ASSERT_EQ(2, controller.GetCurrentEntryIndex()); ASSERT_TRUE(url1 == controller.GetEntryAtIndex(0)->GetURL()); @@ -123,19 +124,19 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) { ASSERT_EQ(2, browser()->tab_count()); // The original tab should be unchanged. - WebContents* zeroth = browser()->GetWebContentsAt(0); + WebContents* zeroth = chrome::GetWebContentsAt(browser(), 0); EXPECT_EQ(url2, zeroth->GetURL()); EXPECT_TRUE(zeroth->GetController().CanGoBack()); EXPECT_FALSE(zeroth->GetController().CanGoForward()); // The new tab should be like the first one but navigated back. - WebContents* first = browser()->GetWebContentsAt(1); - EXPECT_EQ(url1, browser()->GetWebContentsAt(1)->GetURL()); + WebContents* first = chrome::GetWebContentsAt(browser(), 1); + EXPECT_EQ(url1, chrome::GetWebContentsAt(browser(), 1)->GetURL()); EXPECT_FALSE(first->GetController().CanGoBack()); EXPECT_TRUE(first->GetController().CanGoForward()); // Select the second tab and make it go forward in a new background tab. - browser()->ActivateTabAt(1, true); + chrome::ActivateTabAt(browser(), 1, true); // TODO(brettw) bug 11055: It should not be necessary to commit the load here, // but because of this bug, it will assert later if we don't. When the bug is // fixed, one of the three commits here related to this bug should be removed @@ -152,25 +153,25 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) { // There should be a new tab navigated forward. ASSERT_EQ(3, browser()->tab_count()); - WebContents* second = browser()->GetWebContentsAt(2); + WebContents* second = chrome::GetWebContentsAt(browser(), 2); EXPECT_EQ(url2, second->GetURL()); EXPECT_TRUE(second->GetController().CanGoBack()); EXPECT_FALSE(second->GetController().CanGoForward()); // Now do back in a new foreground tab. Don't bother re-checking every sngle // thing above, just validate that it's opening properly. - browser()->ActivateTabAt(2, true); + chrome::ActivateTabAt(browser(), 2, true); // TODO(brettw) bug 11055: see the comment above about why we need this. CommitPendingLoad(&second->GetController()); chrome::GoBack(browser(), NEW_FOREGROUND_TAB); ASSERT_EQ(3, browser()->active_index()); - ASSERT_EQ(url1, browser()->GetActiveWebContents()->GetURL()); + ASSERT_EQ(url1, chrome::GetActiveWebContents(browser())->GetURL()); // Same thing again for forward. // TODO(brettw) bug 11055: see the comment above about why we need this. - CommitPendingLoad(&browser()->GetActiveWebContents()->GetController()); + CommitPendingLoad(&chrome::GetActiveWebContents(browser())->GetController()); chrome::GoForward(browser(), NEW_FOREGROUND_TAB); ASSERT_EQ(4, browser()->active_index()); - ASSERT_EQ(url2, browser()->GetActiveWebContents()->GetURL()); + ASSERT_EQ(url2, chrome::GetActiveWebContents(browser())->GetURL()); } |