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

Unified Diff: chrome/browser/browser_commands_unittest.cc

Issue 18540: Don't expose the go and star button views directly through the BrowserWindow ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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
« no previous file with comments | « chrome/browser/browser.cc ('k') | chrome/browser/browser_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_commands_unittest.cc
===================================================================
--- chrome/browser/browser_commands_unittest.cc (revision 8515)
+++ chrome/browser/browser_commands_unittest.cc (working copy)
@@ -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 @@
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));
+}
« no previous file with comments | « chrome/browser/browser.cc ('k') | chrome/browser/browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698