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

Unified Diff: chrome/browser/views/bookmark_bar_view_unittest.cc

Issue 2822010: Fixes bug in bookmark bar view if profile changed. If the profile (Closed)
Patch Set: Created 10 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
« no previous file with comments | « chrome/browser/views/bookmark_bar_view.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/bookmark_bar_view_unittest.cc
diff --git a/chrome/browser/views/bookmark_bar_view_unittest.cc b/chrome/browser/views/bookmark_bar_view_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..61249b66c2f756d5ce350865820a379faa2fa4e4
--- /dev/null
+++ b/chrome/browser/views/bookmark_bar_view_unittest.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/bookmarks/bookmark_model.h"
+#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/views/bookmark_bar_view.h"
+#include "chrome/test/browser_with_test_window_test.h"
+#include "chrome/test/testing_profile.h"
+
+class BookmarkBarViewTest : public BrowserWithTestWindowTest {
+ public:
+ BookmarkBarViewTest()
+ : ui_thread_(ChromeThread::UI, message_loop()),
+ file_thread_(ChromeThread::FILE, message_loop()) {}
+
+ private:
+ ChromeThread ui_thread_;
+ ChromeThread file_thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewTest);
+};
+
+TEST_F(BookmarkBarViewTest, SwitchProfile) {
+ profile()->CreateBookmarkModel(true);
+ profile()->BlockUntilBookmarkModelLoaded();
+
+ profile()->GetBookmarkModel()->AddURL(
+ profile()->GetBookmarkModel()->GetBookmarkBarNode(),
+ 0,
+ L"blah",
+ GURL("http://www.google.com"));
+
+ BookmarkBarView bookmark_bar(profile(), browser());
+
+ EXPECT_EQ(1, bookmark_bar.GetBookmarkButtonCount());
+
+ TestingProfile profile2(0);
+ profile2.CreateBookmarkModel(true);
+ profile2.BlockUntilBookmarkModelLoaded();
+
+ bookmark_bar.SetProfile(&profile2);
+
+ EXPECT_EQ(0, bookmark_bar.GetBookmarkButtonCount());
+
+ bookmark_bar.SetProfile(profile());
+ EXPECT_EQ(1, bookmark_bar.GetBookmarkButtonCount());
+}
« no previous file with comments | « chrome/browser/views/bookmark_bar_view.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698