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 "chrome/browser/password_manager/password_store_mac.h" | 5 #include "chrome/browser/password_manager/password_store_mac.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 } // namespace | 1771 } // namespace |
1772 | 1772 |
1773 TEST_F(PasswordStoreMacTest, TestRemoveLoginsCreatedBetween) { | 1773 TEST_F(PasswordStoreMacTest, TestRemoveLoginsCreatedBetween) { |
1774 CheckRemoveLoginsBetween(this, true); | 1774 CheckRemoveLoginsBetween(this, true); |
1775 } | 1775 } |
1776 | 1776 |
1777 TEST_F(PasswordStoreMacTest, TestRemoveLoginsSyncedBetween) { | 1777 TEST_F(PasswordStoreMacTest, TestRemoveLoginsSyncedBetween) { |
1778 CheckRemoveLoginsBetween(this, false); | 1778 CheckRemoveLoginsBetween(this, false); |
1779 } | 1779 } |
1780 | 1780 |
1781 TEST_F(PasswordStoreMacTest, TestDisableAutoSignInForAllLogins) { | 1781 TEST_F(PasswordStoreMacTest, TestDisableAutoSignInForOrigins) { |
1782 PasswordFormData www_form_data_facebook = { | 1782 PasswordFormData www_form_data_facebook = { |
1783 PasswordForm::SCHEME_HTML, | 1783 PasswordForm::SCHEME_HTML, |
1784 "http://www.facebook.com/", | 1784 "http://www.facebook.com/", |
1785 "http://www.facebook.com/index.html", | 1785 "http://www.facebook.com/index.html", |
1786 "login", | 1786 "login", |
1787 L"submit", | 1787 L"submit", |
1788 L"username", | 1788 L"username", |
1789 L"password", | 1789 L"password", |
1790 L"joe_user", | 1790 L"joe_user", |
1791 L"sekrit", | 1791 L"sekrit", |
1792 true, | 1792 true, |
1793 false, | 1793 false, |
1794 0}; | 1794 0}; |
1795 std::unique_ptr<PasswordForm> form_facebook = | 1795 std::unique_ptr<PasswordForm> form_facebook = |
1796 CreatePasswordFormFromDataForTesting(www_form_data_facebook); | 1796 CreatePasswordFormFromDataForTesting(www_form_data_facebook); |
1797 form_facebook->skip_zero_click = false; | 1797 form_facebook->skip_zero_click = false; |
1798 | 1798 |
1799 // Add the zero-clickable form to the database. | 1799 PasswordFormData www_form_data_google = { |
| 1800 PasswordForm::SCHEME_HTML, |
| 1801 "http://www.google.com/", |
| 1802 "http://www.google.com/foo/bar/index.html", |
| 1803 "login", |
| 1804 L"submit", |
| 1805 L"username", |
| 1806 L"password", |
| 1807 L"joe_user", |
| 1808 L"sekrit", |
| 1809 true, |
| 1810 false, |
| 1811 0}; |
| 1812 std::unique_ptr<PasswordForm> form_google = |
| 1813 CreatePasswordFormFromDataForTesting(www_form_data_google); |
| 1814 form_google->skip_zero_click = false; |
| 1815 |
| 1816 // Add the zero-clickable forms to the database. |
1800 PasswordsChangeObserver observer(store()); | 1817 PasswordsChangeObserver observer(store()); |
1801 store()->AddLogin(*form_facebook); | 1818 store()->AddLogin(*form_facebook); |
| 1819 store()->AddLogin(*form_google); |
1802 EXPECT_CALL(observer, OnLoginsChanged(GetAddChangeList(*form_facebook))); | 1820 EXPECT_CALL(observer, OnLoginsChanged(GetAddChangeList(*form_facebook))); |
| 1821 EXPECT_CALL(observer, OnLoginsChanged(GetAddChangeList(*form_google))); |
1803 observer.WaitAndVerify(this); | 1822 observer.WaitAndVerify(this); |
1804 | 1823 |
1805 ScopedVector<autofill::PasswordForm> forms; | 1824 ScopedVector<autofill::PasswordForm> forms; |
1806 EXPECT_TRUE(login_db()->GetAutoSignInLogins(&forms)); | 1825 EXPECT_TRUE(login_db()->GetAutoSignInLogins(&forms)); |
1807 EXPECT_EQ(1u, forms.size()); | 1826 EXPECT_EQ(2u, forms.size()); |
1808 EXPECT_FALSE(forms[0]->skip_zero_click); | 1827 EXPECT_FALSE(forms[0]->skip_zero_click); |
| 1828 EXPECT_FALSE(forms[1]->skip_zero_click); |
1809 | 1829 |
1810 store()->DisableAutoSignInForAllLogins(base::Closure()); | 1830 store()->DisableAutoSignInForOrigins( |
| 1831 base::Bind(&GURL::operator==, base::Unretained(&form_google->origin)), |
| 1832 base::Closure()); |
1811 FinishAsyncProcessing(); | 1833 FinishAsyncProcessing(); |
1812 | 1834 |
1813 EXPECT_TRUE(login_db()->GetAutoSignInLogins(&forms)); | 1835 EXPECT_TRUE(login_db()->GetAutoSignInLogins(&forms)); |
1814 EXPECT_EQ(0u, forms.size()); | 1836 EXPECT_EQ(1u, forms.size()); |
| 1837 EXPECT_EQ(form_facebook->origin, forms[0]->origin); |
1815 } | 1838 } |
1816 | 1839 |
1817 TEST_F(PasswordStoreMacTest, TestRemoveLoginsMultiProfile) { | 1840 TEST_F(PasswordStoreMacTest, TestRemoveLoginsMultiProfile) { |
1818 // Make sure that RemoveLoginsCreatedBetween does affect only the correct | 1841 // Make sure that RemoveLoginsCreatedBetween does affect only the correct |
1819 // profile. | 1842 // profile. |
1820 | 1843 |
1821 // Add a third-party password. | 1844 // Add a third-party password. |
1822 MockAppleKeychain::KeychainTestData keychain_data = { | 1845 MockAppleKeychain::KeychainTestData keychain_data = { |
1823 kSecAuthenticationTypeHTMLForm, | 1846 kSecAuthenticationTypeHTMLForm, |
1824 "some.domain.com", | 1847 "some.domain.com", |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 histogram_tester_->ExpectUniqueSample( | 2111 histogram_tester_->ExpectUniqueSample( |
2089 "PasswordManager.KeychainMigration.NumPasswordsOnFailure", 1, 1); | 2112 "PasswordManager.KeychainMigration.NumPasswordsOnFailure", 1, 1); |
2090 histogram_tester_->ExpectUniqueSample( | 2113 histogram_tester_->ExpectUniqueSample( |
2091 "PasswordManager.KeychainMigration.NumFailedPasswords", 1, 1); | 2114 "PasswordManager.KeychainMigration.NumFailedPasswords", 1, 1); |
2092 histogram_tester_->ExpectUniqueSample( | 2115 histogram_tester_->ExpectUniqueSample( |
2093 "PasswordManager.KeychainMigration.NumChromeOwnedInaccessiblePasswords", | 2116 "PasswordManager.KeychainMigration.NumChromeOwnedInaccessiblePasswords", |
2094 2, 1); | 2117 2, 1); |
2095 // Don't test the encryption key access. | 2118 // Don't test the encryption key access. |
2096 histogram_tester_.reset(); | 2119 histogram_tester_.reset(); |
2097 } | 2120 } |
OLD | NEW |