OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 6 #include "chrome/browser/chrome_thread.h" |
| 7 #include "chrome/browser/views/bookmark_bar_view.h" |
| 8 #include "chrome/test/browser_with_test_window_test.h" |
| 9 #include "chrome/test/testing_profile.h" |
| 10 |
| 11 class BookmarkBarViewTest : public BrowserWithTestWindowTest { |
| 12 public: |
| 13 BookmarkBarViewTest() |
| 14 : ui_thread_(ChromeThread::UI, message_loop()), |
| 15 file_thread_(ChromeThread::FILE, message_loop()) {} |
| 16 |
| 17 private: |
| 18 ChromeThread ui_thread_; |
| 19 ChromeThread file_thread_; |
| 20 |
| 21 DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewTest); |
| 22 }; |
| 23 |
| 24 TEST_F(BookmarkBarViewTest, SwitchProfile) { |
| 25 profile()->CreateBookmarkModel(true); |
| 26 profile()->BlockUntilBookmarkModelLoaded(); |
| 27 |
| 28 profile()->GetBookmarkModel()->AddURL( |
| 29 profile()->GetBookmarkModel()->GetBookmarkBarNode(), |
| 30 0, |
| 31 L"blah", |
| 32 GURL("http://www.google.com")); |
| 33 |
| 34 BookmarkBarView bookmark_bar(profile(), browser()); |
| 35 |
| 36 EXPECT_EQ(1, bookmark_bar.GetBookmarkButtonCount()); |
| 37 |
| 38 TestingProfile profile2(0); |
| 39 profile2.CreateBookmarkModel(true); |
| 40 profile2.BlockUntilBookmarkModelLoaded(); |
| 41 |
| 42 bookmark_bar.SetProfile(&profile2); |
| 43 |
| 44 EXPECT_EQ(0, bookmark_bar.GetBookmarkButtonCount()); |
| 45 |
| 46 bookmark_bar.SetProfile(profile()); |
| 47 EXPECT_EQ(1, bookmark_bar.GetBookmarkButtonCount()); |
| 48 } |
OLD | NEW |