summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscr@chromium.org <scr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 18:40:26 +0000
committerscr@chromium.org <scr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 18:40:26 +0000
commit776c05d1347784290de3751bb753439204247591 (patch)
tree0d33a00a92609befec679c868f43aca767ee5c29
parent3ea60637f9c24092c7d9296a4ff7a68017547ba3 (diff)
downloadchromium_src-776c05d1347784290de3751bb753439204247591.zip
chromium_src-776c05d1347784290de3751bb753439204247591.tar.gz
chromium_src-776c05d1347784290de3751bb753439204247591.tar.bz2
Added unit tests for pieces which broke before.
BUG=78723 TEST=unit_tests --gtest_filter=PasswordStore*.*, then manually removed fix, ran again and caught exception. Review URL: http://codereview.chromium.org/6816046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80964 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/password_manager/password_store_win_unittest.cc77
1 files changed, 77 insertions, 0 deletions
diff --git a/chrome/browser/password_manager/password_store_win_unittest.cc b/chrome/browser/password_manager/password_store_win_unittest.cc
index 4031e7f..98ad2be 100644
--- a/chrome/browser/password_manager/password_store_win_unittest.cc
+++ b/chrome/browser/password_manager/password_store_win_unittest.cc
@@ -505,3 +505,80 @@ TEST_F(PasswordStoreWinTest, Migration) {
STLDeleteElements(&expected_autofillable);
STLDeleteElements(&expected_blacklisted);
}
+
+TEST_F(PasswordStoreWinTest, EmptyLogins) {
+ scoped_refptr<PasswordStoreWin> store(
+ new PasswordStoreWin(login_db_.release(), profile_.get(), wds_.get()));
+ store->Init();
+
+ PasswordFormData form_data = {
+ PasswordForm::SCHEME_HTML,
+ "http://example.com/",
+ "http://example.com/origin",
+ "http://example.com/action",
+ L"submit_element",
+ L"username_element",
+ L"password_element",
+ L"",
+ L"",
+ true, false, 1,
+ };
+ scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data));
+
+ MockPasswordStoreConsumer consumer;
+
+ // Make sure we quit the MessageLoop even if the test fails.
+ ON_CALL(consumer, OnPasswordStoreRequestDone(_, _))
+ .WillByDefault(QuitUIMessageLoop());
+
+ VectorOfForms expect_none;
+ // expect that we get no results;
+ EXPECT_CALL(consumer, OnPasswordStoreRequestDone(
+ _, ContainsAllPasswordForms(expect_none)))
+ .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop()));
+
+ store->GetLogins(*form, &consumer);
+ MessageLoop::current()->Run();
+}
+
+TEST_F(PasswordStoreWinTest, EmptyBlacklistLogins) {
+ scoped_refptr<PasswordStoreWin> store(
+ new PasswordStoreWin(login_db_.release(), profile_.get(), wds_.get()));
+ store->Init();
+
+ MockPasswordStoreConsumer consumer;
+
+ // Make sure we quit the MessageLoop even if the test fails.
+ ON_CALL(consumer, OnPasswordStoreRequestDone(_, _))
+ .WillByDefault(QuitUIMessageLoop());
+
+ VectorOfForms expect_none;
+ // expect that we get no results;
+ EXPECT_CALL(consumer, OnPasswordStoreRequestDone(
+ _, ContainsAllPasswordForms(expect_none)))
+ .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop()));
+
+ store->GetBlacklistLogins(&consumer);
+ MessageLoop::current()->Run();
+}
+
+TEST_F(PasswordStoreWinTest, EmptyAutofillableLogins) {
+ scoped_refptr<PasswordStoreWin> store(
+ new PasswordStoreWin(login_db_.release(), profile_.get(), wds_.get()));
+ store->Init();
+
+ MockPasswordStoreConsumer consumer;
+
+ // Make sure we quit the MessageLoop even if the test fails.
+ ON_CALL(consumer, OnPasswordStoreRequestDone(_, _))
+ .WillByDefault(QuitUIMessageLoop());
+
+ VectorOfForms expect_none;
+ // expect that we get no results;
+ EXPECT_CALL(consumer, OnPasswordStoreRequestDone(
+ _, ContainsAllPasswordForms(expect_none)))
+ .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop()));
+
+ store->GetAutofillableLogins(&consumer);
+ MessageLoop::current()->Run();
+}