Commit 181fd73a authored by mtomasz's avatar mtomasz Committed by Commit bot

Add a data source field for volumes.

Especially for FSP, we'd like to know type of a volume, as the way they are
going to be displayed in Files app depends on it. Eg. SOURCE_FILE volumes will
be auto opened once they are mounted. SOURCE_NETWORK file systems will have
a button for configuration.

TEST=unit_tests, browser_tests
BUG=474146

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

Cr-Commit-Position: refs/heads/master@{#324429}
parent 2e188ab2
......@@ -182,9 +182,25 @@ void VolumeToVolumeMetadata(
new std::string(volume.source_path().AsUTF8Unsafe()));
}
switch (volume.volume_source()) {
case VOLUME_SOURCE_UNKNOWN:
volume_metadata->volume_source = file_manager_private::VOLUME_SOURCE_NONE;
break;
case VOLUME_SOURCE_FILE:
volume_metadata->volume_source = file_manager_private::VOLUME_SOURCE_FILE;
break;
case VOLUME_SOURCE_DEVICE:
volume_metadata->volume_source =
file_manager_private::VOLUME_SOURCE_DEVICE;
break;
case VOLUME_SOURCE_NETWORK:
volume_metadata->volume_source =
file_manager_private::VOLUME_SOURCE_NETWORK;
break;
}
if (volume.type() == VOLUME_TYPE_PROVIDED) {
volume_metadata->extension_id.reset(new std::string(volume.extension_id()));
volume_metadata->file_system_id.reset(
new std::string(volume.file_system_id()));
}
......
......@@ -70,6 +70,22 @@ scoped_ptr<ProvidedFileSystemObserver::Changes> ParseChanges(
return results;
}
// Converts the file system source from the IDL type to a native type.
chromeos::file_system_provider::Source ParseSource(
const api::file_system_provider::FileSystemSource& source) {
switch (source) {
case api::file_system_provider::FILE_SYSTEM_SOURCE_FILE:
return chromeos::file_system_provider::SOURCE_FILE;
case api::file_system_provider::FILE_SYSTEM_SOURCE_DEVICE:
return chromeos::file_system_provider::SOURCE_DEVICE;
case api::file_system_provider::FILE_SYSTEM_SOURCE_NETWORK:
return chromeos::file_system_provider::SOURCE_NETWORK;
case api::file_system_provider::FILE_SYSTEM_SOURCE_NONE:
return chromeos::file_system_provider::SOURCE_UNKNOWN;
}
return chromeos::file_system_provider::SOURCE_UNKNOWN;
}
// Fills the IDL's FileSystemInfo with FSP's ProvidedFileSystemInfo and
// Watchers.
void FillFileSystemInfo(const ProvidedFileSystemInfo& file_system_info,
......@@ -83,6 +99,20 @@ void FillFileSystemInfo(const ProvidedFileSystemInfo& file_system_info,
output->display_name = file_system_info.display_name();
output->writable = file_system_info.writable();
output->opened_files_limit = file_system_info.opened_files_limit();
switch (file_system_info.source()) {
case chromeos::file_system_provider::SOURCE_FILE:
output->source = api::file_system_provider::FILE_SYSTEM_SOURCE_FILE;
break;
case chromeos::file_system_provider::SOURCE_DEVICE:
output->source = api::file_system_provider::FILE_SYSTEM_SOURCE_DEVICE;
break;
case chromeos::file_system_provider::SOURCE_NETWORK:
output->source = api::file_system_provider::FILE_SYSTEM_SOURCE_NETWORK;
break;
case chromeos::file_system_provider::SOURCE_UNKNOWN:
output->source = api::file_system_provider::FILE_SYSTEM_SOURCE_NONE;
break;
}
std::vector<linked_ptr<Watcher>> watcher_items;
for (const auto& watcher : watchers) {
......@@ -152,6 +182,7 @@ bool FileSystemProviderMountFunction::RunSync() {
? *params->options.opened_files_limit.get()
: 0;
options.supports_notify_tag = params->options.supports_notify_tag;
options.source = ParseSource(params->options.source);
const base::File::Error result =
service->MountFileSystem(extension_id(), options);
......
......@@ -150,6 +150,7 @@ Volume* Volume::CreateForDrive(Profile* profile) {
volume->type_ = VOLUME_TYPE_GOOGLE_DRIVE;
volume->device_type_ = chromeos::DEVICE_TYPE_UNKNOWN;
volume->source_path_ = drive_path;
volume->volume_source_ = VOLUME_SOURCE_NETWORK;
volume->mount_path_ = drive_path;
volume->mount_condition_ = chromeos::disks::MOUNT_CONDITION_NONE;
volume->is_parent_ = false;
......@@ -165,6 +166,7 @@ Volume* Volume::CreateForDownloads(const base::FilePath& downloads_path) {
volume->type_ = VOLUME_TYPE_DOWNLOADS_DIRECTORY;
volume->device_type_ = chromeos::DEVICE_TYPE_UNKNOWN;
// Keep source_path empty.
volume->volume_source_ = VOLUME_SOURCE_DEVICE;
volume->mount_path_ = downloads_path;
volume->mount_condition_ = chromeos::disks::MOUNT_CONDITION_NONE;
volume->is_parent_ = false;
......@@ -181,6 +183,10 @@ Volume* Volume::CreateForRemovable(
Volume* const volume = new Volume;
volume->type_ = MountTypeToVolumeType(mount_point.mount_type);
volume->source_path_ = base::FilePath(mount_point.source_path);
volume->volume_source_ =
mount_point.mount_type == chromeos::MOUNT_TYPE_ARCHIVE
? VOLUME_SOURCE_FILE
: VOLUME_SOURCE_DEVICE;
volume->mount_path_ = base::FilePath(mount_point.mount_path);
volume->mount_condition_ = mount_point.mount_condition;
volume->volume_label_ = volume->mount_path().BaseName().AsUTF8Unsafe();
......@@ -209,6 +215,20 @@ Volume* Volume::CreateForProvidedFileSystem(
Volume* const volume = new Volume;
volume->file_system_id_ = file_system_info.file_system_id();
volume->extension_id_ = file_system_info.extension_id();
switch (file_system_info.source()) {
case chromeos::file_system_provider::SOURCE_UNKNOWN:
volume->volume_source_ = VOLUME_SOURCE_UNKNOWN;
break;
case chromeos::file_system_provider::SOURCE_FILE:
volume->volume_source_ = VOLUME_SOURCE_FILE;
break;
case chromeos::file_system_provider::SOURCE_DEVICE:
volume->volume_source_ = VOLUME_SOURCE_DEVICE;
break;
case chromeos::file_system_provider::SOURCE_NETWORK:
volume->volume_source_ = VOLUME_SOURCE_NETWORK;
break;
}
volume->volume_label_ = file_system_info.display_name();
volume->type_ = VOLUME_TYPE_PROVIDED;
volume->mount_path_ = file_system_info.mount_path();
......@@ -234,6 +254,7 @@ Volume* Volume::CreateForMTP(const base::FilePath& mount_path,
volume->volume_id_ = kMtpVolumeIdPrefix + label;
volume->volume_label_ = label;
volume->source_path_ = mount_path;
volume->volume_source_ = VOLUME_SOURCE_DEVICE;
volume->device_type_ = chromeos::DEVICE_TYPE_MOBILE;
return volume;
}
......@@ -247,6 +268,7 @@ Volume* Volume::CreateForTesting(const base::FilePath& path,
volume->type_ = volume_type;
volume->device_type_ = device_type;
// Keep source_path empty.
volume->volume_source_ = VOLUME_SOURCE_DEVICE;
volume->mount_path_ = path;
volume->mount_condition_ = chromeos::disks::MOUNT_CONDITION_NONE;
volume->is_parent_ = false;
......
......@@ -57,6 +57,14 @@ enum VolumeType {
NUM_VOLUME_TYPE,
};
// Source of a volume's data.
enum VolumeSource {
VOLUME_SOURCE_UNKNOWN,
VOLUME_SOURCE_FILE,
VOLUME_SOURCE_DEVICE,
VOLUME_SOURCE_NETWORK
};
// Says how was the mount performed, whether due to user interaction, or
// automatic. User interaction includes both hardware (pluggins a USB stick)
// or software (mounting a ZIP archive) interaction.
......@@ -97,6 +105,7 @@ class Volume : public base::SupportsWeakPtr<Volume> {
const std::string& volume_id() const { return volume_id_; }
const std::string& file_system_id() const { return file_system_id_; }
const std::string& extension_id() const { return extension_id_; }
const VolumeSource volume_source() const { return volume_source_; }
VolumeType type() const { return type_; }
chromeos::DeviceType device_type() const { return device_type_; }
const base::FilePath& source_path() const { return source_path_; }
......@@ -127,6 +136,9 @@ class Volume : public base::SupportsWeakPtr<Volume> {
// to an empty string.
std::string extension_id_;
// The source of the file system's data.
VolumeSource volume_source_;
// The type of mounted volume.
VolumeType type_;
......
......@@ -9,7 +9,10 @@ namespace chromeos {
namespace file_system_provider {
MountOptions::MountOptions()
: writable(false), supports_notify_tag(false), opened_files_limit(0) {
: writable(false),
source(SOURCE_UNKNOWN),
supports_notify_tag(false),
opened_files_limit(0) {
}
MountOptions::MountOptions(const std::string& file_system_id,
......@@ -17,12 +20,13 @@ MountOptions::MountOptions(const std::string& file_system_id,
: file_system_id(file_system_id),
display_name(display_name),
writable(false),
source(SOURCE_UNKNOWN),
supports_notify_tag(false),
opened_files_limit(0) {
}
ProvidedFileSystemInfo::ProvidedFileSystemInfo()
: writable_(false), supports_notify_tag_(false) {
: writable_(false), source_(SOURCE_UNKNOWN), supports_notify_tag_(false) {
}
ProvidedFileSystemInfo::ProvidedFileSystemInfo(
......@@ -33,6 +37,7 @@ ProvidedFileSystemInfo::ProvidedFileSystemInfo(
file_system_id_(mount_options.file_system_id),
display_name_(mount_options.display_name),
writable_(mount_options.writable),
source_(mount_options.source),
supports_notify_tag_(mount_options.supports_notify_tag),
opened_files_limit_(mount_options.opened_files_limit),
mount_path_(mount_path) {
......
......@@ -12,6 +12,9 @@
namespace chromeos {
namespace file_system_provider {
// Source of the file system's contents.
enum Source { SOURCE_UNKNOWN, SOURCE_FILE, SOURCE_DEVICE, SOURCE_NETWORK };
// Options for creating the provided file system info.
struct MountOptions {
MountOptions();
......@@ -23,6 +26,7 @@ struct MountOptions {
std::string file_system_id;
std::string display_name;
bool writable;
Source source;
bool supports_notify_tag;
int opened_files_limit;
};
......@@ -42,6 +46,7 @@ class ProvidedFileSystemInfo {
const std::string& file_system_id() const { return file_system_id_; }
const std::string& display_name() const { return display_name_; }
bool writable() const { return writable_; }
Source source() const { return source_; }
bool supports_notify_tag() const { return supports_notify_tag_; }
int opened_files_limit() const { return opened_files_limit_; }
const base::FilePath& mount_path() const { return mount_path_; }
......@@ -59,6 +64,9 @@ class ProvidedFileSystemInfo {
// Whether the file system is writable or just read-only.
bool writable_;
// Source of the file system's contents. By default SOURCE_UNKNOWN.
Source source_;
// Supports tags for file/directory change notifications.
bool supports_notify_tag_;
......
......@@ -26,6 +26,7 @@ namespace file_system_provider {
const char kPrefKeyFileSystemId[] = "file-system-id";
const char kPrefKeyDisplayName[] = "display-name";
const char kPrefKeyWritable[] = "writable";
const char kPrefKeySource[] = "source";
const char kPrefKeySupportsNotifyTag[] = "supports-notify-tag";
const char kPrefKeyWatchers[] = "watchers";
const char kPrefKeyWatcherEntryPath[] = "entry-path";
......@@ -40,6 +41,41 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
}
std::string SourceToString(Source source) {
switch (source) {
case SOURCE_UNKNOWN:
return "unknown";
case SOURCE_FILE:
return "file";
case SOURCE_DEVICE:
return "device";
case SOURCE_NETWORK:
return "network";
}
NOTREACHED();
return std::string();
}
bool StringToSource(const std::string& source, Source* result) {
if (source.compare("unknown") == 0) {
*result = SOURCE_UNKNOWN;
return true;
}
if (source.compare("file") == 0) {
*result = SOURCE_FILE;
return true;
}
if (source.compare("device") == 0) {
*result = SOURCE_DEVICE;
return true;
}
if (source.compare("network") == 0) {
*result = SOURCE_NETWORK;
return true;
}
return false;
}
Registry::Registry(Profile* profile) : profile_(profile) {
}
......@@ -56,6 +92,8 @@ void Registry::RememberFileSystem(
file_system_info.display_name());
file_system->SetBooleanWithoutPathExpansion(kPrefKeyWritable,
file_system_info.writable());
file_system->SetStringWithoutPathExpansion(
kPrefKeySource, SourceToString(file_system_info.source()));
file_system->SetBooleanWithoutPathExpansion(
kPrefKeySupportsNotifyTag, file_system_info.supports_notify_tag());
file_system->SetIntegerWithoutPathExpansion(
......@@ -153,6 +191,8 @@ scoped_ptr<Registry::RestoredFileSystems> Registry::RestoreFileSystems(
bool writable = false;
bool supports_notify_tag = false;
int opened_files_limit = 0;
std::string source_as_string;
Source source = SOURCE_UNKNOWN;
// TODO(mtomasz): Move opened files limit to the mandatory list above in
// M42.
......@@ -166,9 +206,12 @@ scoped_ptr<Registry::RestoredFileSystems> Registry::RestoreFileSystems(
!file_system->GetBooleanWithoutPathExpansion(kPrefKeySupportsNotifyTag,
&supports_notify_tag) ||
file_system_id.empty() || display_name.empty()) ||
// Optional fields.
(file_system->GetIntegerWithoutPathExpansion(kPrefKeyOpenedFilesLimit,
&opened_files_limit) &&
opened_files_limit < 0)) {
(file_system->GetStringWithoutPathExpansion(kPrefKeySource,
&source_as_string) &&
!StringToSource(source_as_string, &source)))) {
LOG(ERROR)
<< "Malformed provided file system information in preferences.";
continue;
......@@ -178,6 +221,7 @@ scoped_ptr<Registry::RestoredFileSystems> Registry::RestoreFileSystems(
options.file_system_id = file_system_id;
options.display_name = display_name;
options.writable = writable;
options.source = source;
options.supports_notify_tag = supports_notify_tag;
options.opened_files_limit = opened_files_limit;
......
......@@ -24,6 +24,7 @@ namespace file_system_provider {
extern const char kPrefKeyFileSystemId[];
extern const char kPrefKeyDisplayName[];
extern const char kPrefKeyWritable[];
extern const char kPrefKeySource[];
extern const char kPrefKeySupportsNotifyTag[];
extern const char kPrefKeyWatchers[];
extern const char kPrefKeyWatcherEntryPath[];
......@@ -37,6 +38,11 @@ class ProvidedFileSystemInfo;
// Registers preferences to remember registered file systems between reboots.
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
// Converts a file system's data source value back and forth between Source and
// std::string types.
std::string SourceToString(Source source);
bool StringToSource(const std::string& source, Source* result);
// Remembers and restores file systems in a persistent storage.
class Registry : public RegistryInterface {
public:
......
......@@ -29,6 +29,7 @@ const char kPersistentOrigin[] =
"chrome-extension://efgefgefgefgefgefgefgefgefgefgefgefge/";
const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj";
const char kDisplayName[] = "Camera Pictures";
const Source kSource = SOURCE_NETWORK;
// The dot in the file system ID is there in order to check that saving to
// preferences works correctly. File System ID is used as a key in
......@@ -44,6 +45,7 @@ void RememberFakeFileSystem(TestingProfile* profile,
const std::string& file_system_id,
const std::string& display_name,
bool writable,
Source source,
bool supports_notify_tag,
int opened_files_limit,
const Watcher& watcher) {
......@@ -60,6 +62,8 @@ void RememberFakeFileSystem(TestingProfile* profile,
kFileSystemId);
file_system->SetStringWithoutPathExpansion(kPrefKeyDisplayName, kDisplayName);
file_system->SetBooleanWithoutPathExpansion(kPrefKeyWritable, writable);
file_system->SetStringWithoutPathExpansion(kPrefKeySource,
SourceToString(source));
file_system->SetBooleanWithoutPathExpansion(kPrefKeySupportsNotifyTag,
supports_notify_tag);
file_system->SetIntegerWithoutPathExpansion(kPrefKeyOpenedFilesLimit,
......@@ -124,8 +128,9 @@ class FileSystemProviderRegistryTest : public testing::Test {
TEST_F(FileSystemProviderRegistryTest, RestoreFileSystems) {
// Create a fake entry in the preferences.
RememberFakeFileSystem(profile_, kExtensionId, kFileSystemId, kDisplayName,
true /* writable */, true /* supports_notify_tag */,
kOpenedFilesLimit, fake_watcher_);
true /* writable */, kSource,
true /* supports_notify_tag */, kOpenedFilesLimit,
fake_watcher_);
scoped_ptr<RegistryInterface::RestoredFileSystems> restored_file_systems =
registry_->RestoreFileSystems(kExtensionId);
......@@ -137,6 +142,7 @@ TEST_F(FileSystemProviderRegistryTest, RestoreFileSystems) {
EXPECT_EQ(kFileSystemId, restored_file_system.options.file_system_id);
EXPECT_EQ(kDisplayName, restored_file_system.options.display_name);
EXPECT_TRUE(restored_file_system.options.writable);
EXPECT_EQ(kSource, restored_file_system.options.source);
EXPECT_TRUE(restored_file_system.options.supports_notify_tag);
EXPECT_EQ(kOpenedFilesLimit, restored_file_system.options.opened_files_limit);
......@@ -153,6 +159,7 @@ TEST_F(FileSystemProviderRegistryTest, RestoreFileSystems) {
TEST_F(FileSystemProviderRegistryTest, RememberFileSystem) {
MountOptions options(kFileSystemId, kDisplayName);
options.writable = true;
options.source = kSource;
options.supports_notify_tag = true;
options.opened_files_limit = kOpenedFilesLimit;
......@@ -199,6 +206,11 @@ TEST_F(FileSystemProviderRegistryTest, RememberFileSystem) {
file_system->GetBooleanWithoutPathExpansion(kPrefKeyWritable, &writable));
EXPECT_TRUE(writable);
std::string source_as_string;
EXPECT_TRUE(file_system->GetStringWithoutPathExpansion(kPrefKeySource,
&source_as_string));
EXPECT_EQ("network", source_as_string);
bool supports_notify_tag = false;
EXPECT_TRUE(file_system->GetBooleanWithoutPathExpansion(
kPrefKeySupportsNotifyTag, &supports_notify_tag));
......@@ -248,8 +260,9 @@ TEST_F(FileSystemProviderRegistryTest, RememberFileSystem) {
TEST_F(FileSystemProviderRegistryTest, ForgetFileSystem) {
// Create a fake file systems in the preferences.
RememberFakeFileSystem(profile_, kExtensionId, kFileSystemId, kDisplayName,
true /* writable */, true /* supports_notify_tag */,
kOpenedFilesLimit, fake_watcher_);
true /* writable */, kSource,
true /* supports_notify_tag */, kOpenedFilesLimit,
fake_watcher_);
registry_->ForgetFileSystem(kExtensionId, kFileSystemId);
......@@ -316,5 +329,28 @@ TEST_F(FileSystemProviderRegistryTest, UpdateWatcherTag) {
EXPECT_EQ(fake_watcher_.last_tag, last_tag);
}
TEST_F(FileSystemProviderRegistryTest, SourceToString) {
{
Source result = SOURCE_UNKNOWN;
EXPECT_TRUE(StringToSource(SourceToString(SOURCE_FILE), &result));
EXPECT_EQ(SOURCE_FILE, result);
}
{
Source result = SOURCE_UNKNOWN;
EXPECT_TRUE(StringToSource(SourceToString(SOURCE_DEVICE), &result));
EXPECT_EQ(SOURCE_DEVICE, result);
}
{
Source result = SOURCE_UNKNOWN;
EXPECT_TRUE(StringToSource(SourceToString(SOURCE_NETWORK), &result));
EXPECT_EQ(SOURCE_NETWORK, result);
}
{
Source result = SOURCE_FILE;
EXPECT_TRUE(StringToSource(SourceToString(SOURCE_UNKNOWN), &result));
EXPECT_EQ(SOURCE_UNKNOWN, result);
}
}
} // namespace file_system_provider
} // namespace chromeos
......@@ -173,6 +173,20 @@ enum EntryTagVisibility {
public
};
// Source of the volume data.
enum VolumeSource {
// Represents a mounted file. In most cases, simply an archive.
file,
// Representing a device, eg. an MTP device. Also, used for Downloads as it's
// containing files stored on the Chrome OS device.
device,
// Used for volumes which contain files on a remote machine, eg. Drive or
// cloud services implemented via the File System Provider API.
network
};
// A file task represents an action that the file manager can perform over the
// currently selected files. See
// chrome/browser/chromeos/extensions/file_manager/file_tasks.h for details
......@@ -280,12 +294,15 @@ dictionary VolumeMetadata {
// ID of the disk volume.
DOMString volumeId;
// Id the provided file system (for proviided file systems).
// Id the provided file system (for provided file systems).
DOMString? fileSystemId;
// Extension providing this volume (for provided file systems).
DOMString? extensionId;
// Source of the volume data.
VolumeSource? volumeSource;
// Label of the volume (if available).
DOMString? volumeLabel;
......
......@@ -41,6 +41,22 @@ namespace fileSystemProvider {
DELETED
};
// Source of the file system data.
enum FileSystemSource {
// The file system is handling a file, eg. an archive file obtained via the
// <code>OnLaunched</code> event and the <code>file_handlers</code> manifest
// entry.
FILE,
// The file system contents are fetched from an external device, such as a
// USB device, but not via <code>file_handlers</code>.
DEVICE,
// The file system is network based. The contents are obtained from another
// server or local network. Eg. cloud services.
NETWORK
};
// Represents metadata of a file or a directory.
dictionary EntryMetadata {
// True if it is a directory.
......@@ -109,6 +125,9 @@ namespace fileSystemProvider {
// List of currently opened files.
OpenedFile[] openedFiles;
// Source of the file system data.
FileSystemSource? source;
// Whether the file system supports the <code>tag</code> field for observing
// directories.
[nodoc] boolean? supportsNotifyTag;
......@@ -134,6 +153,9 @@ namespace fileSystemProvider {
// or 0, then not limited.
long? openedFilesLimit;
// Source of the file system data.
FileSystemSource? source;
// Whether the file system supports the <code>tag</code> field for observed
// directories. Required in order to enable the internal cache.
[nodoc] boolean? supportsNotifyTag;
......@@ -451,6 +473,9 @@ namespace fileSystemProvider {
// must be descriptive but doesn't have to be unique. The <code>fileSystemId
// </code> must not be an empty string.
//
// Depending on the type of the file system being mounted, the <code>source
// </code> option must be set appropriately.
//
// In case of an error, <code>chrome.runtime.lastError</code> will be set
// will a corresponding error code.
static void mount(MountOptions options,
......
......@@ -7,6 +7,7 @@ var expectedVolume1 = {
volumeId: 'removable:mount_path1',
volumeLabel: 'mount_path1',
sourcePath: 'device_path1',
volumeSource: 'device',
volumeType: 'removable',
deviceType: 'usb',
devicePath: 'system_path_prefix1',
......@@ -20,6 +21,7 @@ var expectedVolume2 = {
volumeId: 'removable:mount_path2',
volumeLabel: 'mount_path2',
sourcePath: 'device_path2',
volumeSource: 'device',
volumeType: 'removable',
deviceType: 'mobile',
devicePath: 'system_path_prefix2',
......@@ -33,6 +35,7 @@ var expectedVolume3 = {
volumeId: 'removable:mount_path3',
volumeLabel: 'mount_path3',
sourcePath: 'device_path3',
volumeSource: 'device',
volumeType: 'removable',
deviceType: 'optical',
devicePath: 'system_path_prefix3',
......@@ -45,6 +48,7 @@ var expectedVolume3 = {
var expectedDownloadsVolume = {
volumeId: /^downloads:Downloads[^\/]*$/,
volumeLabel: '',
volumeSource: 'device',
volumeType: 'downloads',
isReadOnly: false,
hasMedia: false,
......@@ -55,6 +59,7 @@ var expectedDriveVolume = {
volumeId: /^drive:drive[^\/]*$/,
volumeLabel: '',
sourcePath: /^\/special\/drive[^\/]*$/,
volumeSource: 'network',
volumeType: 'drive',
isReadOnly: false,
hasMedia: false,
......@@ -65,6 +70,7 @@ var expectedArchiveVolume = {
volumeId: 'archive:archive_mount_path',
volumeLabel: 'archive_mount_path',
sourcePath: /removable\/mount_path3\/archive.zip$/,
volumeSource: 'file',
volumeType: 'archive',
isReadOnly: true,
hasMedia: false,
......
......@@ -86,6 +86,8 @@ function runTests() {
fileSystems[0].displayName);
chrome.test.assertTrue(
fileSystems[0].writable);
chrome.test.assertEq(
'NETWORK', fileSystems[0].source);
chrome.test.assertEq(2,
fileSystems[0].openedFilesLimit);
}));
......@@ -100,6 +102,8 @@ function runTests() {
test_util.FILE_SYSTEM_NAME,
fileSystem.displayName);
chrome.test.assertTrue(fileSystem.writable);
chrome.test.assertEq(
'NETWORK', fileSystem.source);
chrome.test.assertEq(2,
fileSystem.openedFilesLimit);
}));
......@@ -113,7 +117,7 @@ function runTests() {
function(error) {
chrome.test.fail(error.name);
});
}), {writable: true, openedFilesLimit: 2});
}), {writable: true, openedFilesLimit: 2, source: 'NETWORK'});
},
// Verifies that after unmounting, the file system is not available in
......
......@@ -65,7 +65,11 @@ chrome.test.runTests([
function successfulMount() {
var fileSystemId = 'caramel-candy';
chrome.fileSystemProvider.mount(
{fileSystemId: fileSystemId, displayName: 'caramel-candy.zip'},
{
fileSystemId: fileSystemId,
displayName: 'caramel-candy.zip',
source: 'FILE'
},
chrome.test.callbackPass(function() {
chrome.fileManagerPrivate.getVolumeMetadataList(function(volumeList) {
var volumeInfo;
......
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