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

Unified Diff: chrome/browser/sync/test/integration/autofill_helper.h

Issue 2379433002: [Sync] Refactoring of sync integration test checkers to remove boilerplate await methods. (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test/integration/autofill_helper.h
diff --git a/chrome/browser/sync/test/integration/autofill_helper.h b/chrome/browser/sync/test/integration/autofill_helper.h
index 14dca507948aa2c855bf7016226fad9c883367dc..788e5ee65711403e92e484d807ff5bdf97571061 100644
--- a/chrome/browser/sync/test/integration/autofill_helper.h
+++ b/chrome/browser/sync/test/integration/autofill_helper.h
@@ -12,7 +12,8 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
-#include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
+#include "chrome/browser/sync/test/integration/multi_client_status_change_checker.h"
+#include "components/autofill/core/browser/personal_data_manager_observer.h"
namespace autofill {
class AutofillEntry;
@@ -59,9 +60,6 @@ std::set<autofill::AutofillEntry> GetAllKeys(int profile) WARN_UNUSED_RESULT;
// |profile_a| and |profile_b|. Returns true if they match.
bool KeysMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT;
-// Allows syncers to run until KeysMatch() returns true.
-bool AwaitKeysMatch(int profile_a, int profile_b);
-
// Replaces the Autofill profiles in sync profile |profile| with
// |autofill_profiles|.
void SetProfiles(int profile,
@@ -106,9 +104,6 @@ bool ProfilesMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT;
// they all match.
bool AllProfilesMatch() WARN_UNUSED_RESULT;
-// Allows the syncers to run until ProfilesMatch() returns true.
-bool AwaitProfilesMatch(int profile_a, int profile_b);
-
// Creates a test autofill profile based on the persona specified in |type|.
autofill::AutofillProfile CreateAutofillProfile(ProfileType type);
@@ -117,4 +112,38 @@ autofill::AutofillProfile CreateUniqueAutofillProfile();
} // namespace autofill_helper
+// Checker to block until autofill keys match on both profiles.
+class AutofillKeysChecker : public MultiClientStatusChangeChecker {
+ public:
+ AutofillKeysChecker(int profile_a, int profile_b);
+
+ // StatusChangeChecker implementation.
+ bool IsExitConditionSatisfied() override;
+ std::string GetDebugMessage() const override;
+
+ private:
+ const int profile_a_;
+ const int profile_b_;
+};
+
+// Checker to block until autofill profiles match on both profiles.
+class AutofillProfileChecker : public StatusChangeChecker,
+ public autofill::PersonalDataManagerObserver {
+ public:
+ AutofillProfileChecker(int profile_a, int profile_b);
+ ~AutofillProfileChecker() override;
+
+ // StatusChangeChecker implementation.
+ bool Wait() override;
+ bool IsExitConditionSatisfied() override;
+ std::string GetDebugMessage() const override;
+
+ // autofill::PersonalDataManager implementation.
+ void OnPersonalDataChanged() override;
+
+ private:
+ const int profile_a_;
+ const int profile_b_;
+};
+
#endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_AUTOFILL_HELPER_H_
« no previous file with comments | « chrome/browser/sync/test/integration/apps_helper.cc ('k') | chrome/browser/sync/test/integration/autofill_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698