#include "chrome/browser/ui/safety_hub/password_status_check_service.h"
#include <string>
#include <string_view>
#include "base/json/values_util.h"
#include "base/location.h"
#include "base/test/bind.h"
#include "base/time/time.h"
#include "chrome/browser/password_manager/password_manager_test_util.h"
#include "chrome/browser/ui/safety_hub/password_status_check_result.h"
#include "chrome/browser/ui/safety_hub/safety_hub_constants.h"
#include "chrome/browser/ui/safety_hub/safety_hub_prefs.h"
#include "chrome/browser/ui/safety_hub/safety_hub_test_util.h"
#include "chrome/common/chrome_features.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/testing_profile.h"
#include "components/password_manager/core/browser/leak_detection/bulk_leak_check_service.h"
#include "components/password_manager/core/browser/leak_detection/leak_detection_delegate_interface.h"
#include "components/password_manager/core/browser/password_store/test_password_store.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "content/public/test/browser_task_environment.h"
#include "services/network/test/test_shared_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
constexpr char kTestEmail[] = …;
constexpr char kOrigin1[] = …;
constexpr char kOrigin2[] = …;
constexpr char16_t kUsername1[] = …;
constexpr char16_t kUsername2[] = …;
constexpr char16_t kUsername3[] = …;
constexpr char16_t kUsername4[] = …;
constexpr char16_t kPassword[] = …;
constexpr char16_t kPassword2[] = …;
constexpr char16_t kWeakPassword[] = …;
BulkLeakCheckDelegateInterface;
BulkLeakCheckService;
BulkLeakCheckServiceInterface;
InsecureType;
IsLeaked;
LeakCheckCredential;
PasswordForm;
TestPasswordStore;
SafetyHubCardState;
MakeForm;
class MockObserver : public BulkLeakCheckService::Observer { … };
PasswordForm WeakForm() { … }
PasswordForm LeakedForm() { … }
PasswordForm ReusedForm1() { … }
PasswordForm ReusedForm2() { … }
}
class PasswordStatusCheckServiceBaseTest : public testing::Test { … };
class PasswordStatusCheckServiceParameterizedIssueTest
: public PasswordStatusCheckServiceBaseTest,
public testing::WithParamInterface<
testing::tuple< bool,
bool,
bool>> { … };
class PasswordStatusCheckServiceParameterizedStoreTest
: public PasswordStatusCheckServiceBaseTest,
public testing::WithParamInterface< bool> { … };
class PasswordStatusCheckServiceParameterizedCardTest
: public PasswordStatusCheckServiceBaseTest,
public testing::WithParamInterface<
testing::tuple< bool,
bool,
bool,
bool,
bool,
bool,
bool>> { … };
class PasswordStatusCheckServiceParameterizedSchedulingTest
: public PasswordStatusCheckServiceBaseTest,
public testing::WithParamInterface<int> { … };
TEST_F(PasswordStatusCheckServiceBaseTest, NoIssuesInitially) { … }
TEST_P(PasswordStatusCheckServiceParameterizedIssueTest,
DetectIssuesDuringConstruction) { … }
TEST_P(PasswordStatusCheckServiceParameterizedIssueTest,
DetectIssuesWhileActive) { … }
TEST_P(PasswordStatusCheckServiceParameterizedIssueTest,
DetectAddedAndRemovedIssuesAutomatically) { … }
TEST_P(PasswordStatusCheckServiceParameterizedStoreTest,
DetectChangingWeakPassword) { … }
TEST_P(PasswordStatusCheckServiceParameterizedStoreTest,
DetectChangingLeakedPassword) { … }
TEST_P(PasswordStatusCheckServiceParameterizedStoreTest,
DetectChangingReusedPassword) { … }
TEST_F(PasswordStatusCheckServiceBaseTest, RepeatedlyUpdatingDoesNotCrash) { … }
TEST_F(PasswordStatusCheckServiceBaseTest, PasswordCheckNoPasswords) { … }
TEST_F(PasswordStatusCheckServiceBaseTest,
DISABLED_PasswordCheckSignedOutWithPasswords) { … }
TEST_F(PasswordStatusCheckServiceBaseTest,
DISABLED_PasswordCheck_FindCompromised) { … }
TEST_F(PasswordStatusCheckServiceBaseTest, DISABLED_PasswordCheck_Error) { … }
TEST_F(PasswordStatusCheckServiceBaseTest, PrefInitialized) { … }
TEST_F(PasswordStatusCheckServiceBaseTest, CheckTimeUpdatedOnIntervalChange) { … }
TEST_F(PasswordStatusCheckServiceBaseTest,
CheckTimeUpdatedAfterRunScheduledInTheFuture) { … }
TEST_F(PasswordStatusCheckServiceBaseTest,
CheckTimeUpdatedAfterRunScheduledInThePast) { … }
TEST_F(PasswordStatusCheckServiceBaseTest,
CheckTimeUpdatedAfterRunScheduledLongTimeInThePast) { … }
TEST_F(PasswordStatusCheckServiceBaseTest, ScheduledCheckRunsRepeatedly) { … }
TEST_F(PasswordStatusCheckServiceBaseTest, WeakAndReusesCheckRunningDaily) { … }
TEST_F(PasswordStatusCheckServiceBaseTest, IgnoredCompromisedPasswords) { … }
TEST_F(PasswordStatusCheckServiceBaseTest, IgnoredSavedPasswords) { … }
TEST_P(PasswordStatusCheckServiceParameterizedCardTest, PasswordCardState) { … }
TEST_F(PasswordStatusCheckServiceBaseTest, PasswordCardCheckTime) { … }
TEST_P(PasswordStatusCheckServiceParameterizedStoreTest,
ResultWhenChangingLeakedPassword) { … }
TEST_P(PasswordStatusCheckServiceParameterizedSchedulingTest,
CheckWeightedRandomScheduling) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);