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

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

Issue 485483003: Revert of Omnibox: Make URLs of Bookmarks Searchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/browser/bookmark_model.h" 5 #include "components/bookmarks/browser/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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 EXPECT_EQ(index2_, index2); 131 EXPECT_EQ(index2_, index2);
132 } 132 }
133 133
134 private: 134 private:
135 const BookmarkNode* node1_; 135 const BookmarkNode* node1_;
136 const BookmarkNode* node2_; 136 const BookmarkNode* node2_;
137 int index1_; 137 int index1_;
138 int index2_; 138 int index2_;
139 }; 139 };
140 140
141 BookmarkModelTest() : model_(client_.CreateModel()) { 141 BookmarkModelTest() : model_(client_.CreateModel(false)) {
142 model_->AddObserver(this); 142 model_->AddObserver(this);
143 ClearCounts(); 143 ClearCounts();
144 } 144 }
145 145
146 virtual void BookmarkModelLoaded(BookmarkModel* model, 146 virtual void BookmarkModelLoaded(BookmarkModel* model,
147 bool ids_reassigned) OVERRIDE { 147 bool ids_reassigned) OVERRIDE {
148 // We never load from the db, so that this should never get invoked. 148 // We never load from the db, so that this should never get invoked.
149 NOTREACHED(); 149 NOTREACHED();
150 } 150 }
151 151
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 int AllNodesRemovedObserverCount() const { return all_bookmarks_removed_; } 276 int AllNodesRemovedObserverCount() const { return all_bookmarks_removed_; }
277 277
278 BookmarkPermanentNode* ReloadModelWithExtraNode() { 278 BookmarkPermanentNode* ReloadModelWithExtraNode() {
279 BookmarkPermanentNode* extra_node = new BookmarkPermanentNode(100); 279 BookmarkPermanentNode* extra_node = new BookmarkPermanentNode(100);
280 bookmarks::BookmarkPermanentNodeList extra_nodes; 280 bookmarks::BookmarkPermanentNodeList extra_nodes;
281 extra_nodes.push_back(extra_node); 281 extra_nodes.push_back(extra_node);
282 client_.SetExtraNodesToLoad(extra_nodes.Pass()); 282 client_.SetExtraNodesToLoad(extra_nodes.Pass());
283 283
284 model_->RemoveObserver(this); 284 model_->RemoveObserver(this);
285 model_ = client_.CreateModel(); 285 model_ = client_.CreateModel(false);
286 model_->AddObserver(this); 286 model_->AddObserver(this);
287 ClearCounts(); 287 ClearCounts();
288 288
289 if (model_->root_node()->GetIndexOf(extra_node) == -1) 289 if (model_->root_node()->GetIndexOf(extra_node) == -1)
290 ADD_FAILURE(); 290 ADD_FAILURE();
291 291
292 return extra_node; 292 return extra_node;
293 } 293 }
294 294
295 protected: 295 protected:
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 } data[] = { 971 } data[] = {
972 // See PopulateNodeFromString for a description of these strings. 972 // See PopulateNodeFromString for a description of these strings.
973 { "", "" }, 973 { "", "" },
974 { "a", "b" }, 974 { "a", "b" },
975 { "a [ b ]", "" }, 975 { "a [ b ]", "" },
976 { "", "[ b ] a [ c [ d e [ f ] ] ]" }, 976 { "", "[ b ] a [ c [ d e [ f ] ] ]" },
977 { "a [ b ]", "" }, 977 { "a [ b ]", "" },
978 { "a b c [ d e [ f ] ]", "g h i [ j k [ l ] ]"}, 978 { "a b c [ d e [ f ] ]", "g h i [ j k [ l ] ]"},
979 }; 979 };
980 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { 980 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
981 model_ = client_.CreateModel(); 981 model_ = client_.CreateModel(false);
982 982
983 TestNode bbn; 983 TestNode bbn;
984 PopulateNodeFromString(data[i].bbn_contents, &bbn); 984 PopulateNodeFromString(data[i].bbn_contents, &bbn);
985 PopulateBookmarkNode(&bbn, model_.get(), model_->bookmark_bar_node()); 985 PopulateBookmarkNode(&bbn, model_.get(), model_->bookmark_bar_node());
986 986
987 TestNode other; 987 TestNode other;
988 PopulateNodeFromString(data[i].other_contents, &other); 988 PopulateNodeFromString(data[i].other_contents, &other);
989 PopulateBookmarkNode(&other, model_.get(), model_->other_node()); 989 PopulateBookmarkNode(&other, model_.get(), model_->other_node());
990 990
991 TestNode mobile; 991 TestNode mobile;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 EXPECT_TRUE(node.DeleteMetaInfo("key2.subkey2.leaf")); 1203 EXPECT_TRUE(node.DeleteMetaInfo("key2.subkey2.leaf"));
1204 EXPECT_FALSE(node.DeleteMetaInfo("key3")); 1204 EXPECT_FALSE(node.DeleteMetaInfo("key3"));
1205 EXPECT_FALSE(node.GetMetaInfo("key1", &out_value)); 1205 EXPECT_FALSE(node.GetMetaInfo("key1", &out_value));
1206 EXPECT_FALSE(node.GetMetaInfo("key2.subkey1", &out_value)); 1206 EXPECT_FALSE(node.GetMetaInfo("key2.subkey1", &out_value));
1207 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2", &out_value)); 1207 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2", &out_value));
1208 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2.leaf", &out_value)); 1208 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2.leaf", &out_value));
1209 EXPECT_FALSE(node.GetMetaInfoMap()); 1209 EXPECT_FALSE(node.GetMetaInfoMap());
1210 } 1210 }
1211 1211
1212 } // namespace 1212 } // namespace
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_model.cc ('k') | components/bookmarks/browser/bookmark_node_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698