Commit e2fb697b authored by Sergei Datsenko's avatar Sergei Datsenko Committed by Commit Bot

Inform the user when file pinning fails

BUG=chromium:1012031

Change-Id: I03841d12598ae6df7eaf63d466ac8b1719b59340
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2312396Reviewed-by: default avatarAustin Tankiang <austinct@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Commit-Queue: Sergei Datsenko <dats@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791447}
parent 3a754978
......@@ -172,6 +172,9 @@ void DriveFsEventRouter::OnError(const drivefs::mojom::DriveError& error) {
case drivefs::mojom::DriveError::Type::kCantUploadStorageFull:
event.type = file_manager_private::DRIVE_SYNC_ERROR_TYPE_NO_SERVER_SPACE;
break;
case drivefs::mojom::DriveError::Type::kPinningFailedDiskFull:
event.type = file_manager_private::DRIVE_SYNC_ERROR_TYPE_NO_LOCAL_SPACE;
break;
}
for (const auto& extension_id : GetEventListenerExtensionIds(
file_manager_private::OnDriveSyncError::kEventName)) {
......
......@@ -615,5 +615,20 @@ TEST_F(DriveFsEventRouterTest, OnError_CantUploadStorageFull) {
base::FilePath("/a")});
}
TEST_F(DriveFsEventRouterTest, OnError_CantPinDiskFull) {
DriveSyncErrorEvent event;
event.type = file_manager_private::DRIVE_SYNC_ERROR_TYPE_NO_LOCAL_SPACE;
event.file_url = "ext:a";
EXPECT_CALL(
mock(),
DispatchEventToExtensionImpl(
"ext", file_manager_private::OnDriveSyncError::kEventName,
testing::MakeMatcher(new ListValueMatcher(std::move(
*file_manager_private::OnDriveSyncError::Create(event))))));
observer().OnError({drivefs::mojom::DriveError::Type::kPinningFailedDiskFull,
base::FilePath("a")});
}
} // namespace
} // namespace file_manager
......@@ -143,6 +143,8 @@ enum DriveSyncErrorType {
service_unavailable,
// There is no server space to sync a file.
no_server_space,
// There is no local space to sync a file.
no_local_space,
// Miscellaneous errors other than listed above.
misc
};
......
......@@ -206,6 +206,7 @@ enum FileError {
struct DriveError {
[Extensible] enum Type {
kCantUploadStorageFull,
kPinningFailedDiskFull,
};
Type type;
......
......@@ -168,6 +168,7 @@ chrome.fileManagerPrivate.DriveSyncErrorType = {
DELETE_WITHOUT_PERMISSION: 'delete_without_permission',
SERVICE_UNAVAILABLE: 'service_unavailable',
NO_SERVER_SPACE: 'no_server_space',
NO_LOCAL_SPACE: 'no_local_space',
MISC: 'misc',
};
......
......@@ -260,6 +260,9 @@ class DriveSyncHandlerImpl extends cr.EventTarget {
item.id = DriveSyncHandlerImpl.DRIVE_SYNC_ERROR_PREFIX +
this.driveErrorIdOutOfQuota_;
break;
case 'no_local_space':
item.message = strf('DRIVE_OUT_OF_SPACE_HEADER', entry.name);
break;
case 'misc':
item.message = strf('SYNC_MISC_ERROR', entry.name);
break;
......
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