| 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 |
| 33 using autofill::PasswordForm; | 37 using autofill::PasswordForm; |
| 34 using base::ASCIIToUTF16; | 38 using base::ASCIIToUTF16; |
| 35 using ::testing::Eq; | 39 using ::testing::Eq; |
| 36 | 40 |
| 37 namespace password_manager { | 41 namespace password_manager { |
| 38 namespace { | 42 namespace { |
| 39 PasswordStoreChangeList AddChangeForForm(const PasswordForm& form) { | 43 PasswordStoreChangeList AddChangeForForm(const PasswordForm& form) { |
| 40 return PasswordStoreChangeList( | 44 return PasswordStoreChangeList( |
| 41 1, PasswordStoreChange(PasswordStoreChange::ADD, form)); | 45 1, PasswordStoreChange(PasswordStoreChange::ADD, form)); |
| 42 } | 46 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // Clear state. | 207 // Clear state. |
| 204 db().RemoveLoginsCreatedBetween(now, base::Time()); | 208 db().RemoveLoginsCreatedBetween(now, base::Time()); |
| 205 } | 209 } |
| 206 | 210 |
| 207 base::ScopedTempDir temp_dir_; | 211 base::ScopedTempDir temp_dir_; |
| 208 base::FilePath file_; | 212 base::FilePath file_; |
| 209 std::unique_ptr<LoginDatabase> db_; | 213 std::unique_ptr<LoginDatabase> db_; |
| 210 }; | 214 }; |
| 211 | 215 |
| 212 TEST_F(LoginDatabaseTest, Logins) { | 216 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 |
| 213 ScopedVector<autofill::PasswordForm> result; | 225 ScopedVector<autofill::PasswordForm> result; |
| 214 | 226 |
| 215 // Verify the database is empty. | 227 // Verify the database is empty. |
| 216 EXPECT_TRUE(db().GetAutofillableLogins(&result)); | 228 EXPECT_TRUE(db().GetAutofillableLogins(&result)); |
| 217 EXPECT_EQ(0U, result.size()); | 229 EXPECT_EQ(0U, result.size()); |
| 218 | 230 |
| 219 // Example password form. | 231 // Example password form. |
| 220 PasswordForm form; | 232 PasswordForm form; |
| 221 GenerateExamplePasswordForm(&form); | 233 GenerateExamplePasswordForm(&form); |
| 222 | 234 |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 LoginDatabaseMigrationTest, | 1667 LoginDatabaseMigrationTest, |
| 1656 testing::Range(1, kCurrentVersionNumber + 1)); | 1668 testing::Range(1, kCurrentVersionNumber + 1)); |
| 1657 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, | 1669 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, |
| 1658 LoginDatabaseMigrationTestV9, | 1670 LoginDatabaseMigrationTestV9, |
| 1659 testing::Values(9)); | 1671 testing::Values(9)); |
| 1660 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, | 1672 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, |
| 1661 LoginDatabaseMigrationTestBroken, | 1673 LoginDatabaseMigrationTestBroken, |
| 1662 testing::Range(1, 4)); | 1674 testing::Range(1, 4)); |
| 1663 | 1675 |
| 1664 } // namespace password_manager | 1676 } // namespace password_manager |
| OLD | NEW |