| 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 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_BOOKMARKS_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_BOOKMARKS_HELPER_H_ |
| 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_BOOKMARKS_HELPER_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_BOOKMARKS_HELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "chrome/browser/sync/test/integration/await_match_status_change_checker
.h" |
| 12 #include "chrome/browser/sync/test/integration/multi_client_status_change_checke
r.h" |
| 13 #include "chrome/browser/sync/test/integration/single_client_status_change_check
er.h" |
| 11 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 12 | 15 |
| 13 class GURL; | 16 class GURL; |
| 14 | 17 |
| 15 namespace bookmarks { | 18 namespace bookmarks { |
| 16 class BookmarkModel; | 19 class BookmarkModel; |
| 17 class BookmarkNode; | 20 class BookmarkNode; |
| 18 } | 21 } |
| 19 | 22 |
| 20 namespace gfx { | 23 namespace gfx { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 153 |
| 151 // Checks if the bookmark models of |profile_a| and |profile_b| match each | 154 // Checks if the bookmark models of |profile_a| and |profile_b| match each |
| 152 // other. Returns true if they match. | 155 // other. Returns true if they match. |
| 153 bool ModelsMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT; | 156 bool ModelsMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT; |
| 154 | 157 |
| 155 // Checks if the bookmark models of all sync profiles match each other. Does | 158 // Checks if the bookmark models of all sync profiles match each other. Does |
| 156 // not compare them with the verifier bookmark model. Returns true if they | 159 // not compare them with the verifier bookmark model. Returns true if they |
| 157 // match. | 160 // match. |
| 158 bool AllModelsMatch() WARN_UNUSED_RESULT; | 161 bool AllModelsMatch() WARN_UNUSED_RESULT; |
| 159 | 162 |
| 160 // Check if the bookmarks models of all sync profiles match each other, using | |
| 161 // AllModelsMatch. Returns true if bookmark models match and don't timeout | |
| 162 // while checking. | |
| 163 bool AwaitAllModelsMatch() WARN_UNUSED_RESULT; | |
| 164 | |
| 165 // Blocks the caller until the given |profile| contains |expected_count| | |
| 166 // bookmarks with |title| or until waiting times out. | |
| 167 bool AwaitCountBookmarksWithTitlesMatching(int profile, | |
| 168 const std::string& title, | |
| 169 int expected_count) | |
| 170 WARN_UNUSED_RESULT; | |
| 171 | |
| 172 // Blocks the caller until the given |profile| contains |expected_count| | |
| 173 // bookmarks with |url| or until waiting times out. | |
| 174 bool AwaitCountBookmarksWithUrlsMatching(int profile, | |
| 175 const GURL& url, | |
| 176 int expected_count) WARN_UNUSED_RESULT; | |
| 177 | |
| 178 // Checks if the bookmark model of profile |profile| contains any instances of | 163 // Checks if the bookmark model of profile |profile| contains any instances of |
| 179 // two bookmarks with the same URL under the same parent folder. Returns true | 164 // two bookmarks with the same URL under the same parent folder. Returns true |
| 180 // if even one instance is found. | 165 // if even one instance is found. |
| 181 bool ContainsDuplicateBookmarks(int profile); | 166 bool ContainsDuplicateBookmarks(int profile); |
| 182 | 167 |
| 183 // Returns whether a node exists with the specified url. | 168 // Returns whether a node exists with the specified url. |
| 184 bool HasNodeWithURL(int profile, const GURL& url); | 169 bool HasNodeWithURL(int profile, const GURL& url); |
| 185 | 170 |
| 186 // Gets the node in the bookmark model of profile |profile| that has the url | 171 // Gets the node in the bookmark model of profile |profile| that has the url |
| 187 // |url|. Note: Only one instance of |url| is assumed to be present. | 172 // |url|. Note: Only one instance of |url| is assumed to be present. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 std::string IndexedFolderName(int i); | 210 std::string IndexedFolderName(int i); |
| 226 | 211 |
| 227 // Returns a subfolder name identifiable by |i|. | 212 // Returns a subfolder name identifiable by |i|. |
| 228 std::string IndexedSubfolderName(int i); | 213 std::string IndexedSubfolderName(int i); |
| 229 | 214 |
| 230 // Returns a subsubfolder name identifiable by |i|. | 215 // Returns a subsubfolder name identifiable by |i|. |
| 231 std::string IndexedSubsubfolderName(int i); | 216 std::string IndexedSubsubfolderName(int i); |
| 232 | 217 |
| 233 } // namespace bookmarks_helper | 218 } // namespace bookmarks_helper |
| 234 | 219 |
| 220 // Checker used to block until bookmarks match on all clients. |
| 221 class BookmarksMatchChecker : public MultiClientStatusChangeChecker { |
| 222 public: |
| 223 BookmarksMatchChecker(); |
| 224 |
| 225 // StatusChangeChecker implementation. |
| 226 bool IsExitConditionSatisfied() override; |
| 227 std::string GetDebugMessage() const override; |
| 228 }; |
| 229 |
| 230 // Checker used to block until the actual number of bookmarks with the given |
| 231 // title match the expected count. |
| 232 // TODO(pvalenzuela): Remove this class and instead use |
| 233 // AwaitMatchStatusChangeChecker. |
| 234 class BookmarksTitleChecker : public SingleClientStatusChangeChecker { |
| 235 public: |
| 236 BookmarksTitleChecker(int profile_index, |
| 237 const std::string& title, |
| 238 int expected_count); |
| 239 |
| 240 // StatusChangeChecker implementation. |
| 241 bool IsExitConditionSatisfied() override; |
| 242 std::string GetDebugMessage() const override; |
| 243 |
| 244 private: |
| 245 const int profile_index_; |
| 246 const std::string title_; |
| 247 const int expected_count_; |
| 248 }; |
| 249 |
| 250 // Checker used to block until the actual number of bookmarks with the given url |
| 251 // match the expected count. |
| 252 class BookmarksUrlChecker : public AwaitMatchStatusChangeChecker { |
| 253 public: |
| 254 BookmarksUrlChecker(int profile, const GURL& url, int expected_count); |
| 255 }; |
| 256 |
| 235 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_BOOKMARKS_HELPER_H_ | 257 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_BOOKMARKS_HELPER_H_ |
| OLD | NEW |