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

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

Issue 152683002: Passwords: Remove references to BrowserThread from PasswordStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 10 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_store_unittest.cc
diff --git a/chrome/browser/password_manager/password_store_unittest.cc b/chrome/browser/password_manager/password_store_unittest.cc
index 531d5f0b7ecc059058f99e4daf3aa738c60c2ecb..3b0934aecce8915d718040949e9ed37159782c69 100644
--- a/chrome/browser/password_manager/password_store_unittest.cc
+++ b/chrome/browser/password_manager/password_store_unittest.cc
@@ -36,52 +36,6 @@ class MockPasswordStoreConsumer : public PasswordStoreConsumer {
void(const std::vector<PasswordForm*>&));
};
-// This class will add and remove a mock notification observer from
-// the DB thread.
-class DBThreadObserverHelper
- : public base::RefCountedThreadSafe<DBThreadObserverHelper,
- BrowserThread::DeleteOnDBThread> {
- public:
- DBThreadObserverHelper() : done_event_(true, false) {}
-
- void Init(PasswordStore* password_store) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- BrowserThread::PostTask(
- BrowserThread::DB,
- FROM_HERE,
- base::Bind(&DBThreadObserverHelper::AddObserverTask,
- this,
- make_scoped_refptr(password_store)));
- done_event_.Wait();
- }
-
- content::MockNotificationObserver& observer() {
- return observer_;
- }
-
- protected:
- virtual ~DBThreadObserverHelper() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
- registrar_.RemoveAll();
- }
-
- void AddObserverTask(PasswordStore* password_store) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
- registrar_.Add(&observer_,
- chrome::NOTIFICATION_LOGINS_CHANGED,
- content::Source<PasswordStore>(password_store));
- done_event_.Signal();
- }
-
- WaitableEvent done_event_;
- content::NotificationRegistrar registrar_;
- content::MockNotificationObserver observer_;
-
- private:
- friend struct BrowserThread::DeleteOnThread<BrowserThread::DB>;
- friend class base::DeleteHelper<DBThreadObserverHelper>;
-};
-
} // anonymous namespace
class PasswordStoreTest : public testing::Test {
@@ -128,7 +82,11 @@ ACTION(QuitUIMessageLoop) {
TEST_F(PasswordStoreTest, IgnoreOldWwwGoogleLogins) {
scoped_refptr<PasswordStoreDefault> store(
- new PasswordStoreDefault(login_db_.release(), profile_.get()));
+ new PasswordStoreDefault(
+ base::MessageLoopProxy::current(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
+ login_db_.release(),
+ profile_.get()));
store->Init();
const time_t cutoff = 1325376000; // 00:00 Jan 1 2012 UTC
« no previous file with comments | « chrome/browser/password_manager/password_store_mac_unittest.cc ('k') | chrome/browser/password_manager/password_store_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698