| OLD | NEW |
| 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/sync/test/integration/bookmarks_helper.h" | 5 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 urls_with_favicons_->find(node->url()) == urls_with_favicons_->end()) { | 228 urls_with_favicons_->find(node->url()) == urls_with_favicons_->end()) { |
| 229 return FaviconData(); | 229 return FaviconData(); |
| 230 } | 230 } |
| 231 // If a favicon was explicitly set, we may need to wait for it to be loaded | 231 // If a favicon was explicitly set, we may need to wait for it to be loaded |
| 232 // via BookmarkModel::GetFavicon(), which is an asynchronous operation. | 232 // via BookmarkModel::GetFavicon(), which is an asynchronous operation. |
| 233 if (!node->is_favicon_loaded()) { | 233 if (!node->is_favicon_loaded()) { |
| 234 FaviconChangeObserver observer(model, node); | 234 FaviconChangeObserver observer(model, node); |
| 235 model->GetFavicon(node); | 235 model->GetFavicon(node); |
| 236 observer.WaitForGetFavicon(); | 236 observer.WaitForGetFavicon(); |
| 237 } | 237 } |
| 238 EXPECT_TRUE(node->is_favicon_loaded()); | |
| 239 EXPECT_FALSE(model->GetFavicon(node).IsEmpty()); | |
| 240 return FaviconData(model->GetFavicon(node), node->icon_url()); | 238 return FaviconData(model->GetFavicon(node), node->icon_url()); |
| 241 } | 239 } |
| 242 | 240 |
| 243 // Sets the favicon for |profile| and |node|. |profile| may be | 241 // Sets the favicon for |profile| and |node|. |profile| may be |
| 244 // |test()->verifier()|. | 242 // |test()->verifier()|. |
| 245 void SetFaviconImpl(Profile* profile, | 243 void SetFaviconImpl(Profile* profile, |
| 246 const BookmarkNode* node, | 244 const BookmarkNode* node, |
| 247 const GURL& icon_url, | 245 const GURL& icon_url, |
| 248 const gfx::Image& image, | 246 const gfx::Image& image, |
| 249 bookmarks_helper::FaviconSource favicon_source) { | 247 bookmarks_helper::FaviconSource favicon_source) { |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 sync_datatype_helper::test()->GetSyncServices()) {} | 897 sync_datatype_helper::test()->GetSyncServices()) {} |
| 900 | 898 |
| 901 bool BookmarksMatchChecker::IsExitConditionSatisfied() { | 899 bool BookmarksMatchChecker::IsExitConditionSatisfied() { |
| 902 return bookmarks_helper::AllModelsMatch(); | 900 return bookmarks_helper::AllModelsMatch(); |
| 903 } | 901 } |
| 904 | 902 |
| 905 std::string BookmarksMatchChecker::GetDebugMessage() const { | 903 std::string BookmarksMatchChecker::GetDebugMessage() const { |
| 906 return "Waiting for matching models"; | 904 return "Waiting for matching models"; |
| 907 } | 905 } |
| 908 | 906 |
| 907 BookmarksMatchVerifierChecker::BookmarksMatchVerifierChecker() |
| 908 : MultiClientStatusChangeChecker( |
| 909 sync_datatype_helper::test()->GetSyncServices()) {} |
| 910 |
| 911 bool BookmarksMatchVerifierChecker::IsExitConditionSatisfied() { |
| 912 return bookmarks_helper::AllModelsMatchVerifier(); |
| 913 } |
| 914 |
| 915 std::string BookmarksMatchVerifierChecker::GetDebugMessage() const { |
| 916 return "Waiting for model to match verifier"; |
| 917 } |
| 918 |
| 909 BookmarksTitleChecker::BookmarksTitleChecker(int profile_index, | 919 BookmarksTitleChecker::BookmarksTitleChecker(int profile_index, |
| 910 const std::string& title, | 920 const std::string& title, |
| 911 int expected_count) | 921 int expected_count) |
| 912 : SingleClientStatusChangeChecker( | 922 : SingleClientStatusChangeChecker( |
| 913 sync_datatype_helper::test()->GetSyncService(profile_index)), | 923 sync_datatype_helper::test()->GetSyncService(profile_index)), |
| 914 profile_index_(profile_index), | 924 profile_index_(profile_index), |
| 915 title_(title), | 925 title_(title), |
| 916 expected_count_(expected_count) { | 926 expected_count_(expected_count) { |
| 917 DCHECK_GE(expected_count, 0) << "expected_count must be non-negative."; | 927 DCHECK_GE(expected_count, 0) << "expected_count must be non-negative."; |
| 918 } | 928 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 945 } // namespace | 955 } // namespace |
| 946 | 956 |
| 947 BookmarksUrlChecker::BookmarksUrlChecker(int profile, | 957 BookmarksUrlChecker::BookmarksUrlChecker(int profile, |
| 948 const GURL& url, | 958 const GURL& url, |
| 949 int expected_count) | 959 int expected_count) |
| 950 : AwaitMatchStatusChangeChecker(base::Bind(BookmarkCountsByUrlMatch, | 960 : AwaitMatchStatusChangeChecker(base::Bind(BookmarkCountsByUrlMatch, |
| 951 profile, | 961 profile, |
| 952 base::ConstRef(url), | 962 base::ConstRef(url), |
| 953 expected_count), | 963 expected_count), |
| 954 "Bookmark URL counts match.") {} | 964 "Bookmark URL counts match.") {} |
| OLD | NEW |