Commit f38b08cd authored by mtomasz@chromium.org's avatar mtomasz@chromium.org

[fsp] Fix error codes.

This patch cleans up returned error codes. And now:
- base::File::FILE_ERROR_SECURITY is for policy errors, or not handled events.
- base::File::FILE_ERROR_ACCESS_DENIED for all writing operations.
- base::File::FILE_ERROR_INVALID_OPERATION for invalid arguments to operations
    or operations which are read-only but not yet implemented.

TEST=browser_tests, unit_tests: *FileSystemProvider*
BUG=373151

Review URL: https://codereview.chromium.org/298003006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273178 0039d316-1c4b-4281-b951-d872f2087c98
parent 2c4564e6
...@@ -146,12 +146,19 @@ void FakeProvidedFileSystem::OpenFile(const base::FilePath& file_path, ...@@ -146,12 +146,19 @@ void FakeProvidedFileSystem::OpenFile(const base::FilePath& file_path,
OpenFileMode mode, OpenFileMode mode,
bool create, bool create,
const OpenFileCallback& callback) { const OpenFileCallback& callback) {
if (file_path.AsUTF8Unsafe() != "/hello.txt" || if (mode == OPEN_FILE_MODE_WRITE || create) {
mode == OPEN_FILE_MODE_WRITE || create) { base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(callback,
0 /* file_handle */,
base::File::FILE_ERROR_ACCESS_DENIED));
}
if (file_path.AsUTF8Unsafe() != "/hello.txt") {
base::MessageLoopProxy::current()->PostTask( base::MessageLoopProxy::current()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind( base::Bind(
callback, 0 /* file_handle */, base::File::FILE_ERROR_SECURITY)); callback, 0 /* file_handle */, base::File::FILE_ERROR_NOT_FOUND));
return; return;
} }
...@@ -192,7 +199,7 @@ void FakeProvidedFileSystem::ReadFile( ...@@ -192,7 +199,7 @@ void FakeProvidedFileSystem::ReadFile(
base::Bind(callback, base::Bind(callback,
0 /* chunk_length */, 0 /* chunk_length */,
false /* has_next */, false /* has_next */,
base::File::FILE_ERROR_SECURITY)); base::File::FILE_ERROR_INVALID_OPERATION));
return; return;
} }
......
...@@ -170,7 +170,7 @@ TEST_F(FileSystemProviderFileStreamReader, Read_WrongFile) { ...@@ -170,7 +170,7 @@ TEST_F(FileSystemProviderFileStreamReader, Read_WrongFile) {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
ASSERT_EQ(1u, logger.results().size()); ASSERT_EQ(1u, logger.results().size());
EXPECT_EQ(net::ERR_FAILED, logger.results()[0]); EXPECT_EQ(net::ERR_FILE_NOT_FOUND, logger.results()[0]);
} }
TEST_F(FileSystemProviderFileStreamReader, Read_InChunks) { TEST_F(FileSystemProviderFileStreamReader, Read_InChunks) {
...@@ -288,7 +288,7 @@ TEST_F(FileSystemProviderFileStreamReader, GetLength_WrongFile) { ...@@ -288,7 +288,7 @@ TEST_F(FileSystemProviderFileStreamReader, GetLength_WrongFile) {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
ASSERT_EQ(1u, logger.results().size()); ASSERT_EQ(1u, logger.results().size());
EXPECT_EQ(net::ERR_FAILED, logger.results()[0]); EXPECT_EQ(net::ERR_FILE_NOT_FOUND, logger.results()[0]);
} }
} // namespace file_system_provider } // namespace file_system_provider
......
...@@ -29,7 +29,7 @@ void GetFileInfoOnUIThread( ...@@ -29,7 +29,7 @@ void GetFileInfoOnUIThread(
const fileapi::AsyncFileUtil::GetFileInfoCallback& callback) { const fileapi::AsyncFileUtil::GetFileInfoCallback& callback) {
util::FileSystemURLParser parser(url); util::FileSystemURLParser parser(url);
if (!parser.Parse()) { if (!parser.Parse()) {
callback.Run(base::File::FILE_ERROR_NOT_FOUND, base::File::Info()); callback.Run(base::File::FILE_ERROR_INVALID_OPERATION, base::File::Info());
return; return;
} }
...@@ -51,7 +51,7 @@ void ReadDirectoryOnUIThread( ...@@ -51,7 +51,7 @@ void ReadDirectoryOnUIThread(
const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) { const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) {
util::FileSystemURLParser parser(url); util::FileSystemURLParser parser(url);
if (!parser.Parse()) { if (!parser.Parse()) {
callback.Run(base::File::FILE_ERROR_NOT_FOUND, callback.Run(base::File::FILE_ERROR_INVALID_OPERATION,
fileapi::AsyncFileUtil::EntryList(), fileapi::AsyncFileUtil::EntryList(),
false /* has_more */); false /* has_more */);
return; return;
...@@ -87,12 +87,14 @@ void ProviderAsyncFileUtil::CreateOrOpen( ...@@ -87,12 +87,14 @@ void ProviderAsyncFileUtil::CreateOrOpen(
(file_flags & base::File::FLAG_OPEN_ALWAYS) || (file_flags & base::File::FLAG_OPEN_ALWAYS) ||
(file_flags & base::File::FLAG_CREATE_ALWAYS) || (file_flags & base::File::FLAG_CREATE_ALWAYS) ||
(file_flags & base::File::FLAG_OPEN_TRUNCATED)) { (file_flags & base::File::FLAG_OPEN_TRUNCATED)) {
callback.Run(base::File(base::File::FILE_ERROR_SECURITY), base::Closure()); callback.Run(base::File(base::File::FILE_ERROR_ACCESS_DENIED),
base::Closure());
return; return;
} }
NOTIMPLEMENTED(); NOTIMPLEMENTED();
callback.Run(base::File(base::File::FILE_ERROR_NOT_FOUND), base::Closure()); callback.Run(base::File(base::File::FILE_ERROR_INVALID_OPERATION),
base::Closure());
} }
void ProviderAsyncFileUtil::EnsureFileExists( void ProviderAsyncFileUtil::EnsureFileExists(
...@@ -100,7 +102,7 @@ void ProviderAsyncFileUtil::EnsureFileExists( ...@@ -100,7 +102,7 @@ void ProviderAsyncFileUtil::EnsureFileExists(
const fileapi::FileSystemURL& url, const fileapi::FileSystemURL& url,
const EnsureFileExistsCallback& callback) { const EnsureFileExistsCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(base::File::FILE_ERROR_SECURITY, false /* created */); callback.Run(base::File::FILE_ERROR_ACCESS_DENIED, false /* created */);
} }
void ProviderAsyncFileUtil::CreateDirectory( void ProviderAsyncFileUtil::CreateDirectory(
...@@ -110,7 +112,7 @@ void ProviderAsyncFileUtil::CreateDirectory( ...@@ -110,7 +112,7 @@ void ProviderAsyncFileUtil::CreateDirectory(
bool recursive, bool recursive,
const StatusCallback& callback) { const StatusCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(base::File::FILE_ERROR_SECURITY); callback.Run(base::File::FILE_ERROR_ACCESS_DENIED);
} }
void ProviderAsyncFileUtil::GetFileInfo( void ProviderAsyncFileUtil::GetFileInfo(
...@@ -146,7 +148,7 @@ void ProviderAsyncFileUtil::Touch( ...@@ -146,7 +148,7 @@ void ProviderAsyncFileUtil::Touch(
const base::Time& last_modified_time, const base::Time& last_modified_time,
const StatusCallback& callback) { const StatusCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(base::File::FILE_ERROR_SECURITY); callback.Run(base::File::FILE_ERROR_ACCESS_DENIED);
} }
void ProviderAsyncFileUtil::Truncate( void ProviderAsyncFileUtil::Truncate(
...@@ -155,7 +157,7 @@ void ProviderAsyncFileUtil::Truncate( ...@@ -155,7 +157,7 @@ void ProviderAsyncFileUtil::Truncate(
int64 length, int64 length,
const StatusCallback& callback) { const StatusCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(base::File::FILE_ERROR_SECURITY); callback.Run(base::File::FILE_ERROR_ACCESS_DENIED);
} }
void ProviderAsyncFileUtil::CopyFileLocal( void ProviderAsyncFileUtil::CopyFileLocal(
...@@ -166,7 +168,7 @@ void ProviderAsyncFileUtil::CopyFileLocal( ...@@ -166,7 +168,7 @@ void ProviderAsyncFileUtil::CopyFileLocal(
const CopyFileProgressCallback& progress_callback, const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback) { const StatusCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(base::File::FILE_ERROR_SECURITY); callback.Run(base::File::FILE_ERROR_ACCESS_DENIED);
} }
void ProviderAsyncFileUtil::MoveFileLocal( void ProviderAsyncFileUtil::MoveFileLocal(
...@@ -176,7 +178,7 @@ void ProviderAsyncFileUtil::MoveFileLocal( ...@@ -176,7 +178,7 @@ void ProviderAsyncFileUtil::MoveFileLocal(
CopyOrMoveOption option, CopyOrMoveOption option,
const StatusCallback& callback) { const StatusCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(base::File::FILE_ERROR_SECURITY); callback.Run(base::File::FILE_ERROR_ACCESS_DENIED);
} }
void ProviderAsyncFileUtil::CopyInForeignFile( void ProviderAsyncFileUtil::CopyInForeignFile(
...@@ -185,7 +187,7 @@ void ProviderAsyncFileUtil::CopyInForeignFile( ...@@ -185,7 +187,7 @@ void ProviderAsyncFileUtil::CopyInForeignFile(
const fileapi::FileSystemURL& dest_url, const fileapi::FileSystemURL& dest_url,
const StatusCallback& callback) { const StatusCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(base::File::FILE_ERROR_SECURITY); callback.Run(base::File::FILE_ERROR_ACCESS_DENIED);
} }
void ProviderAsyncFileUtil::DeleteFile( void ProviderAsyncFileUtil::DeleteFile(
...@@ -193,7 +195,7 @@ void ProviderAsyncFileUtil::DeleteFile( ...@@ -193,7 +195,7 @@ void ProviderAsyncFileUtil::DeleteFile(
const fileapi::FileSystemURL& url, const fileapi::FileSystemURL& url,
const StatusCallback& callback) { const StatusCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(base::File::FILE_ERROR_SECURITY); callback.Run(base::File::FILE_ERROR_ACCESS_DENIED);
} }
void ProviderAsyncFileUtil::DeleteDirectory( void ProviderAsyncFileUtil::DeleteDirectory(
...@@ -201,7 +203,7 @@ void ProviderAsyncFileUtil::DeleteDirectory( ...@@ -201,7 +203,7 @@ void ProviderAsyncFileUtil::DeleteDirectory(
const fileapi::FileSystemURL& url, const fileapi::FileSystemURL& url,
const StatusCallback& callback) { const StatusCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(base::File::FILE_ERROR_SECURITY); callback.Run(base::File::FILE_ERROR_ACCESS_DENIED);
} }
void ProviderAsyncFileUtil::DeleteRecursively( void ProviderAsyncFileUtil::DeleteRecursively(
...@@ -209,7 +211,7 @@ void ProviderAsyncFileUtil::DeleteRecursively( ...@@ -209,7 +211,7 @@ void ProviderAsyncFileUtil::DeleteRecursively(
const fileapi::FileSystemURL& url, const fileapi::FileSystemURL& url,
const StatusCallback& callback) { const StatusCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(base::File::FILE_ERROR_SECURITY); callback.Run(base::File::FILE_ERROR_ACCESS_DENIED);
} }
void ProviderAsyncFileUtil::CreateSnapshotFile( void ProviderAsyncFileUtil::CreateSnapshotFile(
...@@ -218,7 +220,7 @@ void ProviderAsyncFileUtil::CreateSnapshotFile( ...@@ -218,7 +220,7 @@ void ProviderAsyncFileUtil::CreateSnapshotFile(
const CreateSnapshotFileCallback& callback) { const CreateSnapshotFileCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
NOTIMPLEMENTED(); NOTIMPLEMENTED();
callback.Run(base::File::FILE_ERROR_NOT_FOUND, callback.Run(base::File::FILE_ERROR_INVALID_OPERATION,
base::File::Info(), base::File::Info(),
base::FilePath(), base::FilePath(),
scoped_refptr<webkit_blob::ShareableFileReference>()); scoped_refptr<webkit_blob::ShareableFileReference>());
......
...@@ -117,8 +117,8 @@ KeyedService* CreateService(content::BrowserContext* context) { ...@@ -117,8 +117,8 @@ KeyedService* CreateService(content::BrowserContext* context) {
// Tests in this file are very lightweight and just test integration between // Tests in this file are very lightweight and just test integration between
// AsyncFileUtil and ProvideFileSystemInterface. Currently it tests if not // AsyncFileUtil and ProvideFileSystemInterface. Currently it tests if not
// implemented operations return a correct error code. For not allowed // implemented operations return a correct error code. For not allowed
// operations it is FILE_ERROR_SECURITY, and for not implemented the error is // operations it is FILE_ERROR_ACCESS_DENIED, and for not implemented the error
// FILE_ERROR_NOT_FOUND. // is FILE_ERROR_INVALID_OPERATION.
class FileSystemProviderProviderAsyncFileUtilTest : public testing::Test { class FileSystemProviderProviderAsyncFileUtilTest : public testing::Test {
protected: protected:
FileSystemProviderProviderAsyncFileUtilTest() {} FileSystemProviderProviderAsyncFileUtilTest() {}
...@@ -191,7 +191,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_Create) { ...@@ -191,7 +191,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_Create) {
base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr())); base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_CreateAlways) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_CreateAlways) {
...@@ -204,7 +204,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_CreateAlways) { ...@@ -204,7 +204,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_CreateAlways) {
base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr())); base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_OpenAlways) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_OpenAlways) {
...@@ -217,7 +217,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_OpenAlways) { ...@@ -217,7 +217,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_OpenAlways) {
base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr())); base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, TEST_F(FileSystemProviderProviderAsyncFileUtilTest,
...@@ -231,7 +231,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, ...@@ -231,7 +231,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest,
base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr())); base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_Open) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_Open) {
...@@ -244,7 +244,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_Open) { ...@@ -244,7 +244,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_Open) {
base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr())); base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, EnsureFileExists) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, EnsureFileExists) {
...@@ -256,7 +256,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, EnsureFileExists) { ...@@ -256,7 +256,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, EnsureFileExists) {
base::Bind(&EventLogger::OnEnsureFileExists, logger.GetWeakPtr())); base::Bind(&EventLogger::OnEnsureFileExists, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateDirectory) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateDirectory) {
...@@ -270,7 +270,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateDirectory) { ...@@ -270,7 +270,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateDirectory) {
base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr())); base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, GetFileInfo) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, GetFileInfo) {
...@@ -310,7 +310,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, Touch) { ...@@ -310,7 +310,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, Touch) {
base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr())); base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, Truncate) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, Truncate) {
...@@ -323,7 +323,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, Truncate) { ...@@ -323,7 +323,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, Truncate) {
base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr())); base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CopyFileLocal) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CopyFileLocal) {
...@@ -338,7 +338,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CopyFileLocal) { ...@@ -338,7 +338,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CopyFileLocal) {
base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr())); base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, MoveFileLocal) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, MoveFileLocal) {
...@@ -352,7 +352,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, MoveFileLocal) { ...@@ -352,7 +352,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, MoveFileLocal) {
base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr())); base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CopyInForeignFile) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CopyInForeignFile) {
...@@ -365,7 +365,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CopyInForeignFile) { ...@@ -365,7 +365,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CopyInForeignFile) {
base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr())); base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteFile) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteFile) {
...@@ -377,7 +377,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteFile) { ...@@ -377,7 +377,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteFile) {
base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr())); base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteDirectory) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteDirectory) {
...@@ -389,7 +389,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteDirectory) { ...@@ -389,7 +389,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteDirectory) {
base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr())); base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteRecursively) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteRecursively) {
...@@ -401,7 +401,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteRecursively) { ...@@ -401,7 +401,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteRecursively) {
base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr())); base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_ACCESS_DENIED, *logger.error());
} }
TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateSnapshotFile) { TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateSnapshotFile) {
...@@ -413,7 +413,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateSnapshotFile) { ...@@ -413,7 +413,7 @@ TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateSnapshotFile) {
base::Bind(&EventLogger::OnCreateSnapshotFile, logger.GetWeakPtr())); base::Bind(&EventLogger::OnCreateSnapshotFile, logger.GetWeakPtr()));
ASSERT_TRUE(logger.error()); ASSERT_TRUE(logger.error());
EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, *logger.error()); EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, *logger.error());
} }
} // namespace file_system_provider } // namespace file_system_provider
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment