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

Side by Side Diff: chrome/browser/password_manager/password_store_x_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/file_util.h" 8 #include "base/file_util.h"
9 #include "base/platform_file.h" 9 #include "base/platform_file.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); 427 base::Bind(&WaitableEvent::Signal, base::Unretained(&done)));
428 done.Wait(); 428 done.Wait();
429 429
430 // Handle the callback from the WDS. 430 // Handle the callback from the WDS.
431 MessageLoop::current()->RunAllPending(); 431 MessageLoop::current()->RunAllPending();
432 432
433 STLDeleteElements(&expected_autofillable); 433 STLDeleteElements(&expected_autofillable);
434 STLDeleteElements(&expected_blacklisted); 434 STLDeleteElements(&expected_blacklisted);
435 435
436 // Public in PasswordStore, protected in PasswordStoreX. 436 // Public in PasswordStore, protected in PasswordStoreX.
437 static_cast<PasswordStore*>(store)->Shutdown(); 437 static_cast<PasswordStore*>(store)->ShutdownOnUIThread();
438 } 438 }
439 439
440 TEST_P(PasswordStoreXTest, WDSMigrationAlreadyDone) { 440 TEST_P(PasswordStoreXTest, WDSMigrationAlreadyDone) {
441 PasswordFormData wds_data[] = { 441 PasswordFormData wds_data[] = {
442 { PasswordForm::SCHEME_HTML, 442 { PasswordForm::SCHEME_HTML,
443 "http://bar.example.com", 443 "http://bar.example.com",
444 "http://bar.example.com/origin", 444 "http://bar.example.com/origin",
445 "http://bar.example.com/action", 445 "http://bar.example.com/action",
446 L"submit_element", 446 L"submit_element",
447 L"username_element", 447 L"username_element",
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 OnPasswordStoreRequestDone(_, 494 OnPasswordStoreRequestDone(_,
495 ContainsAllPasswordForms(empty))) 495 ContainsAllPasswordForms(empty)))
496 .WillOnce(QuitUIMessageLoop()); 496 .WillOnce(QuitUIMessageLoop());
497 497
498 store->GetAutofillableLogins(&consumer); 498 store->GetAutofillableLogins(&consumer);
499 MessageLoop::current()->Run(); 499 MessageLoop::current()->Run();
500 500
501 STLDeleteElements(&unexpected_autofillable); 501 STLDeleteElements(&unexpected_autofillable);
502 502
503 // Public in PasswordStore, protected in PasswordStoreX. 503 // Public in PasswordStore, protected in PasswordStoreX.
504 static_cast<PasswordStore*>(store)->Shutdown(); 504 static_cast<PasswordStore*>(store)->ShutdownOnUIThread();
505 } 505 }
506 506
507 TEST_P(PasswordStoreXTest, Notifications) { 507 TEST_P(PasswordStoreXTest, Notifications) {
508 // Pretend that the migration has already taken place. 508 // Pretend that the migration has already taken place.
509 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, 509 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated,
510 true, 510 true,
511 PrefService::UNSYNCABLE_PREF); 511 PrefService::UNSYNCABLE_PREF);
512 512
513 // Initializing the PasswordStore shouldn't trigger a migration. 513 // Initializing the PasswordStore shouldn't trigger a migration.
514 scoped_refptr<PasswordStoreX> store( 514 scoped_refptr<PasswordStoreX> store(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 590
591 // Deleting the login should trigger a notification. 591 // Deleting the login should trigger a notification.
592 store->RemoveLogin(*form); 592 store->RemoveLogin(*form);
593 593
594 // Wait for PasswordStore to send the notification. 594 // Wait for PasswordStore to send the notification.
595 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 595 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
596 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); 596 base::Bind(&WaitableEvent::Signal, base::Unretained(&done)));
597 done.Wait(); 597 done.Wait();
598 598
599 // Public in PasswordStore, protected in PasswordStoreX. 599 // Public in PasswordStore, protected in PasswordStoreX.
600 static_cast<PasswordStore*>(store)->Shutdown(); 600 static_cast<PasswordStore*>(store)->ShutdownOnUIThread();
601 } 601 }
602 602
603 TEST_P(PasswordStoreXTest, NativeMigration) { 603 TEST_P(PasswordStoreXTest, NativeMigration) {
604 VectorOfForms expected_autofillable; 604 VectorOfForms expected_autofillable;
605 InitExpectedForms(true, 50, &expected_autofillable); 605 InitExpectedForms(true, 50, &expected_autofillable);
606 606
607 VectorOfForms expected_blacklisted; 607 VectorOfForms expected_blacklisted;
608 InitExpectedForms(false, 50, &expected_blacklisted); 608 InitExpectedForms(false, 50, &expected_blacklisted);
609 609
610 // Get the initial size of the login DB file, before we populate it. 610 // Get the initial size of the login DB file, before we populate it.
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 // larger after populating it. 733 // larger after populating it.
734 base::PlatformFileInfo db_file_end_info; 734 base::PlatformFileInfo db_file_end_info;
735 ASSERT_TRUE(file_util::GetFileInfo(login_db_file, &db_file_end_info)); 735 ASSERT_TRUE(file_util::GetFileInfo(login_db_file, &db_file_end_info));
736 EXPECT_EQ(db_file_start_info.size, db_file_end_info.size); 736 EXPECT_EQ(db_file_start_info.size, db_file_end_info.size);
737 } 737 }
738 738
739 STLDeleteElements(&expected_autofillable); 739 STLDeleteElements(&expected_autofillable);
740 STLDeleteElements(&expected_blacklisted); 740 STLDeleteElements(&expected_blacklisted);
741 741
742 // Public in PasswordStore, protected in PasswordStoreX. 742 // Public in PasswordStore, protected in PasswordStoreX.
743 static_cast<PasswordStore*>(store)->Shutdown(); 743 static_cast<PasswordStore*>(store)->ShutdownOnUIThread();
744 } 744 }
745 745
746 INSTANTIATE_TEST_CASE_P(NoBackend, 746 INSTANTIATE_TEST_CASE_P(NoBackend,
747 PasswordStoreXTest, 747 PasswordStoreXTest,
748 testing::Values(NO_BACKEND)); 748 testing::Values(NO_BACKEND));
749 INSTANTIATE_TEST_CASE_P(FailingBackend, 749 INSTANTIATE_TEST_CASE_P(FailingBackend,
750 PasswordStoreXTest, 750 PasswordStoreXTest,
751 testing::Values(FAILING_BACKEND)); 751 testing::Values(FAILING_BACKEND));
752 INSTANTIATE_TEST_CASE_P(WorkingBackend, 752 INSTANTIATE_TEST_CASE_P(WorkingBackend,
753 PasswordStoreXTest, 753 PasswordStoreXTest,
754 testing::Values(WORKING_BACKEND)); 754 testing::Values(WORKING_BACKEND));
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_win_unittest.cc ('k') | chrome/browser/profiles/off_the_record_profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698