| 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/managed/managed_bookmark_service.h" | 5 #include "components/bookmarks/managed/managed_bookmark_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // The managed node always exists. | 49 // The managed node always exists. |
| 50 ASSERT_TRUE(managed_->managed_node()); | 50 ASSERT_TRUE(managed_->managed_node()); |
| 51 ASSERT_TRUE(managed_->managed_node()->parent() == model_->root_node()); | 51 ASSERT_TRUE(managed_->managed_node()->parent() == model_->root_node()); |
| 52 EXPECT_NE(-1, model_->root_node()->GetIndexOf(managed_->managed_node())); | 52 EXPECT_NE(-1, model_->root_node()->GetIndexOf(managed_->managed_node())); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void TearDown() override { model_->RemoveObserver(&observer_); } | 55 void TearDown() override { model_->RemoveObserver(&observer_); } |
| 56 | 56 |
| 57 void ResetModel() { | 57 void ResetModel() { |
| 58 profile_.CreateBookmarkModel(false); | 58 profile_.CreateBookmarkModel(false); |
| 59 model_ = BookmarkModelFactory::GetForProfile(&profile_); | 59 model_ = BookmarkModelFactory::GetForBrowserContext(&profile_); |
| 60 bookmarks::test::WaitForBookmarkModelToLoad(model_); | 60 bookmarks::test::WaitForBookmarkModelToLoad(model_); |
| 61 model_->AddObserver(&observer_); | 61 model_->AddObserver(&observer_); |
| 62 managed_ = ManagedBookmarkServiceFactory::GetForProfile(&profile_); | 62 managed_ = ManagedBookmarkServiceFactory::GetForProfile(&profile_); |
| 63 DCHECK(managed_); | 63 DCHECK(managed_); |
| 64 } | 64 } |
| 65 | 65 |
| 66 static base::DictionaryValue* CreateBookmark(const std::string& title, | 66 static base::DictionaryValue* CreateBookmark(const std::string& title, |
| 67 const std::string& url) { | 67 const std::string& url) { |
| 68 EXPECT_TRUE(GURL(url).is_valid()); | 68 EXPECT_TRUE(GURL(url).is_valid()); |
| 69 base::DictionaryValue* dict = new base::DictionaryValue(); | 69 base::DictionaryValue* dict = new base::DictionaryValue(); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 const BookmarkNode* managed_node = managed_->managed_node()->GetChild(0); | 287 const BookmarkNode* managed_node = managed_->managed_node()->GetChild(0); |
| 288 ASSERT_TRUE(managed_node); | 288 ASSERT_TRUE(managed_node); |
| 289 | 289 |
| 290 std::vector<const BookmarkNode*> nodes; | 290 std::vector<const BookmarkNode*> nodes; |
| 291 EXPECT_FALSE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node())); | 291 EXPECT_FALSE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node())); |
| 292 nodes.push_back(user_node); | 292 nodes.push_back(user_node); |
| 293 EXPECT_FALSE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node())); | 293 EXPECT_FALSE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node())); |
| 294 nodes.push_back(managed_node); | 294 nodes.push_back(managed_node); |
| 295 EXPECT_TRUE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node())); | 295 EXPECT_TRUE(bookmarks::HasDescendantsOf(nodes, managed_->managed_node())); |
| 296 } | 296 } |
| OLD | NEW |