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