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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 158 } |
159 for (int i = 0; i < node->child_count(); ++i) { | 159 for (int i = 0; i < node->child_count(); ++i) { |
160 const base::DictionaryValue* child = NULL; | 160 const base::DictionaryValue* child = NULL; |
161 if (!children->GetDictionary(i, &child) || | 161 if (!children->GetDictionary(i, &child) || |
162 !NodeMatchesValue(node->GetChild(i), child)) { | 162 !NodeMatchesValue(node->GetChild(i), child)) { |
163 return false; | 163 return false; |
164 } | 164 } |
165 } | 165 } |
166 } else if (node->is_url()) { | 166 } else if (node->is_url()) { |
167 std::string url; | 167 std::string url; |
168 if (!dict->GetString("url", &url) || node->url() != GURL(url)) | 168 if (!dict->GetString("url", &url) || node->url() != url) |
169 return false; | 169 return false; |
170 } else { | 170 } else { |
171 return false; | 171 return false; |
172 } | 172 } |
173 return true; | 173 return true; |
174 } | 174 } |
175 | 175 |
176 base::MessageLoop loop_; | 176 base::MessageLoop loop_; |
177 TestingPrefServiceSimple prefs_; | 177 TestingPrefServiceSimple prefs_; |
178 std::unique_ptr<BookmarkModel> model_; | 178 std::unique_ptr<BookmarkModel> model_; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 Mock::VerifyAndClearExpectations(&observer_); | 355 Mock::VerifyAndClearExpectations(&observer_); |
356 | 356 |
357 EXPECT_CALL(observer_, BookmarkAllUserNodesRemoved(model_.get(), _)); | 357 EXPECT_CALL(observer_, BookmarkAllUserNodesRemoved(model_.get(), _)); |
358 model_->RemoveAllUserBookmarks(); | 358 model_->RemoveAllUserBookmarks(); |
359 EXPECT_EQ(2, managed_node()->child_count()); | 359 EXPECT_EQ(2, managed_node()->child_count()); |
360 EXPECT_EQ(0, model_->bookmark_bar_node()->child_count()); | 360 EXPECT_EQ(0, model_->bookmark_bar_node()->child_count()); |
361 Mock::VerifyAndClearExpectations(&observer_); | 361 Mock::VerifyAndClearExpectations(&observer_); |
362 } | 362 } |
363 | 363 |
364 } // namespace bookmarks | 364 } // namespace bookmarks |
OLD | NEW |