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

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

Issue 20521005: BookmarkModel::ReorderChildren to take const BookmarkNodes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reinterpret_cast Created 7 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
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bookmarks/bookmark_model.h" 5 #include "chrome/browser/bookmarks/bookmark_model.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 TEST_F(BookmarkModelTest, Reorder) { 1004 TEST_F(BookmarkModelTest, Reorder) {
1005 // Populate the bookmark bar node with nodes 'A', 'B', 'C' and 'D'. 1005 // Populate the bookmark bar node with nodes 'A', 'B', 'C' and 'D'.
1006 TestNode bbn; 1006 TestNode bbn;
1007 PopulateNodeFromString("A B C D", &bbn); 1007 PopulateNodeFromString("A B C D", &bbn);
1008 BookmarkNode* parent = AsMutable(model_.bookmark_bar_node()); 1008 BookmarkNode* parent = AsMutable(model_.bookmark_bar_node());
1009 PopulateBookmarkNode(&bbn, &model_, parent); 1009 PopulateBookmarkNode(&bbn, &model_, parent);
1010 1010
1011 ClearCounts(); 1011 ClearCounts();
1012 1012
1013 // Reorder bar node's bookmarks in reverse order. 1013 // Reorder bar node's bookmarks in reverse order.
1014 std::vector<BookmarkNode*> new_order; 1014 std::vector<const BookmarkNode*> new_order;
1015 new_order.push_back(parent->GetChild(3)); 1015 new_order.push_back(parent->GetChild(3));
1016 new_order.push_back(parent->GetChild(2)); 1016 new_order.push_back(parent->GetChild(2));
1017 new_order.push_back(parent->GetChild(1)); 1017 new_order.push_back(parent->GetChild(1));
1018 new_order.push_back(parent->GetChild(0)); 1018 new_order.push_back(parent->GetChild(0));
1019 model_.ReorderChildren(parent, new_order); 1019 model_.ReorderChildren(parent, new_order);
1020 1020
1021 // Make sure we were notified. 1021 // Make sure we were notified.
1022 AssertObserverCount(0, 0, 0, 0, 1, 0, 0, 1, 0); 1022 AssertObserverCount(0, 0, 0, 0, 1, 0, 0, 1, 0);
1023 1023
1024 // Make sure the order matches is correct (it should be reversed). 1024 // Make sure the order matches is correct (it should be reversed).
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 EXPECT_TRUE(node.DeleteMetaInfo("key2.subkey2.leaf")); 1117 EXPECT_TRUE(node.DeleteMetaInfo("key2.subkey2.leaf"));
1118 EXPECT_FALSE(node.DeleteMetaInfo("key3")); 1118 EXPECT_FALSE(node.DeleteMetaInfo("key3"));
1119 EXPECT_FALSE(node.GetMetaInfo("key1", &out_value)); 1119 EXPECT_FALSE(node.GetMetaInfo("key1", &out_value));
1120 EXPECT_FALSE(node.GetMetaInfo("key2.subkey1", &out_value)); 1120 EXPECT_FALSE(node.GetMetaInfo("key2.subkey1", &out_value));
1121 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2", &out_value)); 1121 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2", &out_value));
1122 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2.leaf", &out_value)); 1122 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2.leaf", &out_value));
1123 EXPECT_TRUE(node.meta_info_str().empty()); 1123 EXPECT_TRUE(node.meta_info_str().empty());
1124 } 1124 }
1125 1125
1126 } // namespace 1126 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698