diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 22:57:40 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 22:57:40 +0000 |
commit | 5d9829491fa187db0fbbecb7f1e139d8367dcc16 (patch) | |
tree | 641f14f9285abae645efbb67da4cb378736f4e22 /chrome/browser/browser_commands_unittest.cc | |
parent | b61a5d8a9a3eb306079743e73f592a6ac6c8c8b3 (diff) | |
download | chromium_src-5d9829491fa187db0fbbecb7f1e139d8367dcc16.zip chromium_src-5d9829491fa187db0fbbecb7f1e139d8367dcc16.tar.gz chromium_src-5d9829491fa187db0fbbecb7f1e139d8367dcc16.tar.bz2 |
Moves command handling from Browser to a new object, BrowserCommandController.
Notes:
. BrowserCommandController now owns the CommandUpdater.
. CommandHandler's ExecuteCommand API was massaged a little so that ExecuteCommand/IsCommandEnabled/SupportsCommand methods are always called on it, rather than the wrapping controller.
. The creation of BCC was performed as a svn cp so that history for the various Exec methods could be easily carried forward.
. Various "CanFoo" methods were extracted from the UpdateFooState() methods and moved to CanFoo(const Browser* browser) in browser_commands.
http://crbug.com/133576
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10677009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_commands_unittest.cc')
-rw-r--r-- | chrome/browser/browser_commands_unittest.cc | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc index ca12761..1f9544d 100644 --- a/chrome/browser/browser_commands_unittest.cc +++ b/chrome/browser/browser_commands_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/bookmarks/bookmark_model.h" +#include "chrome/browser/ui/browser_command_controller.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/common/url_constants.h" @@ -37,20 +38,22 @@ TEST_F(BrowserCommandsTest, TabNavigationAccelerators) { // Select the second tab. browser()->ActivateTabAt(1, false); + CommandUpdater* updater = browser()->command_controller()->command_updater(); + // Navigate to the first tab using an accelerator. - browser()->ExecuteCommand(IDC_SELECT_TAB_0); + updater->ExecuteCommand(IDC_SELECT_TAB_0); ASSERT_EQ(0, browser()->active_index()); // Navigate to the second tab using the next accelerators. - browser()->ExecuteCommand(IDC_SELECT_NEXT_TAB); + updater->ExecuteCommand(IDC_SELECT_NEXT_TAB); ASSERT_EQ(1, browser()->active_index()); // Navigate back to the first tab using the previous accelerators. - browser()->ExecuteCommand(IDC_SELECT_PREVIOUS_TAB); + updater->ExecuteCommand(IDC_SELECT_PREVIOUS_TAB); ASSERT_EQ(0, browser()->active_index()); // Navigate to the last tab using the select last accelerator. - browser()->ExecuteCommand(IDC_SELECT_LAST_TAB); + updater->ExecuteCommand(IDC_SELECT_LAST_TAB); ASSERT_EQ(2, browser()->active_index()); } @@ -68,7 +71,7 @@ TEST_F(BrowserCommandsTest, DuplicateTab) { size_t initial_window_count = BrowserList::size(); // Duplicate the tab. - browser()->ExecuteCommand(IDC_DUPLICATE_TAB); + chrome::ExecuteCommand(browser(), IDC_DUPLICATE_TAB); // The duplicated tab should not end up in a new window. size_t window_count = BrowserList::size(); @@ -98,13 +101,7 @@ TEST_F(BrowserCommandsTest, BookmarkCurrentPage) { browser()->OpenURL(OpenURLParams( url1, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); - // TODO(beng): remove this once we can use TabContentses directly in testing - // instead of the TestTabContents which causes this command not to - // be enabled when the tab is added (and selected). - browser()->command_updater()->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, true); - - // Star it. - browser()->ExecuteCommand(IDC_BOOKMARK_PAGE); + chrome::BookmarkCurrentPage(browser()); // It should now be bookmarked in the bookmark model. EXPECT_EQ(profile(), browser()->profile()); |