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

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

Issue 2216713002: Use BookmarkModelFactory::GetForBrowserContext everywhere (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bookmarks
Patch Set: Eliminate Profile::FromBrowserContext in some places Created 4 years, 4 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
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698