Commit c9266252 authored by mtomasz's avatar mtomasz Committed by Commit bot

Allow to create read only testing volumes.

TEST=Not used yet, but used in an upcoming CL.
BUG=440674

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

Cr-Commit-Position: refs/heads/master@{#320877}
parent 95310ee3
......@@ -424,9 +424,9 @@ IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, ContentChecksum) {
kLocalMountPointName, storage::kFileSystemTypeNativeLocal,
storage::FileSystemMountOption(), mount_point_dir));
file_manager::VolumeManager::Get(browser()->profile())
->AddVolumeInfoForTesting(mount_point_dir,
file_manager::VOLUME_TYPE_TESTING,
chromeos::DEVICE_TYPE_UNKNOWN);
->AddVolumeInfoForTesting(
mount_point_dir, file_manager::VOLUME_TYPE_TESTING,
chromeos::DEVICE_TYPE_UNKNOWN, false /* read_only */);
ASSERT_TRUE(RunComponentExtensionTest("file_browser/content_checksum_test"));
}
......@@ -452,8 +452,10 @@ class LocalFileSystemExtensionApiTest : public FileSystemExtensionApiTestBase {
storage::kFileSystemTypeNativeLocal,
storage::FileSystemMountOption(),
mount_point_dir_));
VolumeManager::Get(browser()->profile())->AddVolumeInfoForTesting(
mount_point_dir_, VOLUME_TYPE_TESTING, chromeos::DEVICE_TYPE_UNKNOWN);
VolumeManager::Get(browser()->profile())
->AddVolumeInfoForTesting(mount_point_dir_, VOLUME_TYPE_TESTING,
chromeos::DEVICE_TYPE_UNKNOWN,
false /* read_only */);
}
private:
......@@ -483,8 +485,10 @@ class RestrictedFileSystemExtensionApiTest
storage::kFileSystemTypeRestrictedNativeLocal,
storage::FileSystemMountOption(),
mount_point_dir_));
VolumeManager::Get(browser()->profile())->AddVolumeInfoForTesting(
mount_point_dir_, VOLUME_TYPE_TESTING, chromeos::DEVICE_TYPE_UNKNOWN);
VolumeManager::Get(browser()->profile())
->AddVolumeInfoForTesting(mount_point_dir_, VOLUME_TYPE_TESTING,
chromeos::DEVICE_TYPE_UNKNOWN,
false /* read_only */);
}
private:
......@@ -683,9 +687,9 @@ class LocalAndDriveFileSystemExtensionApiTest
storage::FileSystemMountOption(),
local_mount_point_dir_));
VolumeManager::Get(browser()->profile())
->AddVolumeInfoForTesting(local_mount_point_dir_,
VOLUME_TYPE_TESTING,
chromeos::DEVICE_TYPE_UNKNOWN);
->AddVolumeInfoForTesting(local_mount_point_dir_, VOLUME_TYPE_TESTING,
chromeos::DEVICE_TYPE_UNKNOWN,
false /* read_only */);
test_util::WaitUntilDriveMountPointIsAdded(browser()->profile());
}
......
......@@ -333,7 +333,7 @@ class FakeTestVolume : public LocalTestVolume {
return false;
VolumeManager::Get(profile)->AddVolumeInfoForTesting(
root_path(), volume_type_, device_type_);
root_path(), volume_type_, device_type_, false /* read_only */);
return true;
}
......
......@@ -153,7 +153,8 @@ VolumeInfo CreateDownloadsVolumeInfo(const base::FilePath& downloads_path) {
VolumeInfo CreateTestingVolumeInfo(const base::FilePath& path,
VolumeType volume_type,
chromeos::DeviceType device_type) {
chromeos::DeviceType device_type,
bool read_only) {
VolumeInfo volume_info;
volume_info.type = volume_type;
volume_info.device_type = device_type;
......@@ -161,7 +162,7 @@ VolumeInfo CreateTestingVolumeInfo(const base::FilePath& path,
volume_info.mount_path = path;
volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE;
volume_info.is_parent = false;
volume_info.is_read_only = false;
volume_info.is_read_only = read_only;
volume_info.has_media = false;
volume_info.volume_id = GenerateVolumeId(volume_info);
return volume_info;
......@@ -390,10 +391,12 @@ bool VolumeManager::RegisterDownloadsDirectoryForTesting(
void VolumeManager::AddVolumeInfoForTesting(const base::FilePath& path,
VolumeType volume_type,
chromeos::DeviceType device_type) {
chromeos::DeviceType device_type,
bool read_only) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DoMountEvent(chromeos::MOUNT_ERROR_NONE,
CreateTestingVolumeInfo(path, volume_type, device_type));
DoMountEvent(
chromeos::MOUNT_ERROR_NONE,
CreateTestingVolumeInfo(path, volume_type, device_type, read_only));
}
void VolumeManager::OnFileSystemMounted() {
......
......@@ -176,7 +176,8 @@ class VolumeManager : public KeyedService,
// type. Assumes that the mount point is already registered.
void AddVolumeInfoForTesting(const base::FilePath& path,
VolumeType volume_type,
chromeos::DeviceType device_type);
chromeos::DeviceType device_type,
bool read_only);
// drive::DriveIntegrationServiceObserver overrides.
void OnFileSystemMounted() override;
......
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