| 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()); |
| 238 return FaviconData(model->GetFavicon(node), node->icon_url()); | 240 return FaviconData(model->GetFavicon(node), node->icon_url()); |
| 239 } | 241 } |
| 240 | 242 |
| 241 // Sets the favicon for |profile| and |node|. |profile| may be | 243 // Sets the favicon for |profile| and |node|. |profile| may be |
| 242 // |test()->verifier()|. | 244 // |test()->verifier()|. |
| 243 void SetFaviconImpl(Profile* profile, | 245 void SetFaviconImpl(Profile* profile, |
| 244 const BookmarkNode* node, | 246 const BookmarkNode* node, |
| 245 const GURL& icon_url, | 247 const GURL& icon_url, |
| 246 const gfx::Image& image, | 248 const gfx::Image& image, |
| 247 bookmarks_helper::FaviconSource favicon_source) { | 249 bookmarks_helper::FaviconSource favicon_source) { |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 sync_datatype_helper::test()->GetSyncServices()) {} | 899 sync_datatype_helper::test()->GetSyncServices()) {} |
| 898 | 900 |
| 899 bool BookmarksMatchChecker::IsExitConditionSatisfied() { | 901 bool BookmarksMatchChecker::IsExitConditionSatisfied() { |
| 900 return bookmarks_helper::AllModelsMatch(); | 902 return bookmarks_helper::AllModelsMatch(); |
| 901 } | 903 } |
| 902 | 904 |
| 903 std::string BookmarksMatchChecker::GetDebugMessage() const { | 905 std::string BookmarksMatchChecker::GetDebugMessage() const { |
| 904 return "Waiting for matching models"; | 906 return "Waiting for matching models"; |
| 905 } | 907 } |
| 906 | 908 |
| 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 | |
| 919 BookmarksTitleChecker::BookmarksTitleChecker(int profile_index, | 909 BookmarksTitleChecker::BookmarksTitleChecker(int profile_index, |
| 920 const std::string& title, | 910 const std::string& title, |
| 921 int expected_count) | 911 int expected_count) |
| 922 : SingleClientStatusChangeChecker( | 912 : SingleClientStatusChangeChecker( |
| 923 sync_datatype_helper::test()->GetSyncService(profile_index)), | 913 sync_datatype_helper::test()->GetSyncService(profile_index)), |
| 924 profile_index_(profile_index), | 914 profile_index_(profile_index), |
| 925 title_(title), | 915 title_(title), |
| 926 expected_count_(expected_count) { | 916 expected_count_(expected_count) { |
| 927 DCHECK_GE(expected_count, 0) << "expected_count must be non-negative."; | 917 DCHECK_GE(expected_count, 0) << "expected_count must be non-negative."; |
| 928 } | 918 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 955 } // namespace | 945 } // namespace |
| 956 | 946 |
| 957 BookmarksUrlChecker::BookmarksUrlChecker(int profile, | 947 BookmarksUrlChecker::BookmarksUrlChecker(int profile, |
| 958 const GURL& url, | 948 const GURL& url, |
| 959 int expected_count) | 949 int expected_count) |
| 960 : AwaitMatchStatusChangeChecker(base::Bind(BookmarkCountsByUrlMatch, | 950 : AwaitMatchStatusChangeChecker(base::Bind(BookmarkCountsByUrlMatch, |
| 961 profile, | 951 profile, |
| 962 base::ConstRef(url), | 952 base::ConstRef(url), |
| 963 expected_count), | 953 expected_count), |
| 964 "Bookmark URL counts match.") {} | 954 "Bookmark URL counts match.") {} |
| OLD | NEW |