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

Side by Side Diff: chrome/browser/bookmarks/recently_used_folders_combo_model_unittest.cc

Issue 14581004: bookmarks: Move recently_used_folders_combo_model* into c/b/ui/bookmarks/ directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
11 #include "chrome/test/base/testing_profile.h"
12 #include "chrome/test/base/ui_test_utils.h"
13 #include "content/public/test/test_browser_thread.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 using content::BrowserThread;
17
18 class RecentlyUsedFoldersComboModelTest : public testing::Test {
19 public:
20 RecentlyUsedFoldersComboModelTest();
21
22 virtual void SetUp() OVERRIDE;
23 virtual void TearDown() OVERRIDE;
24
25 protected:
26 BookmarkModel* GetModel();
27
28 private:
29 MessageLoopForUI message_loop_;
30 content::TestBrowserThread ui_thread_;
31 content::TestBrowserThread file_thread_;
32 scoped_ptr<TestingProfile> profile_;
33
34 DISALLOW_COPY_AND_ASSIGN(RecentlyUsedFoldersComboModelTest);
35 };
36
37 RecentlyUsedFoldersComboModelTest::RecentlyUsedFoldersComboModelTest()
38 : ui_thread_(BrowserThread::UI, &message_loop_),
39 file_thread_(BrowserThread::FILE, &message_loop_) {
40 }
41
42 void RecentlyUsedFoldersComboModelTest::SetUp() {
43 profile_.reset(new TestingProfile());
44 profile_->CreateBookmarkModel(true);
45 ui_test_utils::WaitForBookmarkModelToLoad(GetModel());
46 }
47
48 void RecentlyUsedFoldersComboModelTest::TearDown() {
49 // Flush the message loop to make application verifiers happy.
50 message_loop_.RunUntilIdle();
51 }
52
53 BookmarkModel* RecentlyUsedFoldersComboModelTest::GetModel() {
54 return BookmarkModelFactory::GetForProfile(profile_.get());
55 }
56
57 // Verifies there are no duplicate nodes in the model.
58 TEST_F(RecentlyUsedFoldersComboModelTest, NoDups) {
59 const BookmarkNode* new_node = GetModel()->AddURL(
60 GetModel()->bookmark_bar_node(), 0, ASCIIToUTF16("a"),
61 GURL("http://a"));
62 RecentlyUsedFoldersComboModel model(GetModel(), new_node);
63 std::set<string16> items;
64 for (int i = 0; i < model.GetItemCount(); ++i) {
65 if (!model.IsItemSeparatorAt(i))
66 EXPECT_EQ(0u, items.count(model.GetItemAt(i)));
67 }
68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698