OLD | NEW |
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/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 store->AddLogin(*form); | 225 store->AddLogin(*form); |
226 | 226 |
227 // The PasswordStore schedules tasks to run on the DB thread so we schedule | 227 // The PasswordStore schedules tasks to run on the DB thread so we schedule |
228 // yet another task to notify us that it's safe to carry on with the test. | 228 // yet another task to notify us that it's safe to carry on with the test. |
229 WaitableEvent done(false, false); | 229 WaitableEvent done(false, false); |
230 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 230 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
231 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); | 231 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); |
232 done.Wait(); | 232 done.Wait(); |
233 | 233 |
234 // Change the password. | 234 // Change the password. |
235 form->password_value = WideToUTF16(L"a different password"); | 235 form->password_value = base::WideToUTF16(L"a different password"); |
236 | 236 |
237 const PasswordStoreChange expected_update_changes[] = { | 237 const PasswordStoreChange expected_update_changes[] = { |
238 PasswordStoreChange(PasswordStoreChange::UPDATE, *form), | 238 PasswordStoreChange(PasswordStoreChange::UPDATE, *form), |
239 }; | 239 }; |
240 | 240 |
241 EXPECT_CALL(helper->observer(), | 241 EXPECT_CALL(helper->observer(), |
242 Observe(int(chrome::NOTIFICATION_LOGINS_CHANGED), | 242 Observe(int(chrome::NOTIFICATION_LOGINS_CHANGED), |
243 content::Source<PasswordStore>(store), | 243 content::Source<PasswordStore>(store), |
244 Property(&content::Details<const PasswordStoreChangeList>::ptr, | 244 Property(&content::Details<const PasswordStoreChangeList>::ptr, |
245 Pointee(ElementsAreArray( | 245 Pointee(ElementsAreArray( |
(...skipping 21 matching lines...) Expand all Loading... |
267 // Deleting the login should trigger a notification. | 267 // Deleting the login should trigger a notification. |
268 store->RemoveLogin(*form); | 268 store->RemoveLogin(*form); |
269 | 269 |
270 // Wait for PasswordStore to send the notification. | 270 // Wait for PasswordStore to send the notification. |
271 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 271 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
272 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); | 272 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); |
273 done.Wait(); | 273 done.Wait(); |
274 | 274 |
275 store->ShutdownOnUIThread(); | 275 store->ShutdownOnUIThread(); |
276 } | 276 } |
OLD | NEW |