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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 form.username_value = ASCIIToUTF16("test@gmail.com"); | 127 form.username_value = ASCIIToUTF16("test@gmail.com"); |
128 form.password_element = ASCIIToUTF16("Passwd"); | 128 form.password_element = ASCIIToUTF16("Passwd"); |
129 form.password_value = ASCIIToUTF16("test"); | 129 form.password_value = ASCIIToUTF16("test"); |
130 form.submit_element = ASCIIToUTF16("signIn"); | 130 form.submit_element = ASCIIToUTF16("signIn"); |
131 form.signon_realm = "http://www.google.com/"; | 131 form.signon_realm = "http://www.google.com/"; |
132 form.ssl_valid = false; | 132 form.ssl_valid = false; |
133 form.preferred = false; | 133 form.preferred = false; |
134 form.scheme = PasswordForm::SCHEME_HTML; | 134 form.scheme = PasswordForm::SCHEME_HTML; |
135 form.times_used = 1; | 135 form.times_used = 1; |
136 form.form_data.name = ASCIIToUTF16("form_name"); | 136 form.form_data.name = ASCIIToUTF16("form_name"); |
137 form.form_data.method = ASCIIToUTF16("POST"); | |
138 form.date_synced = base::Time::Now(); | 137 form.date_synced = base::Time::Now(); |
139 | 138 |
140 // Add it and make sure it is there and that all the fields were retrieved | 139 // Add it and make sure it is there and that all the fields were retrieved |
141 // correctly. | 140 // correctly. |
142 EXPECT_EQ(AddChangeForForm(form), db_.AddLogin(form)); | 141 EXPECT_EQ(AddChangeForForm(form), db_.AddLogin(form)); |
143 EXPECT_TRUE(db_.GetAutofillableLogins(&result)); | 142 EXPECT_TRUE(db_.GetAutofillableLogins(&result)); |
144 ASSERT_EQ(1U, result.size()); | 143 ASSERT_EQ(1U, result.size()); |
145 FormsAreEqual(form, *result[0]); | 144 FormsAreEqual(form, *result[0]); |
146 delete result[0]; | 145 delete result[0]; |
147 result.clear(); | 146 result.clear(); |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 // This tests that sql::Connection::set_restrict_to_user() was called, | 946 // This tests that sql::Connection::set_restrict_to_user() was called, |
948 // and that function is a noop on non-POSIX platforms in any case. | 947 // and that function is a noop on non-POSIX platforms in any case. |
949 TEST_F(LoginDatabaseTest, FilePermissions) { | 948 TEST_F(LoginDatabaseTest, FilePermissions) { |
950 int mode = base::FILE_PERMISSION_MASK; | 949 int mode = base::FILE_PERMISSION_MASK; |
951 EXPECT_TRUE(base::GetPosixFilePermissions(file_, &mode)); | 950 EXPECT_TRUE(base::GetPosixFilePermissions(file_, &mode)); |
952 EXPECT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode); | 951 EXPECT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode); |
953 } | 952 } |
954 #endif // defined(OS_POSIX) | 953 #endif // defined(OS_POSIX) |
955 | 954 |
956 } // namespace password_manager | 955 } // namespace password_manager |
OLD | NEW |