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/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
9 #include "chrome/browser/keychain_mock_mac.h" | 9 #include "chrome/browser/keychain_mock_mac.h" |
10 #include "chrome/browser/password_manager/password_store_mac.h" | 10 #include "chrome/browser/password_manager/password_store_mac.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 2000, 1, 1, 0, 0, 0 }, | 225 2000, 1, 1, 0, 0, 0 }, |
226 { PasswordForm::SCHEME_HTML, "https://dont.remember.com/", | 226 { PasswordForm::SCHEME_HTML, "https://dont.remember.com/", |
227 "https://dont.remember.com/", NULL, NULL, true, | 227 "https://dont.remember.com/", NULL, NULL, true, |
228 2000, 1, 1, 0, 0, 0 }, | 228 2000, 1, 1, 0, 0, 0 }, |
229 { PasswordForm::SCHEME_BASIC, "http://some.domain.com:4567/low_security", | 229 { PasswordForm::SCHEME_BASIC, "http://some.domain.com:4567/low_security", |
230 "http://some.domain.com:4567/insecure.html", L"basic_auth_user", L"basic", | 230 "http://some.domain.com:4567/insecure.html", L"basic_auth_user", L"basic", |
231 false, 1998, 03, 30, 10, 00, 00 }, | 231 false, 1998, 03, 30, 10, 00, 00 }, |
232 { PasswordForm::SCHEME_DIGEST, "https://some.domain.com/high_security", | 232 { PasswordForm::SCHEME_DIGEST, "https://some.domain.com/high_security", |
233 "https://some.domain.com/", L"digest_auth_user", L"digest", true, | 233 "https://some.domain.com/", L"digest_auth_user", L"digest", true, |
234 1998, 3, 30, 10, 0, 0 }, | 234 1998, 3, 30, 10, 0, 0 }, |
| 235 // This one gives us an invalid date, which we will treat as a "NULL" date |
| 236 // which is 1601. |
235 { PasswordForm::SCHEME_OTHER, "http://a.server.com/", | 237 { PasswordForm::SCHEME_OTHER, "http://a.server.com/", |
236 "http://a.server.com/", L"abc", L"123", false, | 238 "http://a.server.com/", L"abc", L"123", false, |
237 1970, 1, 1, 0, 0, 0 }, | 239 1601, 1, 1, 0, 0, 0 }, |
238 }; | 240 }; |
239 | 241 |
240 for (unsigned int i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { | 242 for (unsigned int i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { |
241 // Create our fake KeychainItemRef; see MockKeychain docs. | 243 // Create our fake KeychainItemRef; see MockKeychain docs. |
242 SecKeychainItemRef keychain_item = | 244 SecKeychainItemRef keychain_item = |
243 reinterpret_cast<SecKeychainItemRef>(i + 1); | 245 reinterpret_cast<SecKeychainItemRef>(i + 1); |
244 PasswordForm form; | 246 PasswordForm form; |
245 bool parsed = internal_keychain_helpers::FillPasswordFormFromKeychainItem( | 247 bool parsed = internal_keychain_helpers::FillPasswordFormFromKeychainItem( |
246 *keychain_, keychain_item, &form); | 248 *keychain_, keychain_item, &form); |
247 | 249 |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 std::vector<PasswordForm*> all_passwords = | 847 std::vector<PasswordForm*> all_passwords = |
846 keychain_adapter.GetAllPasswordFormPasswords(); | 848 keychain_adapter.GetAllPasswordFormPasswords(); |
847 EXPECT_EQ(8 + arraysize(owned_password_data), all_passwords.size()); | 849 EXPECT_EQ(8 + arraysize(owned_password_data), all_passwords.size()); |
848 STLDeleteElements(&all_passwords); | 850 STLDeleteElements(&all_passwords); |
849 | 851 |
850 std::vector<PasswordForm*> owned_passwords = | 852 std::vector<PasswordForm*> owned_passwords = |
851 owned_keychain_adapter.GetAllPasswordFormPasswords(); | 853 owned_keychain_adapter.GetAllPasswordFormPasswords(); |
852 EXPECT_EQ(arraysize(owned_password_data), owned_passwords.size()); | 854 EXPECT_EQ(arraysize(owned_password_data), owned_passwords.size()); |
853 STLDeleteElements(&owned_passwords); | 855 STLDeleteElements(&owned_passwords); |
854 } | 856 } |
OLD | NEW |