#include <memory>
#include <string>
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/memory/raw_ptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/with_feature_override.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/affiliations/affiliation_service_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_constants.h"
#include "chrome/browser/password_manager/account_password_store_factory.h"
#include "chrome/browser/password_manager/password_manager_test_base.h"
#include "chrome/browser/password_manager/passwords_navigation_observer.h"
#include "chrome/browser/password_manager/profile_password_store_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/sync/test/integration/passwords_helper.h"
#include "chrome/browser/sync/test/integration/secondary_account_helper.h"
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/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 "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/password_manager/core/browser/features/password_features.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_test_utils.h"
#include "components/password_manager/core/browser/password_store/password_store_interface.h"
#include "components/password_manager/core/browser/password_store/password_store_results_observer.h"
#include "components/password_manager/core/browser/password_sync_util.h"
#include "components/password_manager/core/browser/ui/saved_passwords_presenter.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/policy_constants.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/base/signin_switches.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "components/sync/base/data_type.h"
#include "components/sync/base/pref_names.h"
#include "components/sync/service/sync_service_impl.h"
#include "components/sync/test/fake_server_nigori_helper.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browsing_data_remover.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browsing_data_remover_test_util.h"
#include "content/public/test/content_mock_cert_verifier.h"
#include "google_apis/gaia/gaia_switches.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/dns/mock_host_resolver.h"
#include "net/http/http_status_code.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
ElementsAre;
IsEmpty;
NiceMock;
UnorderedElementsAre;
MATCHER_P2(MatchesLogin, username, password, "") { … }
MATCHER_P3(MatchesLoginAndRealm, username, password, signon_realm, "") { … }
const char kTestUserEmail[] = …;
const char kExampleHostname[] = …;
const char kExamplePslHostname[] = …;
class SavedPasswordsPresenterWaiter
: public StatusChangeChecker,
public password_manager::SavedPasswordsPresenter::Observer { … };
class SyncActiveWithoutPasswordsChecker
: public SingleClientStatusChangeChecker { … };
#if !BUILDFLAG(IS_CHROMEOS_ASH)
content::WebContents* GetNewTab(Browser* browser) { … }
#endif
class PasswordManagerSyncTest : public SyncTest { … };
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
class PasswordManagerSyncExplicitParamTest
: public PasswordManagerSyncTest,
public base::test::WithFeatureOverride { … };
#endif
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS_LACROS)
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest, ChooseDestinationStore) { … }
#endif
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest, UpdateInProfileStore) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest, UpdateInAccountStore) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
UpdateMatchingCredentialInBothStores) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
UpdateMismatchingCredentialInBothStores) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
AutoUpdateFromAccountToProfileOnSuccessfulUse) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
AutoUpdateFromProfileToAccountOnSuccessfulUse) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
AutoUpdatePSLMatchInAccountStoreOnSuccessfulUse) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
AutoUpdatePSLMatchInProfileStoreOnSuccessfulUse) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
AutoUpdatePSLMatchInBothStoresOnSuccessfulUse) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
DontOfferToSavePrimaryAccountCredential) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
OfferToSaveNonPrimaryAccountCredential) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
OfferToUpdatePrimaryAccountCredential) { … }
#if !BUILDFLAG(IS_CHROMEOS_LACROS)
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
SignOutWithUnsyncedPasswordsOpensBubble) { … }
#endif
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest, OptInSurvivesSignout) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest, OptOutSurvivesSignout) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest, OptInOutHistograms) { … }
IN_PROC_BROWSER_TEST_P(PasswordManagerSyncExplicitParamTest, Resignin) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
KeepOptInAccountStorageSettingsOnlyForUsers) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
KeepOptOutAccountStorageSettingsOnlyForUsers) { … }
INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE(…);
#endif
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
PasswordDeletionsPropagateToServer) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
PRE_ClearAccountStoreOnStartup) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest, ClearAccountStoreOnStartup) { … }
#endif
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest, SyncUtilApis) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
class PasswordManagerSyncTestWithPolicy : public PasswordManagerSyncTest { … };
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTestWithPolicy,
SyncTypesListDisabled) { … }
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
WipingAccountStoreUpdatesSavedPasswordsPresenter) { … }
#endif
}