| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "chrome/test/testing_browser_process_test.h" | 10 #include "chrome/test/testing_browser_process_test.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 file_thread_(BrowserThread::FILE, &message_loop_) { | 34 file_thread_(BrowserThread::FILE, &message_loop_) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 void RecentlyUsedFoldersComboModelTest::SetUp() { | 37 void RecentlyUsedFoldersComboModelTest::SetUp() { |
| 38 profile_.reset(new TestingProfile()); | 38 profile_.reset(new TestingProfile()); |
| 39 profile_->CreateBookmarkModel(true); | 39 profile_->CreateBookmarkModel(true); |
| 40 profile_->BlockUntilBookmarkModelLoaded(); | 40 profile_->BlockUntilBookmarkModelLoaded(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void RecentlyUsedFoldersComboModelTest::TearDown() { | 43 void RecentlyUsedFoldersComboModelTest::TearDown() { |
| 44 // Flush the message loop to make Purify happy. | 44 // Flush the message loop to make application verifiers happy. |
| 45 message_loop_.RunAllPending(); | 45 message_loop_.RunAllPending(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Verifies there are no duplicate nodes in the model. | 48 // Verifies there are no duplicate nodes in the model. |
| 49 TEST_F(RecentlyUsedFoldersComboModelTest, NoDups) { | 49 TEST_F(RecentlyUsedFoldersComboModelTest, NoDups) { |
| 50 BookmarkModel* bookmark_model = profile_->GetBookmarkModel(); | 50 BookmarkModel* bookmark_model = profile_->GetBookmarkModel(); |
| 51 const BookmarkNode* new_node = bookmark_model->AddURL( | 51 const BookmarkNode* new_node = bookmark_model->AddURL( |
| 52 bookmark_model->bookmark_bar_node(), 0, ASCIIToUTF16("a"), | 52 bookmark_model->bookmark_bar_node(), 0, ASCIIToUTF16("a"), |
| 53 GURL("http://a")); | 53 GURL("http://a")); |
| 54 RecentlyUsedFoldersComboModel model(bookmark_model, new_node); | 54 RecentlyUsedFoldersComboModel model(bookmark_model, new_node); |
| 55 std::set<const BookmarkNode*> nodes; | 55 std::set<const BookmarkNode*> nodes; |
| 56 for (int i = 0; i < model.GetItemCount(); ++i) { | 56 for (int i = 0; i < model.GetItemCount(); ++i) { |
| 57 const BookmarkNode* node = model.GetNodeAt(i); | 57 const BookmarkNode* node = model.GetNodeAt(i); |
| 58 EXPECT_EQ(0u, nodes.count(node)); | 58 EXPECT_EQ(0u, nodes.count(node)); |
| 59 nodes.insert(node); | 59 nodes.insert(node); |
| 60 } | 60 } |
| 61 } | 61 } |
| OLD | NEW |