OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "testing/gmock/include/gmock/gmock.h" | 5 #include "testing/gmock/include/gmock/gmock.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 for (unsigned int i = 0; i < ARRAYSIZE_UNSAFE(db_data); ++i) { | 845 for (unsigned int i = 0; i < ARRAYSIZE_UNSAFE(db_data); ++i) { |
846 database_forms.push_back(CreatePasswordFormFromData(db_data[i])); | 846 database_forms.push_back(CreatePasswordFormFromData(db_data[i])); |
847 } | 847 } |
848 std::vector<PasswordForm*> merged_forms = | 848 std::vector<PasswordForm*> merged_forms = |
849 internal_keychain_helpers::GetPasswordsForForms(*keychain_, | 849 internal_keychain_helpers::GetPasswordsForForms(*keychain_, |
850 &database_forms); | 850 &database_forms); |
851 EXPECT_EQ(2U, database_forms.size()); | 851 EXPECT_EQ(2U, database_forms.size()); |
852 ASSERT_EQ(3U, merged_forms.size()); | 852 ASSERT_EQ(3U, merged_forms.size()); |
853 EXPECT_EQ(ASCIIToUTF16("sekrit"), merged_forms[0]->password_value); | 853 EXPECT_EQ(ASCIIToUTF16("sekrit"), merged_forms[0]->password_value); |
854 EXPECT_EQ(ASCIIToUTF16("sekrit"), merged_forms[1]->password_value); | 854 EXPECT_EQ(ASCIIToUTF16("sekrit"), merged_forms[1]->password_value); |
855 EXPECT_EQ(true, merged_forms[2]->blacklisted_by_user); | 855 EXPECT_TRUE(merged_forms[2]->blacklisted_by_user); |
856 | 856 |
857 STLDeleteElements(&database_forms); | 857 STLDeleteElements(&database_forms); |
858 STLDeleteElements(&merged_forms); | 858 STLDeleteElements(&merged_forms); |
859 } | 859 } |
860 | 860 |
861 TEST_F(PasswordStoreMacInternalsTest, TestPasswordGetAll) { | 861 TEST_F(PasswordStoreMacInternalsTest, TestPasswordGetAll) { |
862 MacKeychainPasswordFormAdapter keychain_adapter(keychain_); | 862 MacKeychainPasswordFormAdapter keychain_adapter(keychain_); |
863 MacKeychainPasswordFormAdapter owned_keychain_adapter(keychain_); | 863 MacKeychainPasswordFormAdapter owned_keychain_adapter(keychain_); |
864 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); | 864 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); |
865 | 865 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 EXPECT_EQ(0U, matching_items.size()) << "iteration " << i; | 1015 EXPECT_EQ(0U, matching_items.size()) << "iteration " << i; |
1016 } | 1016 } |
1017 STLDeleteElements(&matching_items); | 1017 STLDeleteElements(&matching_items); |
1018 | 1018 |
1019 login_db_->GetLogins(*query_form, &matching_items); | 1019 login_db_->GetLogins(*query_form, &matching_items); |
1020 EXPECT_EQ(updates[i].password ? 1U : 0U, matching_items.size()) | 1020 EXPECT_EQ(updates[i].password ? 1U : 0U, matching_items.size()) |
1021 << "iteration " << i; | 1021 << "iteration " << i; |
1022 STLDeleteElements(&matching_items); | 1022 STLDeleteElements(&matching_items); |
1023 } | 1023 } |
1024 } | 1024 } |
OLD | NEW |