| Index: chrome/browser/password_manager/password_store_mac_unittest.cc
|
| diff --git a/chrome/browser/password_manager/password_store_mac_unittest.cc b/chrome/browser/password_manager/password_store_mac_unittest.cc
|
| index 996adef9f00ce3b7fb9d8e08f720d365aa852566..0750fe293380bfc603b49457acd955a81dab97e2 100644
|
| --- a/chrome/browser/password_manager/password_store_mac_unittest.cc
|
| +++ b/chrome/browser/password_manager/password_store_mac_unittest.cc
|
| @@ -21,6 +21,7 @@
|
| #include "components/password_manager/core/browser/login_database.h"
|
| #include "components/password_manager/core/browser/password_manager_test_utils.h"
|
| #include "components/password_manager/core/browser/password_store_consumer.h"
|
| +#include "components/password_manager/core/browser/password_store_origin_unittest.h"
|
| #include "content/public/test/test_browser_thread.h"
|
| #include "content/public/test/test_utils.h"
|
| #include "crypto/mock_apple_keychain.h"
|
| @@ -76,12 +77,6 @@ class MockPasswordStoreConsumer : public PasswordStoreConsumer {
|
| }
|
| };
|
|
|
| -class MockPasswordStoreObserver : public PasswordStore::Observer {
|
| - public:
|
| - MOCK_METHOD1(OnLoginsChanged,
|
| - void(const password_manager::PasswordStoreChangeList& changes));
|
| -};
|
| -
|
| // A LoginDatabase that simulates an Init() method that takes a long time.
|
| class SlowToInitLoginDatabase : public password_manager::LoginDatabase {
|
| public:
|
| @@ -174,8 +169,59 @@ PasswordStoreChangeList AddChangeForForm(const PasswordForm& form) {
|
| 1, PasswordStoreChange(PasswordStoreChange::ADD, form));
|
| }
|
|
|
| +class PasswordStoreMacTestDelegate {
|
| + public:
|
| + PasswordStoreMacTestDelegate();
|
| + ~PasswordStoreMacTestDelegate();
|
| +
|
| + void Initialize(const base::FilePath& temp_dir);
|
| +
|
| + void ClosePasswordStore();
|
| +
|
| + PasswordStoreMac* store() { return store_.get(); }
|
| +
|
| + private:
|
| + scoped_ptr<LoginDatabase> login_db_;
|
| + scoped_refptr<PasswordStoreMac> store_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PasswordStoreMacTestDelegate);
|
| +};
|
| +
|
| +PasswordStoreMacTestDelegate::PasswordStoreMacTestDelegate(){};
|
| +
|
| +PasswordStoreMacTestDelegate::~PasswordStoreMacTestDelegate(){};
|
| +
|
| +void PasswordStoreMacTestDelegate::Initialize(const base::FilePath& temp_dir) {
|
| + // Ensure that LoginDatabase will use the mock keychain if it needs to
|
| + // encrypt/decrypt a password.
|
| + OSCrypt::UseMockKeychain(true);
|
| + login_db_.reset(new LoginDatabase(temp_dir));
|
| + ASSERT_TRUE(login_db_->Init());
|
| +
|
| + // Create and initialize the password store.
|
| + store_ = new PasswordStoreMac(base::ThreadTaskRunnerHandle::Get(),
|
| + base::ThreadTaskRunnerHandle::Get(),
|
| + make_scoped_ptr(new MockAppleKeychain));
|
| + store_->set_login_metadata_db(login_db_.get());
|
| +}
|
| +
|
| +void PasswordStoreMacTestDelegate::ClosePasswordStore() {
|
| + store_->ShutdownOnUIThread();
|
| + base::MessageLoop::current()->RunUntilIdle();
|
| +}
|
| +
|
| } // namespace
|
|
|
| +/*
|
| +namespace password_manager {
|
| +
|
| +INSTANTIATE_TYPED_TEST_CASE_P(Mac,
|
| + PasswordStoreOriginTest,
|
| + PasswordStoreMacTestDelegate);
|
| +
|
| +} // namespace password_manager
|
| +*/
|
| +
|
| #pragma mark -
|
|
|
| class PasswordStoreMacInternalsTest : public testing::Test {
|
| @@ -1676,7 +1722,8 @@ TEST_F(PasswordStoreMacTest, TestRemoveLoginsMultiProfile) {
|
| // implicitly deleted. However, the observers shouldn't get notified about
|
| // deletion of non-existent forms like m.facebook.com.
|
| TEST_F(PasswordStoreMacTest, SilentlyRemoveOrphanedForm) {
|
| - testing::StrictMock<MockPasswordStoreObserver> mock_observer;
|
| + testing::StrictMock<password_manager::MockPasswordStoreObserver>
|
| + mock_observer;
|
| store()->AddObserver(&mock_observer);
|
|
|
| // 1. Add a password for www.facebook.com to the LoginDatabase.
|
|
|