Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: chrome/browser/sync/test/integration/bookmarks_helper.h

Issue 2379433002: [Sync] Refactoring of sync integration test checkers to remove boilerplate await methods. (Closed)
Patch Set: Fixing another ChromeOS test. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 // TODO(pvalenzuela): Remove this class and instead use
231 // AwaitMatchStatusChangeChecker.
232 class BookmarksTitleChecker : public SingleClientStatusChangeChecker {
maxbogue 2016/09/30 16:27:55 Give this guy a real class comment in addition to
skym 2016/09/30 17:43:21 Done.
233 public:
234 BookmarksTitleChecker(int profile_index,
235 const std::string& title,
236 int expected_count);
237
238 // StatusChangeChecker implementation.
239 bool IsExitConditionSatisfied() override;
240 std::string GetDebugMessage() const override;
241
242 private:
243 const int profile_index_;
244 const std::string title_;
245 const int expected_count_;
246 };
247
248 // Checker used to block until the actual number of bookmarks with the given url
249 // match the expected count.
250 class BookmarksUrlChecker : public AwaitMatchStatusChangeChecker {
251 public:
252 BookmarksUrlChecker(int profile, const GURL& url, int expected_count);
253 };
254
235 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_BOOKMARKS_HELPER_H_ 255 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_BOOKMARKS_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698