OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/password_manager/core/browser/login_database.h" | 5 #include "components/password_manager/core/browser/login_database.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "components/autofill/core/common/password_form.h" | 23 #include "components/autofill/core/common/password_form.h" |
24 #include "components/os_crypt/os_crypt_mocker.h" | 24 #include "components/os_crypt/os_crypt_mocker.h" |
25 #include "components/password_manager/core/browser/psl_matching_helper.h" | 25 #include "components/password_manager/core/browser/psl_matching_helper.h" |
26 #include "sql/connection.h" | 26 #include "sql/connection.h" |
27 #include "sql/statement.h" | 27 #include "sql/statement.h" |
28 #include "sql/test/test_helpers.h" | 28 #include "sql/test/test_helpers.h" |
29 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
31 #include "url/origin.h" | 31 #include "url/origin.h" |
32 | 32 |
33 #if defined(OS_IOS) | |
34 #include "base/ios/ios_util.h" | |
35 #endif | |
36 | |
37 using autofill::PasswordForm; | 33 using autofill::PasswordForm; |
38 using base::ASCIIToUTF16; | 34 using base::ASCIIToUTF16; |
39 using ::testing::Eq; | 35 using ::testing::Eq; |
40 | 36 |
41 namespace password_manager { | 37 namespace password_manager { |
42 namespace { | 38 namespace { |
43 PasswordStoreChangeList AddChangeForForm(const PasswordForm& form) { | 39 PasswordStoreChangeList AddChangeForForm(const PasswordForm& form) { |
44 return PasswordStoreChangeList( | 40 return PasswordStoreChangeList( |
45 1, PasswordStoreChange(PasswordStoreChange::ADD, form)); | 41 1, PasswordStoreChange(PasswordStoreChange::ADD, form)); |
46 } | 42 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Clear state. | 203 // Clear state. |
208 db().RemoveLoginsCreatedBetween(now, base::Time()); | 204 db().RemoveLoginsCreatedBetween(now, base::Time()); |
209 } | 205 } |
210 | 206 |
211 base::ScopedTempDir temp_dir_; | 207 base::ScopedTempDir temp_dir_; |
212 base::FilePath file_; | 208 base::FilePath file_; |
213 std::unique_ptr<LoginDatabase> db_; | 209 std::unique_ptr<LoginDatabase> db_; |
214 }; | 210 }; |
215 | 211 |
216 TEST_F(LoginDatabaseTest, Logins) { | 212 TEST_F(LoginDatabaseTest, Logins) { |
217 #if defined(OS_IOS) && TARGET_IPHONE_SIMULATOR | |
218 // TODO(crbug.com/619982): This test is currently failing on the latest iOS10 | |
219 // simulator due to a bug we expect to be fixed shortly. Temporarilly | |
220 // disabling the test for iOS10 simulator runs only. | |
221 if (base::ios::IsRunningOnIOS10OrLater()) { | |
222 return; | |
223 } | |
224 #endif | |
225 ScopedVector<autofill::PasswordForm> result; | 213 ScopedVector<autofill::PasswordForm> result; |
226 | 214 |
227 // Verify the database is empty. | 215 // Verify the database is empty. |
228 EXPECT_TRUE(db().GetAutofillableLogins(&result)); | 216 EXPECT_TRUE(db().GetAutofillableLogins(&result)); |
229 EXPECT_EQ(0U, result.size()); | 217 EXPECT_EQ(0U, result.size()); |
230 | 218 |
231 // Example password form. | 219 // Example password form. |
232 PasswordForm form; | 220 PasswordForm form; |
233 GenerateExamplePasswordForm(&form); | 221 GenerateExamplePasswordForm(&form); |
234 | 222 |
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1667 LoginDatabaseMigrationTest, | 1655 LoginDatabaseMigrationTest, |
1668 testing::Range(1, kCurrentVersionNumber + 1)); | 1656 testing::Range(1, kCurrentVersionNumber + 1)); |
1669 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, | 1657 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, |
1670 LoginDatabaseMigrationTestV9, | 1658 LoginDatabaseMigrationTestV9, |
1671 testing::Values(9)); | 1659 testing::Values(9)); |
1672 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, | 1660 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, |
1673 LoginDatabaseMigrationTestBroken, | 1661 LoginDatabaseMigrationTestBroken, |
1674 testing::Range(1, 4)); | 1662 testing::Range(1, 4)); |
1675 | 1663 |
1676 } // namespace password_manager | 1664 } // namespace password_manager |
OLD | NEW |