OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h" | 5 #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 void RecentlyUsedFoldersComboModelTest::SetUp() { | 39 void RecentlyUsedFoldersComboModelTest::SetUp() { |
40 profile_.reset(new TestingProfile()); | 40 profile_.reset(new TestingProfile()); |
41 profile_->CreateBookmarkModel(true); | 41 profile_->CreateBookmarkModel(true); |
42 profile_->BlockUntilBookmarkModelLoaded(); | 42 profile_->BlockUntilBookmarkModelLoaded(); |
43 } | 43 } |
44 | 44 |
45 void RecentlyUsedFoldersComboModelTest::TearDown() { | 45 void RecentlyUsedFoldersComboModelTest::TearDown() { |
46 // Flush the message loop to make application verifiers happy. | 46 // Flush the message loop to make application verifiers happy. |
47 message_loop_.RunAllPending(); | 47 message_loop_.RunUntilIdle(); |
48 } | 48 } |
49 | 49 |
50 // Verifies there are no duplicate nodes in the model. | 50 // Verifies there are no duplicate nodes in the model. |
51 TEST_F(RecentlyUsedFoldersComboModelTest, NoDups) { | 51 TEST_F(RecentlyUsedFoldersComboModelTest, NoDups) { |
52 BookmarkModel* bookmark_model = | 52 BookmarkModel* bookmark_model = |
53 BookmarkModelFactory::GetForProfile(profile_.get()); | 53 BookmarkModelFactory::GetForProfile(profile_.get()); |
54 const BookmarkNode* new_node = bookmark_model->AddURL( | 54 const BookmarkNode* new_node = bookmark_model->AddURL( |
55 bookmark_model->bookmark_bar_node(), 0, ASCIIToUTF16("a"), | 55 bookmark_model->bookmark_bar_node(), 0, ASCIIToUTF16("a"), |
56 GURL("http://a")); | 56 GURL("http://a")); |
57 RecentlyUsedFoldersComboModel model(bookmark_model, new_node); | 57 RecentlyUsedFoldersComboModel model(bookmark_model, new_node); |
58 std::set<const BookmarkNode*> nodes; | 58 std::set<const BookmarkNode*> nodes; |
59 for (int i = 0; i < model.GetItemCount(); ++i) { | 59 for (int i = 0; i < model.GetItemCount(); ++i) { |
60 const BookmarkNode* node = model.GetNodeAt(i); | 60 const BookmarkNode* node = model.GetNodeAt(i); |
61 EXPECT_EQ(0u, nodes.count(node)); | 61 EXPECT_EQ(0u, nodes.count(node)); |
62 nodes.insert(node); | 62 nodes.insert(node); |
63 } | 63 } |
64 } | 64 } |
OLD | NEW |