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/ui/bookmarks/recently_used_folders_combo_model.h" | 5 #include "chrome/browser/ui/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.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
12 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
13 #include "content/public/test/test_browser_thread.h" | 13 #include "content/public/test/test_browser_thread.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 using content::BrowserThread; | 16 using content::BrowserThread; |
17 | 17 |
18 class RecentlyUsedFoldersComboModelTest : public testing::Test { | 18 class RecentlyUsedFoldersComboModelTest : public testing::Test { |
19 public: | 19 public: |
20 RecentlyUsedFoldersComboModelTest(); | 20 RecentlyUsedFoldersComboModelTest(); |
21 | 21 |
22 virtual void SetUp() OVERRIDE; | 22 virtual void SetUp() OVERRIDE; |
23 virtual void TearDown() OVERRIDE; | 23 virtual void TearDown() OVERRIDE; |
24 | 24 |
25 protected: | 25 protected: |
26 BookmarkModel* GetModel(); | 26 BookmarkModel* GetModel(); |
27 | 27 |
28 private: | 28 private: |
29 MessageLoopForUI message_loop_; | 29 base::MessageLoopForUI message_loop_; |
30 content::TestBrowserThread ui_thread_; | 30 content::TestBrowserThread ui_thread_; |
31 content::TestBrowserThread file_thread_; | 31 content::TestBrowserThread file_thread_; |
32 scoped_ptr<TestingProfile> profile_; | 32 scoped_ptr<TestingProfile> profile_; |
33 | 33 |
34 DISALLOW_COPY_AND_ASSIGN(RecentlyUsedFoldersComboModelTest); | 34 DISALLOW_COPY_AND_ASSIGN(RecentlyUsedFoldersComboModelTest); |
35 }; | 35 }; |
36 | 36 |
37 RecentlyUsedFoldersComboModelTest::RecentlyUsedFoldersComboModelTest() | 37 RecentlyUsedFoldersComboModelTest::RecentlyUsedFoldersComboModelTest() |
38 : ui_thread_(BrowserThread::UI, &message_loop_), | 38 : ui_thread_(BrowserThread::UI, &message_loop_), |
39 file_thread_(BrowserThread::FILE, &message_loop_) { | 39 file_thread_(BrowserThread::FILE, &message_loop_) { |
(...skipping 19 matching lines...) Expand all Loading... |
59 const BookmarkNode* new_node = GetModel()->AddURL( | 59 const BookmarkNode* new_node = GetModel()->AddURL( |
60 GetModel()->bookmark_bar_node(), 0, ASCIIToUTF16("a"), | 60 GetModel()->bookmark_bar_node(), 0, ASCIIToUTF16("a"), |
61 GURL("http://a")); | 61 GURL("http://a")); |
62 RecentlyUsedFoldersComboModel model(GetModel(), new_node); | 62 RecentlyUsedFoldersComboModel model(GetModel(), new_node); |
63 std::set<string16> items; | 63 std::set<string16> items; |
64 for (int i = 0; i < model.GetItemCount(); ++i) { | 64 for (int i = 0; i < model.GetItemCount(); ++i) { |
65 if (!model.IsItemSeparatorAt(i)) | 65 if (!model.IsItemSeparatorAt(i)) |
66 EXPECT_EQ(0u, items.count(model.GetItemAt(i))); | 66 EXPECT_EQ(0u, items.count(model.GetItemAt(i))); |
67 } | 67 } |
68 } | 68 } |
OLD | NEW |