| Index: chrome/browser/password_manager/password_store_x_unittest.cc
|
| diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc
|
| index 45e81ff06ddfefcb13e1ed44d7b83a9261fa585f..8ec7c1185fe9f7fc01d3a3e1c6144ceaeac3d6e7 100644
|
| --- a/chrome/browser/password_manager/password_store_x_unittest.cc
|
| +++ b/chrome/browser/password_manager/password_store_x_unittest.cc
|
| @@ -239,13 +239,14 @@ class PasswordStoreXTest : public testing::TestWithParam<BackendType> {
|
| protected:
|
| void SetUp() override {
|
| ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
|
| -
|
| - login_db_.reset(new password_manager::LoginDatabase());
|
| - ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append("login_test")));
|
| }
|
|
|
| void TearDown() override { base::RunLoop().RunUntilIdle(); }
|
|
|
| + base::FilePath test_login_db_file_path() const {
|
| + return temp_dir_.path().Append(FILE_PATH_LITERAL("login_test"));
|
| + }
|
| +
|
| PasswordStoreX::NativeBackend* GetBackend() {
|
| switch (GetParam()) {
|
| case FAILING_BACKEND:
|
| @@ -259,7 +260,6 @@ class PasswordStoreXTest : public testing::TestWithParam<BackendType> {
|
|
|
| content::TestBrowserThreadBundle thread_bundle_;
|
|
|
| - scoped_ptr<password_manager::LoginDatabase> login_db_;
|
| base::ScopedTempDir temp_dir_;
|
| };
|
|
|
| @@ -271,7 +271,7 @@ TEST_P(PasswordStoreXTest, Notifications) {
|
| scoped_refptr<PasswordStoreX> store(
|
| new PasswordStoreX(base::MessageLoopProxy::current(),
|
| base::MessageLoopProxy::current(),
|
| - login_db_.release(),
|
| + test_login_db_file_path(),
|
| GetBackend()));
|
| store->Init(syncer::SyncableService::StartSyncFlare());
|
|
|
| @@ -345,14 +345,16 @@ TEST_P(PasswordStoreXTest, NativeMigration) {
|
| VectorOfForms expected_blacklisted;
|
| InitExpectedForms(false, 50, &expected_blacklisted);
|
|
|
| + const base::FilePath login_db_file = test_login_db_file_path();
|
| + scoped_ptr<password_manager::LoginDatabase> login_db(
|
| + new password_manager::LoginDatabase());
|
| + ASSERT_TRUE(login_db->Init(login_db_file));
|
| +
|
| // Get the initial size of the login DB file, before we populate it.
|
| // This will be used later to make sure it gets back to this size.
|
| - const base::FilePath login_db_file = temp_dir_.path().Append("login_test");
|
| base::File::Info db_file_start_info;
|
| ASSERT_TRUE(base::GetFileInfo(login_db_file, &db_file_start_info));
|
|
|
| - password_manager::LoginDatabase* login_db = login_db_.get();
|
| -
|
| // Populate the login DB with logins that should be migrated.
|
| for (VectorOfForms::iterator it = expected_autofillable.begin();
|
| it != expected_autofillable.end(); ++it) {
|
| @@ -363,6 +365,8 @@ TEST_P(PasswordStoreXTest, NativeMigration) {
|
| login_db->AddLogin(**it);
|
| }
|
|
|
| + login_db.reset();
|
| +
|
| // Get the new size of the login DB file. We expect it to be larger.
|
| base::File::Info db_file_full_info;
|
| ASSERT_TRUE(base::GetFileInfo(login_db_file, &db_file_full_info));
|
| @@ -372,7 +376,7 @@ TEST_P(PasswordStoreXTest, NativeMigration) {
|
| scoped_refptr<PasswordStoreX> store(
|
| new PasswordStoreX(base::MessageLoopProxy::current(),
|
| base::MessageLoopProxy::current(),
|
| - login_db_.release(),
|
| + login_db_file,
|
| GetBackend()));
|
| store->Init(syncer::SyncableService::StartSyncFlare());
|
|
|
| @@ -410,7 +414,7 @@ TEST_P(PasswordStoreXTest, NativeMigration) {
|
| .WillOnce(WithArg<0>(STLDeleteElements0()));
|
| }
|
|
|
| - LoginDatabaseQueryCallback(login_db, true, &ld_return);
|
| + LoginDatabaseQueryCallback(store->login_db(), true, &ld_return);
|
|
|
| // Wait for the login DB methods to execute.
|
| base::RunLoop().RunUntilIdle();
|
| @@ -427,7 +431,7 @@ TEST_P(PasswordStoreXTest, NativeMigration) {
|
| .WillOnce(WithArg<0>(STLDeleteElements0()));
|
| }
|
|
|
| - LoginDatabaseQueryCallback(login_db, false, &ld_return);
|
| + LoginDatabaseQueryCallback(store->login_db(), false, &ld_return);
|
|
|
| // Wait for the login DB methods to execute.
|
| base::RunLoop().RunUntilIdle();
|
|
|