summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_commands_unittest.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-23 20:37:29 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-23 20:37:29 +0000
commitb7ca4e69c194f4392fd0d7749221152bee6c6a4f (patch)
treeea87a258f659cde6c748b54e39ce0fc66c70c3fd /chrome/browser/browser_commands_unittest.cc
parenta3e4dd79aa7550b6a43ec1fb87e1026ec524f7d5 (diff)
downloadchromium_src-b7ca4e69c194f4392fd0d7749221152bee6c6a4f.zip
chromium_src-b7ca4e69c194f4392fd0d7749221152bee6c6a4f.tar.gz
chromium_src-b7ca4e69c194f4392fd0d7749221152bee6c6a4f.tar.bz2
Don't expose the go and star button views directly through the BrowserWindow interface (for porting).
Review URL: http://codereview.chromium.org/18540 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_commands_unittest.cc')
-rw-r--r--chrome/browser/browser_commands_unittest.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc
index 6029577..3b90289 100644
--- a/chrome/browser/browser_commands_unittest.cc
+++ b/chrome/browser/browser_commands_unittest.cc
@@ -3,11 +3,13 @@
// found in the LICENSE file.
#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/test/browser_with_test_window_test.h"
+#include "chrome/test/testing_profile.h"
typedef BrowserWithTestWindowTest BrowserCommandsTest;
@@ -72,3 +74,26 @@ TEST_F(BrowserCommandsTest, DuplicateTab) {
ASSERT_TRUE(url2 == controller->GetEntryAtIndex(1)->url());
ASSERT_TRUE(url3 == controller->GetEntryAtIndex(2)->url());
}
+
+TEST_F(BrowserCommandsTest, BookmarkCurrentPage) {
+ // We use profile() here, since it's a TestingProfile.
+ profile()->CreateBookmarkModel(true);
+ profile()->BlockUntilBookmarkModelLoaded();
+
+ // Navigate to a url.
+ GURL url1 = test_url_with_path("1");
+ AddTestingTab(browser());
+ browser()->OpenURL(url1, GURL(), CURRENT_TAB, PageTransition::TYPED);
+
+ // TODO(beng): remove this once we can use WebContentses 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_STAR, true);
+
+ // Star it.
+ browser()->ExecuteCommand(IDC_STAR);
+
+ // It should now be bookmarked in the bookmark model.
+ EXPECT_EQ(profile(), browser()->profile());
+ EXPECT_TRUE(browser()->profile()->GetBookmarkModel()->IsBookmarked(url1));
+}