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

Side by Side Diff: chrome/browser/password_manager/password_store_default_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/scoped_temp_dir.h" 8 #include "base/scoped_temp_dir.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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 364 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
365 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); 365 base::Bind(&WaitableEvent::Signal, base::Unretained(&done)));
366 done.Wait(); 366 done.Wait();
367 367
368 // Handle the callback from the WDS. 368 // Handle the callback from the WDS.
369 MessageLoop::current()->RunAllPending(); 369 MessageLoop::current()->RunAllPending();
370 370
371 STLDeleteElements(&expected_autofillable); 371 STLDeleteElements(&expected_autofillable);
372 STLDeleteElements(&expected_blacklisted); 372 STLDeleteElements(&expected_blacklisted);
373 373
374 store->Shutdown(); 374 store->ShutdownOnUIThread();
375 } 375 }
376 376
377 TEST_F(PasswordStoreDefaultTest, MigrationAlreadyDone) { 377 TEST_F(PasswordStoreDefaultTest, MigrationAlreadyDone) {
378 PasswordFormData wds_data[] = { 378 PasswordFormData wds_data[] = {
379 { PasswordForm::SCHEME_HTML, 379 { PasswordForm::SCHEME_HTML,
380 "http://bar.example.com", 380 "http://bar.example.com",
381 "http://bar.example.com/origin", 381 "http://bar.example.com/origin",
382 "http://bar.example.com/action", 382 "http://bar.example.com/action",
383 L"submit_element", 383 L"submit_element",
384 L"username_element", 384 L"username_element",
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 EXPECT_CALL(consumer, 424 EXPECT_CALL(consumer,
425 OnPasswordStoreRequestDone(_, 425 OnPasswordStoreRequestDone(_,
426 ContainsAllPasswordForms(empty))) 426 ContainsAllPasswordForms(empty)))
427 .WillOnce(QuitUIMessageLoop()); 427 .WillOnce(QuitUIMessageLoop());
428 428
429 store->GetAutofillableLogins(&consumer); 429 store->GetAutofillableLogins(&consumer);
430 MessageLoop::current()->Run(); 430 MessageLoop::current()->Run();
431 431
432 STLDeleteElements(&unexpected_autofillable); 432 STLDeleteElements(&unexpected_autofillable);
433 433
434 store->Shutdown(); 434 store->ShutdownOnUIThread();
435 } 435 }
436 436
437 TEST_F(PasswordStoreDefaultTest, Notifications) { 437 TEST_F(PasswordStoreDefaultTest, Notifications) {
438 // Pretend that the migration has already taken place. 438 // Pretend that the migration has already taken place.
439 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, 439 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated,
440 true, 440 true,
441 PrefService::UNSYNCABLE_PREF); 441 PrefService::UNSYNCABLE_PREF);
442 442
443 // Initializing the PasswordStore shouldn't trigger a migration. 443 // Initializing the PasswordStore shouldn't trigger a migration.
444 scoped_refptr<PasswordStore> store( 444 scoped_refptr<PasswordStore> store(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 expected_delete_changes))))); 517 expected_delete_changes)))));
518 518
519 // Deleting the login should trigger a notification. 519 // Deleting the login should trigger a notification.
520 store->RemoveLogin(*form); 520 store->RemoveLogin(*form);
521 521
522 // Wait for PasswordStore to send the notification. 522 // Wait for PasswordStore to send the notification.
523 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 523 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
524 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); 524 base::Bind(&WaitableEvent::Signal, base::Unretained(&done)));
525 done.Wait(); 525 done.Wait();
526 526
527 store->Shutdown(); 527 store->ShutdownOnUIThread();
528 } 528 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_default.cc ('k') | chrome/browser/password_manager/password_store_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698