| 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/files/file_util.h" | 8 #include "base/files/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 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 // Serialization routines for vectors implemented in login_database.cc. | 39 // Serialization routines for vectors implemented in login_database.cc. |
| 40 Pickle SerializeVector(const std::vector<base::string16>& vec); | 40 Pickle SerializeVector(const std::vector<base::string16>& vec); |
| 41 std::vector<base::string16> DeserializeVector(const Pickle& pickle); | 41 std::vector<base::string16> DeserializeVector(const Pickle& pickle); |
| 42 | 42 |
| 43 class LoginDatabaseTest : public testing::Test { | 43 class LoginDatabaseTest : public testing::Test { |
| 44 protected: | 44 protected: |
| 45 virtual void SetUp() { | 45 void SetUp() override { |
| 46 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 46 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 47 file_ = temp_dir_.path().AppendASCII("TestMetadataStoreMacDatabase"); | 47 file_ = temp_dir_.path().AppendASCII("TestMetadataStoreMacDatabase"); |
| 48 | 48 |
| 49 ASSERT_TRUE(db_.Init(file_)); | 49 ASSERT_TRUE(db_.Init(file_)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void FormsAreEqual(const PasswordForm& expected, const PasswordForm& actual) { | 52 void FormsAreEqual(const PasswordForm& expected, const PasswordForm& actual) { |
| 53 PasswordForm expected_copy(expected); | 53 PasswordForm expected_copy(expected); |
| 54 #if defined(OS_MACOSX) && !defined(OS_IOS) | 54 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 55 // On the Mac we should never be storing passwords in the database. | 55 // On the Mac we should never be storing passwords in the database. |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 // This tests that sql::Connection::set_restrict_to_user() was called, | 957 // This tests that sql::Connection::set_restrict_to_user() was called, |
| 958 // and that function is a noop on non-POSIX platforms in any case. | 958 // and that function is a noop on non-POSIX platforms in any case. |
| 959 TEST_F(LoginDatabaseTest, FilePermissions) { | 959 TEST_F(LoginDatabaseTest, FilePermissions) { |
| 960 int mode = base::FILE_PERMISSION_MASK; | 960 int mode = base::FILE_PERMISSION_MASK; |
| 961 EXPECT_TRUE(base::GetPosixFilePermissions(file_, &mode)); | 961 EXPECT_TRUE(base::GetPosixFilePermissions(file_, &mode)); |
| 962 EXPECT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode); | 962 EXPECT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode); |
| 963 } | 963 } |
| 964 #endif // defined(OS_POSIX) | 964 #endif // defined(OS_POSIX) |
| 965 | 965 |
| 966 } // namespace password_manager | 966 } // namespace password_manager |
| OLD | NEW |