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

Side by Side Diff: chrome/browser/password_manager/password_store_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 profile_.reset(new TestingProfile()); 100 profile_.reset(new TestingProfile());
101 101
102 login_db_.reset(new LoginDatabase()); 102 login_db_.reset(new LoginDatabase());
103 ASSERT_TRUE(login_db_->Init(profile_->GetPath().Append( 103 ASSERT_TRUE(login_db_->Init(profile_->GetPath().Append(
104 FILE_PATH_LITERAL("login_test")))); 104 FILE_PATH_LITERAL("login_test"))));
105 } 105 }
106 106
107 virtual void TearDown() { 107 virtual void TearDown() {
108 db_thread_.Stop(); 108 db_thread_.Stop();
109 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 109 base::MessageLoop::current()->PostTask(FROM_HERE,
110 MessageLoop::current()->Run(); 110 base::MessageLoop::QuitClosure());
111 base::MessageLoop::current()->Run();
111 } 112 }
112 113
113 MessageLoopForUI message_loop_; 114 base::MessageLoopForUI message_loop_;
114 content::TestBrowserThread ui_thread_; 115 content::TestBrowserThread ui_thread_;
115 // PasswordStore schedules work on this thread. 116 // PasswordStore schedules work on this thread.
116 content::TestBrowserThread db_thread_; 117 content::TestBrowserThread db_thread_;
117 118
118 scoped_ptr<LoginDatabase> login_db_; 119 scoped_ptr<LoginDatabase> login_db_;
119 scoped_ptr<TestingProfile> profile_; 120 scoped_ptr<TestingProfile> profile_;
120 }; 121 };
121 122
122 ACTION(STLDeleteElements0) { 123 ACTION(STLDeleteElements0) {
123 STLDeleteContainerPointers(arg0.begin(), arg0.end()); 124 STLDeleteContainerPointers(arg0.begin(), arg0.end());
124 } 125 }
125 126
126 ACTION(QuitUIMessageLoop) { 127 ACTION(QuitUIMessageLoop) {
127 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
128 MessageLoop::current()->Quit(); 129 base::MessageLoop::current()->Quit();
129 } 130 }
130 131
131 TEST_F(PasswordStoreTest, IgnoreOldWwwGoogleLogins) { 132 TEST_F(PasswordStoreTest, IgnoreOldWwwGoogleLogins) {
132 scoped_refptr<PasswordStoreDefault> store( 133 scoped_refptr<PasswordStoreDefault> store(
133 new PasswordStoreDefault(login_db_.release(), profile_.get())); 134 new PasswordStoreDefault(login_db_.release(), profile_.get()));
134 store->Init(); 135 store->Init();
135 136
136 const time_t cutoff = 1325376000; // 00:00 Jan 1 2012 UTC 137 const time_t cutoff = 1325376000; // 00:00 Jan 1 2012 UTC
137 // The passwords are all empty because PasswordStoreDefault doesn't store the 138 // The passwords are all empty because PasswordStoreDefault doesn't store the
138 // actual passwords on OS X (they're stored in the Keychain instead). We could 139 // actual passwords on OS X (they're stored in the Keychain instead). We could
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 .WillOnce(WithArg<0>(STLDeleteElements0())).RetiresOnSaturation(); 256 .WillOnce(WithArg<0>(STLDeleteElements0())).RetiresOnSaturation();
256 EXPECT_CALL(consumer, 257 EXPECT_CALL(consumer,
257 OnGetPasswordStoreResults( 258 OnGetPasswordStoreResults(
258 ContainsAllPasswordForms(www_google_expected))) 259 ContainsAllPasswordForms(www_google_expected)))
259 .WillOnce(WithArg<0>(STLDeleteElements0())).RetiresOnSaturation(); 260 .WillOnce(WithArg<0>(STLDeleteElements0())).RetiresOnSaturation();
260 261
261 store->GetLogins(www_google, &consumer); 262 store->GetLogins(www_google, &consumer);
262 store->GetLogins(accounts_google, &consumer); 263 store->GetLogins(accounts_google, &consumer);
263 store->GetLogins(bar_example, &consumer); 264 store->GetLogins(bar_example, &consumer);
264 265
265 MessageLoop::current()->Run(); 266 base::MessageLoop::current()->Run();
266 267
267 STLDeleteElements(&all_forms); 268 STLDeleteElements(&all_forms);
268 } 269 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698