| Index: components/password_manager/core/browser/login_database.cc
|
| diff --git a/components/password_manager/core/browser/login_database.cc b/components/password_manager/core/browser/login_database.cc
|
| index c769481f532e512111f025245528ba05d1549e89..0cf252c1089f981c70d7745301254040013406c8 100644
|
| --- a/components/password_manager/core/browser/login_database.cc
|
| +++ b/components/password_manager/core/browser/login_database.cc
|
| @@ -154,6 +154,9 @@ void LogTimesUsedStat(const std::string& name, int sample) {
|
| LogDynamicUMAStat(name, sample, 0, 100, 10);
|
| }
|
|
|
| +// When set, LoginDatabase::Init() on any instance will artificially fail.
|
| +bool g_simulate_init_failure_for_testing = false;
|
| +
|
| } // namespace
|
|
|
| LoginDatabase::LoginDatabase() {
|
| @@ -163,6 +166,9 @@ LoginDatabase::~LoginDatabase() {
|
| }
|
|
|
| bool LoginDatabase::Init(const base::FilePath& db_path) {
|
| + if (g_simulate_init_failure_for_testing)
|
| + return false;
|
| +
|
| // Set pragmas for a small, private database (based on WebDatabase).
|
| db_.set_page_size(2048);
|
| db_.set_cache_size(32);
|
| @@ -440,6 +446,11 @@ void LoginDatabase::ReportMetrics(const std::string& sync_username,
|
| 4);
|
| }
|
|
|
| +// static
|
| +void LoginDatabase::set_simulate_init_failure_for_testing(bool fail) {
|
| + g_simulate_init_failure_for_testing = fail;
|
| +}
|
| +
|
| PasswordStoreChangeList LoginDatabase::AddLogin(const PasswordForm& form) {
|
| PasswordStoreChangeList list;
|
| if (!DoesMatchConstraints(form))
|
|
|