| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_expanded_state_tracker.h" | 5 #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/pref_service_factory.h" | 9 #include "base/prefs/pref_service_factory.h" |
| 10 #include "base/prefs/testing_pref_store.h" | 10 #include "base/prefs/testing_pref_store.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 public: | 35 public: |
| 36 BookmarkExpandedStateTrackerTest(); | 36 BookmarkExpandedStateTrackerTest(); |
| 37 ~BookmarkExpandedStateTrackerTest() override; | 37 ~BookmarkExpandedStateTrackerTest() override; |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 // testing::Test: | 40 // testing::Test: |
| 41 void SetUp() override; | 41 void SetUp() override; |
| 42 void TearDown() override; | 42 void TearDown() override; |
| 43 | 43 |
| 44 base::MessageLoop message_loop_; | 44 base::MessageLoop message_loop_; |
| 45 TestBookmarkClient client_; | |
| 46 scoped_ptr<PrefService> prefs_; | 45 scoped_ptr<PrefService> prefs_; |
| 47 scoped_ptr<BookmarkModel> model_; | 46 scoped_ptr<BookmarkModel> model_; |
| 48 | 47 |
| 49 DISALLOW_COPY_AND_ASSIGN(BookmarkExpandedStateTrackerTest); | 48 DISALLOW_COPY_AND_ASSIGN(BookmarkExpandedStateTrackerTest); |
| 50 }; | 49 }; |
| 51 | 50 |
| 52 BookmarkExpandedStateTrackerTest::BookmarkExpandedStateTrackerTest() {} | 51 BookmarkExpandedStateTrackerTest::BookmarkExpandedStateTrackerTest() { |
| 52 } |
| 53 | 53 |
| 54 BookmarkExpandedStateTrackerTest::~BookmarkExpandedStateTrackerTest() {} | 54 BookmarkExpandedStateTrackerTest::~BookmarkExpandedStateTrackerTest() { |
| 55 } |
| 55 | 56 |
| 56 void BookmarkExpandedStateTrackerTest::SetUp() { | 57 void BookmarkExpandedStateTrackerTest::SetUp() { |
| 57 prefs_ = PrefServiceForTesting(); | 58 prefs_ = PrefServiceForTesting(); |
| 58 model_.reset(new BookmarkModel(&client_)); | 59 model_ = TestBookmarkClient::CreateModel(BookmarkPermanentNodeList(), nullptr, |
| 60 true); |
| 59 model_->Load(prefs_.get(), std::string(), base::FilePath(), | 61 model_->Load(prefs_.get(), std::string(), base::FilePath(), |
| 60 base::ThreadTaskRunnerHandle::Get(), | 62 base::ThreadTaskRunnerHandle::Get(), |
| 61 base::ThreadTaskRunnerHandle::Get()); | 63 base::ThreadTaskRunnerHandle::Get()); |
| 62 test::WaitForBookmarkModelToLoad(model_.get()); | 64 test::WaitForBookmarkModelToLoad(model_.get()); |
| 63 } | 65 } |
| 64 | 66 |
| 65 void BookmarkExpandedStateTrackerTest::TearDown() { | 67 void BookmarkExpandedStateTrackerTest::TearDown() { |
| 66 model_.reset(); | 68 model_.reset(); |
| 67 } | 69 } |
| 68 | 70 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 tracker->SetExpandedNodes(nodes); | 105 tracker->SetExpandedNodes(nodes); |
| 104 // Verify that the node is present. | 106 // Verify that the node is present. |
| 105 EXPECT_EQ(nodes, tracker->GetExpandedNodes()); | 107 EXPECT_EQ(nodes, tracker->GetExpandedNodes()); |
| 106 // Call remove all. | 108 // Call remove all. |
| 107 model_->RemoveAllUserBookmarks(); | 109 model_->RemoveAllUserBookmarks(); |
| 108 // Verify node is not present. | 110 // Verify node is not present. |
| 109 EXPECT_TRUE(tracker->GetExpandedNodes().empty()); | 111 EXPECT_TRUE(tracker->GetExpandedNodes().empty()); |
| 110 } | 112 } |
| 111 | 113 |
| 112 } // namespace bookmarks | 114 } // namespace bookmarks |
| OLD | NEW |