diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/fileapi/file_system_operation.cc | 4 | ||||
-rw-r--r-- | webkit/fileapi/file_system_operation_unittest.cc | 14 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.cc | 5 |
3 files changed, 19 insertions, 4 deletions
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc index 5e66453..b01f4d5 100644 --- a/webkit/fileapi/file_system_operation.cc +++ b/webkit/fileapi/file_system_operation.cc @@ -326,7 +326,7 @@ void FileSystemOperation::DidDirectoryExists( if (file_info.is_directory) dispatcher_->DidSucceed(); else - dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_FAILED); + dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY); } else { dispatcher_->DidFail(rv); } @@ -338,7 +338,7 @@ void FileSystemOperation::DidFileExists( const base::PlatformFileInfo& file_info) { if (rv == base::PLATFORM_FILE_OK) { if (file_info.is_directory) - dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_FAILED); + dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_FILE); else dispatcher_->DidSucceed(); } else { diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc index b535676..7e3a177 100644 --- a/webkit/fileapi/file_system_operation_unittest.cc +++ b/webkit/fileapi/file_system_operation_unittest.cc @@ -570,6 +570,20 @@ TEST_F(FileSystemOperationTest, TestExistsAndMetadataSuccess) { EXPECT_FALSE(info().is_directory); } +TEST_F(FileSystemOperationTest, TestTypeMismatchErrors) { + ScopedTempDir dir; + ASSERT_TRUE(dir.CreateUniqueTempDir()); + operation()->FileExists(dir.path()); + MessageLoop::current()->RunAllPending(); + EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_FILE, status()); + + FilePath file; + ASSERT_TRUE(file_util::CreateTemporaryFileInDir(dir.path(), &file)); + operation()->DirectoryExists(file); + MessageLoop::current()->RunAllPending(); + EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY, status()); +} + TEST_F(FileSystemOperationTest, TestReadDirFailure) { // Path doesn't exists FilePath nonexisting_dir_path(base_.path().Append( diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index ce4bf41..227bfe7 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -314,10 +314,11 @@ WebKit::WebFileError PlatformFileErrorToWebFileError( return WebKit::WebFileErrorNotFound; case base::PLATFORM_FILE_ERROR_INVALID_OPERATION: case base::PLATFORM_FILE_ERROR_EXISTS: - case base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY: - case base::PLATFORM_FILE_ERROR_NOT_A_FILE: case base::PLATFORM_FILE_ERROR_NOT_EMPTY: return WebKit::WebFileErrorInvalidModification; + case base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY: + case base::PLATFORM_FILE_ERROR_NOT_A_FILE: + return WebKit::WebFileErrorTypeMismatch; case base::PLATFORM_FILE_ERROR_ACCESS_DENIED: return WebKit::WebFileErrorNoModificationAllowed; case base::PLATFORM_FILE_ERROR_FAILED: |