#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/uuid.h"
#include "build/build_config.h"
#include "chrome/browser/sync/test/integration/encryption_helper.h"
#include "chrome/browser/sync/test/integration/fake_server_match_status_checker.h"
#include "chrome/browser/sync/test/integration/password_sharing_invitation_helper.h"
#include "chrome/browser/sync/test/integration/passwords_helper.h"
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/sync_service_impl_harness.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "components/password_manager/core/browser/features/password_manager_features_util.h"
#include "components/password_manager/core/browser/password_form.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/signin/public/base/signin_switches.h"
#include "components/sync/base/data_type.h"
#include "components/sync/engine/nigori/cross_user_sharing_public_key.h"
#include "components/sync/engine/nigori/cross_user_sharing_public_private_key_pair.h"
#include "components/sync/protocol/nigori_specifics.pb.h"
#include "components/sync/protocol/password_sharing_invitation_specifics.pb.h"
#include "components/sync/protocol/sync_entity.pb.h"
#include "components/sync/test/fake_server_nigori_helper.h"
#include "content/public/test/browser_test.h"
#include "testing/gmock/include/gmock/gmock.h"
PasswordForm;
PasswordStoreInterface;
ProcessIncomingPasswordSharingInvitationResult;
CreateDefaultIncomingInvitation;
CreateDefaultSenderDisplayInfo;
CreateEncryptedIncomingInvitationSpecifics;
GetAccountPasswordStoreInterface;
GetAllLogins;
GetProfilePasswordStoreInterface;
EntitySpecifics;
IncomingPasswordSharingInvitationSpecifics;
PasswordSharingInvitationData;
SyncEntity;
SyncServiceImpl;
AllOf;
Contains;
Field;
IsEmpty;
Pointee;
SizeIs;
UnorderedElementsAre;
namespace {
constexpr char kPasswordValue[] = …;
constexpr char kUsernameValue[] = …;
MATCHER_P(HasPasswordValue, password_value, "") { … }
MATCHER_P(HasUsernameElement, username_element, "") { … }
IncomingPasswordSharingInvitationSpecifics CreateInvitationSpecifics(
const sync_pb::CrossUserSharingPublicKey& recipient_public_key) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
void FillPasswordClientTagFromInvitation(
const sync_pb::PasswordSharingInvitationData& invitation_data,
sync_pb::PasswordSpecificsData* password_data) { … }
#endif
class ServerPasswordInvitationChecker
: public fake_server::FakeServerMatchStatusChecker { … };
class IncomingPasswordSharingInvitationInactiveChecker
: public SingleClientStatusChangeChecker { … };
class SingleClientIncomingPasswordSharingInvitationTest : public SyncTest { … };
IN_PROC_BROWSER_TEST_F(SingleClientIncomingPasswordSharingInvitationTest,
ShouldStoreIncomingPassword) { … }
IN_PROC_BROWSER_TEST_F(SingleClientIncomingPasswordSharingInvitationTest,
ShouldStoreIncomingPasswordGroup) { … }
IN_PROC_BROWSER_TEST_F(SingleClientIncomingPasswordSharingInvitationTest,
ShouldIssueTombstoneAfterProcessingInvitation) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(SingleClientIncomingPasswordSharingInvitationTest,
ShouldHandleIncomingInvitationsAtInitialSync) { … }
IN_PROC_BROWSER_TEST_F(
SingleClientIncomingPasswordSharingInvitationTest,
ShouldIgnoreIncomingInvitationIfPasswordExistsAtInitialSync) { … }
#endif
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID)
IN_PROC_BROWSER_TEST_F(SingleClientIncomingPasswordSharingInvitationTest,
ShouldStoreIncomingPasswordIntoAccountDB) { … }
IN_PROC_BROWSER_TEST_F(SingleClientIncomingPasswordSharingInvitationTest,
ShouldStopReceivingPasswordsWhenPasswordsOptedOut) { … }
#endif
IN_PROC_BROWSER_TEST_F(SingleClientIncomingPasswordSharingInvitationTest,
ShouldStopIncomingInvitationsOnPasswordsFailure) { … }
}