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

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: Fixing another ChromeOS test. Created 4 years, 3 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..9556f099ebc8b47a2ac94fcb0e97aceb7075bfa9 100644
--- a/chrome/browser/sync/test/integration/autofill_helper.h
+++ b/chrome/browser/sync/test/integration/autofill_helper.h
@@ -12,7 +12,9 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
+#include "chrome/browser/sync/test/integration/multi_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
+#include "components/autofill/core/browser/personal_data_manager_observer.h"
namespace autofill {
class AutofillEntry;
@@ -59,9 +61,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 +105,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 +113,37 @@ autofill::AutofillProfile CreateUniqueAutofillProfile();
} // namespace autofill_helper
+// Checker to block until autofill keys match on both profiles.
+class AutofillKeysChecker : public MultiClientStatusChangeChecker {
maxbogue 2016/09/30 16:27:55 I still think it's weird that these are outside th
skym 2016/09/30 17:43:21 Acknowledged.
+ 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 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_

Powered by Google App Engine
This is Rietveld 408576698