| Index: chrome/browser/sync/test/integration/passwords_helper.cc
|
| diff --git a/chrome/browser/sync/test/integration/passwords_helper.cc b/chrome/browser/sync/test/integration/passwords_helper.cc
|
| index b21b7064d8b8c04871037a488baff2ba3f9dba4a..c31c0524a47f87ce0ae57cc01b060bf6fdb45706 100644
|
| --- a/chrome/browser/sync/test/integration/passwords_helper.cc
|
| +++ b/chrome/browser/sync/test/integration/passwords_helper.cc
|
| @@ -16,9 +16,7 @@
|
| #include "base/time/time.h"
|
| #include "chrome/browser/password_manager/password_store_factory.h"
|
| #include "chrome/browser/sync/profile_sync_service_factory.h"
|
| -#include "chrome/browser/sync/test/integration/multi_client_status_change_checker.h"
|
| #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
|
| -#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
|
| #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
|
| #include "components/browser_sync/profile_sync_service.h"
|
| #include "components/password_manager/core/browser/password_manager_test_utils.h"
|
| @@ -196,22 +194,27 @@ bool AllProfilesContainSamePasswordForms() {
|
| return true;
|
| }
|
|
|
| -namespace {
|
| +int GetPasswordCount(int index) {
|
| + return GetLogins(GetPasswordStore(index)).size();
|
| +}
|
|
|
| -// Helper class used in the implementation of
|
| -// AwaitAllProfilesContainSamePasswordForms.
|
| -class SamePasswordFormsChecker : public MultiClientStatusChangeChecker {
|
| - public:
|
| - SamePasswordFormsChecker();
|
| - ~SamePasswordFormsChecker() override;
|
| +int GetVerifierPasswordCount() {
|
| + return GetLogins(GetVerifierPasswordStore()).size();
|
| +}
|
|
|
| - bool IsExitConditionSatisfied() override;
|
| - std::string GetDebugMessage() const override;
|
| +PasswordForm CreateTestPasswordForm(int index) {
|
| + PasswordForm form;
|
| + form.signon_realm = kFakeSignonRealm;
|
| + form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index));
|
| + form.username_value =
|
| + base::ASCIIToUTF16(base::StringPrintf("username%d", index));
|
| + form.password_value =
|
| + base::ASCIIToUTF16(base::StringPrintf("password%d", index));
|
| + form.date_created = base::Time::Now();
|
| + return form;
|
| +}
|
|
|
| - private:
|
| - bool in_progress_;
|
| - bool needs_recheck_;
|
| -};
|
| +} // namespace passwords_helper
|
|
|
| SamePasswordFormsChecker::SamePasswordFormsChecker()
|
| : MultiClientStatusChangeChecker(
|
| @@ -219,8 +222,6 @@ SamePasswordFormsChecker::SamePasswordFormsChecker()
|
| in_progress_(false),
|
| needs_recheck_(false) {}
|
|
|
| -SamePasswordFormsChecker::~SamePasswordFormsChecker() {}
|
| -
|
| // This method needs protection against re-entrancy.
|
| //
|
| // This function indirectly calls GetLogins(), which starts a RunLoop on the UI
|
| @@ -247,7 +248,7 @@ bool SamePasswordFormsChecker::IsExitConditionSatisfied() {
|
| in_progress_ = true;
|
| do {
|
| needs_recheck_ = false;
|
| - result = AllProfilesContainSamePasswordForms();
|
| + result = passwords_helper::AllProfilesContainSamePasswordForms();
|
| } while (needs_recheck_);
|
| in_progress_ = false;
|
| return result;
|
| @@ -257,34 +258,6 @@ std::string SamePasswordFormsChecker::GetDebugMessage() const {
|
| return "Waiting for matching passwords";
|
| }
|
|
|
| -} // namespace
|
| -
|
| -bool AwaitAllProfilesContainSamePasswordForms() {
|
| - SamePasswordFormsChecker checker;
|
| - checker.Wait();
|
| - return !checker.TimedOut();
|
| -}
|
| -
|
| -namespace {
|
| -
|
| -// Helper class used in the implementation of
|
| -// AwaitProfileContainSamePasswordFormsAsVerifier.
|
| -class SamePasswordFormsAsVerifierChecker
|
| - : public SingleClientStatusChangeChecker {
|
| - public:
|
| - explicit SamePasswordFormsAsVerifierChecker(int index);
|
| - ~SamePasswordFormsAsVerifierChecker() override;
|
| -
|
| - bool IsExitConditionSatisfied() override;
|
| - std::string GetDebugMessage() const override;
|
| -
|
| - private:
|
| - int index_;
|
| -
|
| - bool in_progress_;
|
| - bool needs_recheck_;
|
| -};
|
| -
|
| SamePasswordFormsAsVerifierChecker::SamePasswordFormsAsVerifierChecker(int i)
|
| : SingleClientStatusChangeChecker(
|
| sync_datatype_helper::test()->GetSyncService(i)),
|
| @@ -293,9 +266,6 @@ SamePasswordFormsAsVerifierChecker::SamePasswordFormsAsVerifierChecker(int i)
|
| needs_recheck_(false) {
|
| }
|
|
|
| -SamePasswordFormsAsVerifierChecker::~SamePasswordFormsAsVerifierChecker() {
|
| -}
|
| -
|
| // This method uses the same re-entrancy prevention trick as
|
| // the SamePasswordFormsChecker.
|
| bool SamePasswordFormsAsVerifierChecker::IsExitConditionSatisfied() {
|
| @@ -310,7 +280,8 @@ bool SamePasswordFormsAsVerifierChecker::IsExitConditionSatisfied() {
|
| in_progress_ = true;
|
| do {
|
| needs_recheck_ = false;
|
| - result = ProfileContainsSamePasswordFormsAsVerifier(index_);
|
| + result =
|
| + passwords_helper::ProfileContainsSamePasswordFormsAsVerifier(index_);
|
| } while (needs_recheck_);
|
| in_progress_ = false;
|
| return result;
|
| @@ -319,33 +290,3 @@ bool SamePasswordFormsAsVerifierChecker::IsExitConditionSatisfied() {
|
| std::string SamePasswordFormsAsVerifierChecker::GetDebugMessage() const {
|
| return "Waiting for passwords to match verifier";
|
| }
|
| -
|
| -} // namespace
|
| -
|
| -bool AwaitProfileContainsSamePasswordFormsAsVerifier(int index) {
|
| - SamePasswordFormsAsVerifierChecker checker(index);
|
| - checker.Wait();
|
| - return !checker.TimedOut();
|
| -}
|
| -
|
| -int GetPasswordCount(int index) {
|
| - return GetLogins(GetPasswordStore(index)).size();
|
| -}
|
| -
|
| -int GetVerifierPasswordCount() {
|
| - return GetLogins(GetVerifierPasswordStore()).size();
|
| -}
|
| -
|
| -PasswordForm CreateTestPasswordForm(int index) {
|
| - PasswordForm form;
|
| - form.signon_realm = kFakeSignonRealm;
|
| - form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index));
|
| - form.username_value =
|
| - base::ASCIIToUTF16(base::StringPrintf("username%d", index));
|
| - form.password_value =
|
| - base::ASCIIToUTF16(base::StringPrintf("password%d", index));
|
| - form.date_created = base::Time::Now();
|
| - return form;
|
| -}
|
| -
|
| -} // namespace passwords_helper
|
|
|