Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9124)

Unified Diff: chrome/browser/password_manager/password_manager_unittest.cc

Issue 9665007: Profile refactoring: Remove all PasswordStore code from the Profile interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add to factory list Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/password_manager_unittest.cc
diff --git a/chrome/browser/password_manager/password_manager_unittest.cc b/chrome/browser/password_manager/password_manager_unittest.cc
index 1fcbaa1d42e6be975c8250e39a77df553497ffd3..9216612e988943c33c46dae9d2d1848ff09aa11e 100644
--- a/chrome/browser/password_manager/password_manager_unittest.cc
+++ b/chrome/browser/password_manager/password_manager_unittest.cc
@@ -7,9 +7,11 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/password_manager/mock_password_store.h"
#include "chrome/browser/password_manager/password_manager.h"
#include "chrome/browser/password_manager/password_manager_delegate.h"
#include "chrome/browser/password_manager/password_store.h"
+#include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
@@ -37,42 +39,6 @@ class MockPasswordManagerDelegate : public PasswordManagerDelegate {
MOCK_METHOD0(DidLastPageLoadEncounterSSLErrors, bool());
};
-class TestingProfileWithPasswordStore : public TestingProfile {
- public:
- explicit TestingProfileWithPasswordStore(PasswordStore* store)
- : store_(store) {}
- virtual ~TestingProfileWithPasswordStore() {
- store_->Shutdown();
- }
- virtual PasswordStore* GetPasswordStore(ServiceAccessType access) {
- return store_;
- }
- private:
- scoped_refptr<PasswordStore> store_;
-};
-
-class MockPasswordStore : public PasswordStore {
- public:
- MOCK_METHOD1(RemoveLogin, void(const PasswordForm&));
- MOCK_METHOD2(GetLogins, int(const PasswordForm&, PasswordStoreConsumer*));
- MOCK_METHOD1(AddLogin, void(const PasswordForm&));
- MOCK_METHOD1(UpdateLogin, void(const PasswordForm&));
- MOCK_METHOD0(ReportMetrics, void());
- MOCK_METHOD0(ReportMetricsImpl, void());
- MOCK_METHOD1(AddLoginImpl, void(const PasswordForm&));
- MOCK_METHOD1(UpdateLoginImpl, void(const PasswordForm&));
- MOCK_METHOD1(RemoveLoginImpl, void(const PasswordForm&));
- MOCK_METHOD2(RemoveLoginsCreatedBetweenImpl, void(const base::Time&,
- const base::Time&));
- MOCK_METHOD2(GetLoginsImpl, void(GetLoginsRequest*, const PasswordForm&));
- MOCK_METHOD1(GetAutofillableLoginsImpl, void(GetLoginsRequest*));
- MOCK_METHOD1(GetBlacklistLoginsImpl, void(GetLoginsRequest*));
- MOCK_METHOD1(FillAutofillableLogins,
- bool(std::vector<webkit::forms::PasswordForm*>*));
- MOCK_METHOD1(FillBlacklistLogins,
- bool(std::vector<webkit::forms::PasswordForm*>*));
-};
-
ACTION_P2(InvokeConsumer, handle, forms) {
arg0->OnPasswordStoreRequestDone(handle, forms);
}
@@ -88,8 +54,11 @@ class PasswordManagerTest : public ChromeRenderViewHostTestHarness {
protected:
virtual void SetUp() {
- store_ = new MockPasswordStore();
- browser_context_.reset(new TestingProfileWithPasswordStore(store_));
+ TestingProfile* testing_profile = new TestingProfile;
+ store_ = static_cast<MockPasswordStore*>(
+ PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse(
+ testing_profile, MockPasswordStore::Build));
+ browser_context_.reset(testing_profile);
ChromeRenderViewHostTestHarness::SetUp();
EXPECT_CALL(delegate_, GetProfileForPasswordManager())
« no previous file with comments | « chrome/browser/password_manager/password_form_manager.cc ('k') | chrome/browser/password_manager/password_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698