diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-27 23:22:08 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-27 23:22:08 +0000 |
commit | b264eab5d4331e19d04f5822be50c88c61b58267 (patch) | |
tree | f419df89f0e49df6cfa3f161062526d8ee648f6e /sql | |
parent | caaa849e2e0cc9caf9a2fe938e43515c35bfa679 (diff) | |
download | chromium_src-b264eab5d4331e19d04f5822be50c88c61b58267.zip chromium_src-b264eab5d4331e19d04f5822be50c88c61b58267.tar.gz chromium_src-b264eab5d4331e19d04f5822be50c88c61b58267.tar.bz2 |
Move Posix file utils to the base namespace.
BUG=
R=rvargas@chromium.org
Review URL: https://codereview.chromium.org/89523002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237642 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sql')
-rw-r--r-- | sql/connection.cc | 10 | ||||
-rw-r--r-- | sql/connection_unittest.cc | 36 |
2 files changed, 23 insertions, 23 deletions
diff --git a/sql/connection.cc b/sql/connection.cc index 0f40779..6ca60ef 100644 --- a/sql/connection.cc +++ b/sql/connection.cc @@ -881,9 +881,9 @@ bool Connection::OpenInternal(const std::string& file_name, int mode = 0; // TODO(shess): Arguably, failure to retrieve and change // permissions should be fatal if the file exists. - if (file_util::GetPosixFilePermissions(file_path, &mode)) { - mode &= file_util::FILE_PERMISSION_USER_MASK; - file_util::SetPosixFilePermissions(file_path, mode); + if (base::GetPosixFilePermissions(file_path, &mode)) { + mode &= base::FILE_PERMISSION_USER_MASK; + base::SetPosixFilePermissions(file_path, mode); // SQLite sets the permissions on these files from the main // database on create. Set them here in case they already exist @@ -891,8 +891,8 @@ bool Connection::OpenInternal(const std::string& file_name, // be fatal unless the file doesn't exist. base::FilePath journal_path(file_name + FILE_PATH_LITERAL("-journal")); base::FilePath wal_path(file_name + FILE_PATH_LITERAL("-wal")); - file_util::SetPosixFilePermissions(journal_path, mode); - file_util::SetPosixFilePermissions(wal_path, mode); + base::SetPosixFilePermissions(journal_path, mode); + base::SetPosixFilePermissions(wal_path, mode); } } #endif // defined(OS_POSIX) diff --git a/sql/connection_unittest.cc b/sql/connection_unittest.cc index 5ffc26a..c6811b4 100644 --- a/sql/connection_unittest.cc +++ b/sql/connection_unittest.cc @@ -689,12 +689,12 @@ TEST_F(SQLConnectionTest, UserPermission) { // read access for the database and journal. ASSERT_TRUE(base::PathExists(db_path())); ASSERT_TRUE(base::PathExists(journal)); - mode = file_util::FILE_PERMISSION_MASK; - EXPECT_TRUE(file_util::GetPosixFilePermissions(db_path(), &mode)); - ASSERT_NE((mode & file_util::FILE_PERMISSION_USER_MASK), mode); - mode = file_util::FILE_PERMISSION_MASK; - EXPECT_TRUE(file_util::GetPosixFilePermissions(journal, &mode)); - ASSERT_NE((mode & file_util::FILE_PERMISSION_USER_MASK), mode); + mode = base::FILE_PERMISSION_MASK; + EXPECT_TRUE(base::GetPosixFilePermissions(db_path(), &mode)); + ASSERT_NE((mode & base::FILE_PERMISSION_USER_MASK), mode); + mode = base::FILE_PERMISSION_MASK; + EXPECT_TRUE(base::GetPosixFilePermissions(journal, &mode)); + ASSERT_NE((mode & base::FILE_PERMISSION_USER_MASK), mode); // Re-open with restricted permissions and verify that the modes // changed for both the main database and the journal. @@ -703,12 +703,12 @@ TEST_F(SQLConnectionTest, UserPermission) { ASSERT_TRUE(db().Open(db_path())); ASSERT_TRUE(base::PathExists(db_path())); ASSERT_TRUE(base::PathExists(journal)); - mode = file_util::FILE_PERMISSION_MASK; - EXPECT_TRUE(file_util::GetPosixFilePermissions(db_path(), &mode)); - ASSERT_EQ((mode & file_util::FILE_PERMISSION_USER_MASK), mode); - mode = file_util::FILE_PERMISSION_MASK; - EXPECT_TRUE(file_util::GetPosixFilePermissions(journal, &mode)); - ASSERT_EQ((mode & file_util::FILE_PERMISSION_USER_MASK), mode); + mode = base::FILE_PERMISSION_MASK; + EXPECT_TRUE(base::GetPosixFilePermissions(db_path(), &mode)); + ASSERT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode); + mode = base::FILE_PERMISSION_MASK; + EXPECT_TRUE(base::GetPosixFilePermissions(journal, &mode)); + ASSERT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode); // Delete and re-create the database, the restriction should still apply. db().Close(); @@ -716,16 +716,16 @@ TEST_F(SQLConnectionTest, UserPermission) { ASSERT_TRUE(db().Open(db_path())); ASSERT_TRUE(base::PathExists(db_path())); ASSERT_FALSE(base::PathExists(journal)); - mode = file_util::FILE_PERMISSION_MASK; - EXPECT_TRUE(file_util::GetPosixFilePermissions(db_path(), &mode)); - ASSERT_EQ((mode & file_util::FILE_PERMISSION_USER_MASK), mode); + mode = base::FILE_PERMISSION_MASK; + EXPECT_TRUE(base::GetPosixFilePermissions(db_path(), &mode)); + ASSERT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode); // Verify that journal creation inherits the restriction. EXPECT_TRUE(db().Execute("CREATE TABLE x (x)")); ASSERT_TRUE(base::PathExists(journal)); - mode = file_util::FILE_PERMISSION_MASK; - EXPECT_TRUE(file_util::GetPosixFilePermissions(journal, &mode)); - ASSERT_EQ((mode & file_util::FILE_PERMISSION_USER_MASK), mode); + mode = base::FILE_PERMISSION_MASK; + EXPECT_TRUE(base::GetPosixFilePermissions(journal, &mode)); + ASSERT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode); } #endif // defined(OS_POSIX) |