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_bookmarks_tracker.h" | 5 #include "components/bookmarks/managed/managed_bookmarks_tracker.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 | 233 |
234 TEST_F(ManagedBookmarksTrackerTest, SwapNodes) { | 234 TEST_F(ManagedBookmarksTrackerTest, SwapNodes) { |
235 prefs_.SetManagedPref(prefs::kManagedBookmarks, CreateTestTree()); | 235 prefs_.SetManagedPref(prefs::kManagedBookmarks, CreateTestTree()); |
236 CreateModel(false /* is_supervised */); | 236 CreateModel(false /* is_supervised */); |
237 | 237 |
238 // Swap the Google bookmark with the Folder. | 238 // Swap the Google bookmark with the Folder. |
239 std::unique_ptr<base::ListValue> updated(CreateTestTree()); | 239 std::unique_ptr<base::ListValue> updated(CreateTestTree()); |
240 std::unique_ptr<base::Value> removed; | 240 std::unique_ptr<base::Value> removed; |
241 ASSERT_TRUE(updated->Remove(0, &removed)); | 241 ASSERT_TRUE(updated->Remove(0, &removed)); |
242 updated->Append(removed.release()); | 242 updated->Append(std::move(removed)); |
243 | 243 |
244 // These two nodes should just be swapped. | 244 // These two nodes should just be swapped. |
245 const BookmarkNode* parent = managed_node(); | 245 const BookmarkNode* parent = managed_node(); |
246 EXPECT_CALL(observer_, BookmarkNodeMoved(model_.get(), parent, 1, parent, 0)); | 246 EXPECT_CALL(observer_, BookmarkNodeMoved(model_.get(), parent, 1, parent, 0)); |
247 prefs_.SetManagedPref(prefs::kManagedBookmarks, updated->DeepCopy()); | 247 prefs_.SetManagedPref(prefs::kManagedBookmarks, updated->DeepCopy()); |
248 Mock::VerifyAndClearExpectations(&observer_); | 248 Mock::VerifyAndClearExpectations(&observer_); |
249 | 249 |
250 // Verify the final tree. | 250 // Verify the final tree. |
251 std::unique_ptr<base::DictionaryValue> expected( | 251 std::unique_ptr<base::DictionaryValue> expected( |
252 CreateFolder(GetManagedFolderTitle(), updated.release())); | 252 CreateFolder(GetManagedFolderTitle(), updated.release())); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 Mock::VerifyAndClearExpectations(&observer_); | 351 Mock::VerifyAndClearExpectations(&observer_); |
352 | 352 |
353 EXPECT_CALL(observer_, BookmarkAllUserNodesRemoved(model_.get(), _)); | 353 EXPECT_CALL(observer_, BookmarkAllUserNodesRemoved(model_.get(), _)); |
354 model_->RemoveAllUserBookmarks(); | 354 model_->RemoveAllUserBookmarks(); |
355 EXPECT_EQ(2, managed_node()->child_count()); | 355 EXPECT_EQ(2, managed_node()->child_count()); |
356 EXPECT_EQ(0, model_->bookmark_bar_node()->child_count()); | 356 EXPECT_EQ(0, model_->bookmark_bar_node()->child_count()); |
357 Mock::VerifyAndClearExpectations(&observer_); | 357 Mock::VerifyAndClearExpectations(&observer_); |
358 } | 358 } |
359 | 359 |
360 } // namespace bookmarks | 360 } // namespace bookmarks |
OLD | NEW |