Files App: Decouple mount point/volume name and add file system type
This CL decouples mount point name(volumeId) and external drive device's name, and extends volume info with disk file system type which is going to be used for external drive renaming process. OnFormatCompleted it will update mount point, volume name, and disk file system type.
As a result, you should see entries with the exact same name if you use two or more partitions/disks with the exact same name.
CQ-DEPEND=CL:608727, CL:609565, CL:604611
Bug: 274041
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I7fb9ef2ac45100a31411d38bc2f54ba215b440f6
Reviewed-on: https://chromium-review.googlesource.com/605108
Reviewed-by: Devlin <[email protected]>
Reviewed-by: Steven Bennetts <[email protected]>
Reviewed-by: Tomasz Mikolajewski <[email protected]>
Reviewed-by: Tommy Li <[email protected]>
Reviewed-by: Tatsuhisa Yamaguchi <[email protected]>
Commit-Queue: Klemen Kozjek <[email protected]>
Cr-Commit-Position: refs/heads/master@{#497488}
diff --git a/chromeos/disks/disk_mount_manager_unittest.cc b/chromeos/disks/disk_mount_manager_unittest.cc
index adb9725..fcfc04b 100644
--- a/chromeos/disks/disk_mount_manager_unittest.cc
+++ b/chromeos/disks/disk_mount_manager_unittest.cc
@@ -31,6 +31,8 @@
const char kDevice2SourcePath[] = "/device/source_path2";
const char kReadOnlyDeviceMountPath[] = "/device/read_only_mount_path";
const char kReadOnlyDeviceSourcePath[] = "/device/read_only_source_path";
+const char kFileSystemType1[] = "ntfs";
+const char kFileSystemType2[] = "exfat";
// Holds information needed to create a DiskMountManager::Disk instance.
struct TestDiskInfo {
@@ -55,6 +57,7 @@
bool on_boot_device;
bool on_removable_device;
bool is_hidden;
+ const char* file_system_type;
};
// Holds information to create a DiskMOuntManager::MountPointInfo instance.
@@ -67,75 +70,72 @@
// List of disks held in DiskMountManager at the begining of the test.
const TestDiskInfo kTestDisks[] = {
- {
- kDevice1SourcePath,
- kDevice1MountPath,
- false, // write_disabled_by_policy
- "/device/prefix/system_path",
- "/device/file_path",
- "/device/device_label",
- "/device/drive_label",
- "/device/vendor_id",
- "/device/vendor_name",
- "/device/product_id",
- "/device/product_name",
- "/device/fs_uuid",
- "/device/prefix",
- chromeos::DEVICE_TYPE_USB,
- 1073741824, // size in bytes
- false, // is parent
- false, // is read only
- true, // has media
- false, // is on boot device
- true, // is on removable device
- false // is hidden
- },
- {
- kDevice2SourcePath,
- "", // not mounted initially
- false, // write_disabled_by_policy
- "/device/prefix/system_path2",
- "/device/file_path2",
- "/device/device_label2",
- "/device/drive_label2",
- "/device/vendor_id2",
- "/device/vendor_name2",
- "/device/product_id2",
- "/device/product_name2",
- "/device/fs_uuid2",
- "/device/prefix2",
- chromeos::DEVICE_TYPE_SD,
- 1073741824, // size in bytes
- false, // is parent
- false, // is read only
- true, // has media
- false, // is on boot device
- true, // is on removable device
- false // is hidden
- },
- {
- kReadOnlyDeviceSourcePath,
- kReadOnlyDeviceMountPath,
- false, // write_disabled_by_policy
- "/device/prefix/system_path_3",
- "/device/file_path_3",
- "/device/device_label_3",
- "/device/drive_label_3",
- "/device/vendor_id_3",
- "/device/vendor_name_3",
- "/device/product_id_3",
- "/device/product_name_3",
- "/device/fs_uuid_3",
- "/device/prefix",
- chromeos::DEVICE_TYPE_USB,
- 1073741824, // size in bytes
- false, // is parent
- true, // is read only
- true, // has media
- false, // is on boot device
- true, // is on removable device
- false // is hidden
- },
+ {kDevice1SourcePath,
+ kDevice1MountPath,
+ false, // write_disabled_by_policy
+ "/device/prefix/system_path",
+ "/device/file_path",
+ "/device/device_label",
+ "/device/drive_label",
+ "/device/vendor_id",
+ "/device/vendor_name",
+ "/device/product_id",
+ "/device/product_name",
+ "/device/fs_uuid",
+ "/device/prefix",
+ chromeos::DEVICE_TYPE_USB,
+ 1073741824, // size in bytes
+ false, // is parent
+ false, // is read only
+ true, // has media
+ false, // is on boot device
+ true, // is on removable device
+ false, // is hidden
+ kFileSystemType1},
+ {kDevice2SourcePath,
+ "", // not mounted initially
+ false, // write_disabled_by_policy
+ "/device/prefix/system_path2",
+ "/device/file_path2",
+ "/device/device_label2",
+ "/device/drive_label2",
+ "/device/vendor_id2",
+ "/device/vendor_name2",
+ "/device/product_id2",
+ "/device/product_name2",
+ "/device/fs_uuid2",
+ "/device/prefix2",
+ chromeos::DEVICE_TYPE_SD,
+ 1073741824, // size in bytes
+ false, // is parent
+ false, // is read only
+ true, // has media
+ false, // is on boot device
+ true, // is on removable device
+ false, // is hidden
+ kFileSystemType2},
+ {kReadOnlyDeviceSourcePath,
+ kReadOnlyDeviceMountPath,
+ false, // write_disabled_by_policy
+ "/device/prefix/system_path_3",
+ "/device/file_path_3",
+ "/device/device_label_3",
+ "/device/drive_label_3",
+ "/device/vendor_id_3",
+ "/device/vendor_name_3",
+ "/device/product_id_3",
+ "/device/product_name_3",
+ "/device/fs_uuid_3",
+ "/device/prefix",
+ chromeos::DEVICE_TYPE_USB,
+ 1073741824, // size in bytes
+ false, // is parent
+ true, // is read only
+ true, // has media
+ false, // is on boot device
+ true, // is on removable device
+ false, // is hidden
+ kFileSystemType2},
};
// List of mount points held in DiskMountManager at the begining of the test.
@@ -454,7 +454,7 @@
disk.product_name, disk.fs_uuid, disk.system_path_prefix,
disk.device_type, disk.size_in_bytes, disk.is_parent,
disk.is_read_only, disk.has_media, disk.on_boot_device,
- disk.on_removable_device, disk.is_hidden)));
+ disk.on_removable_device, disk.is_hidden, disk.file_system_type)));
}
// Adds a new mount point to the disk mount manager.
@@ -706,6 +706,9 @@
// Tests the case when formatting completes successfully.
TEST_F(DiskMountManagerTest, Format_FormatSuccess) {
+ DiskMountManager* manager = DiskMountManager::GetInstance();
+ const DiskMountManager::DiskMap& disks = manager->disks();
+
// Set up cros disks client mocks.
// Both unmount and format device cals are successful in this test.
@@ -743,6 +746,10 @@
EXPECT_EQ(FormatEvent(DiskMountManager::FORMAT_COMPLETED,
chromeos::FORMAT_ERROR_NONE, kDevice1SourcePath),
observer_->GetFormatEvent(2));
+
+ // Disk should have new values for file system type and device label name
+ EXPECT_EQ("vfat", disks.find(kDevice1SourcePath)->second->file_system_type());
+ EXPECT_EQ("UNTITLED", disks.find(kDevice1SourcePath)->second->device_label());
}
// Tests that it's possible to format the device twice in a row (this may not be