| 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/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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // a 1 c | 153 // a 1 c |
| 154 // | | 154 // | |
| 155 // b | 155 // b |
| 156 // In words: a node of type URL with the title a, followed by a folder node with | 156 // In words: a node of type URL with the title a, followed by a folder node with |
| 157 // the title 1 having the single child of type url with name b, followed by | 157 // the title 1 having the single child of type url with name b, followed by |
| 158 // the url node with the title c. | 158 // the url node with the title c. |
| 159 // | 159 // |
| 160 // NOTE: each name must be unique, and folders are assigned a unique title by | 160 // NOTE: each name must be unique, and folders are assigned a unique title by |
| 161 // way of an increasing integer. | 161 // way of an increasing integer. |
| 162 void PopulateNodeFromString(const std::string& description, TestNode* parent) { | 162 void PopulateNodeFromString(const std::string& description, TestNode* parent) { |
| 163 std::vector<std::string> elements; | 163 std::vector<std::string> elements = base::SplitString( |
| 164 base::SplitStringAlongWhitespace(description, &elements); | 164 description, base::kWhitespaceASCII, |
| 165 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 165 size_t index = 0; | 166 size_t index = 0; |
| 166 PopulateNodeImpl(elements, &index, parent); | 167 PopulateNodeImpl(elements, &index, parent); |
| 167 } | 168 } |
| 168 | 169 |
| 169 // Populates the BookmarkNode with the children of parent. | 170 // Populates the BookmarkNode with the children of parent. |
| 170 void PopulateBookmarkNode(TestNode* parent, | 171 void PopulateBookmarkNode(TestNode* parent, |
| 171 BookmarkModel* model, | 172 BookmarkModel* model, |
| 172 const BookmarkNode* bb_node) { | 173 const BookmarkNode* bb_node) { |
| 173 for (int i = 0; i < parent->child_count(); ++i) { | 174 for (int i = 0; i < parent->child_count(); ++i) { |
| 174 TestNode* child = parent->GetChild(i); | 175 TestNode* child = parent->GetChild(i); |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 std::set<GURL> changed_page_urls; | 1323 std::set<GURL> changed_page_urls; |
| 1323 changed_page_urls.insert(kPageURL1); | 1324 changed_page_urls.insert(kPageURL1); |
| 1324 model_->OnFaviconsChanged(changed_page_urls, kFaviconURL12); | 1325 model_->OnFaviconsChanged(changed_page_urls, kFaviconURL12); |
| 1325 ASSERT_EQ(2u, updated_nodes_.size()); | 1326 ASSERT_EQ(2u, updated_nodes_.size()); |
| 1326 EXPECT_TRUE(WasNodeUpdated(node1)); | 1327 EXPECT_TRUE(WasNodeUpdated(node1)); |
| 1327 EXPECT_TRUE(WasNodeUpdated(node2)); | 1328 EXPECT_TRUE(WasNodeUpdated(node2)); |
| 1328 } | 1329 } |
| 1329 } | 1330 } |
| 1330 | 1331 |
| 1331 } // namespace bookmarks | 1332 } // namespace bookmarks |
| OLD | NEW |