diff options
Diffstat (limited to 'chrome/browser/chromeos/fileapi')
-rw-r--r-- | chrome/browser/chromeos/fileapi/file_system_backend.cc (renamed from chrome/browser/chromeos/fileapi/cros_mount_point_provider.cc) | 46 | ||||
-rw-r--r-- | chrome/browser/chromeos/fileapi/file_system_backend.h (renamed from chrome/browser/chromeos/fileapi/cros_mount_point_provider.h) | 39 | ||||
-rw-r--r-- | chrome/browser/chromeos/fileapi/file_system_backend_delegate.h (renamed from chrome/browser/chromeos/fileapi/cros_mount_point_provider_delegate.h) | 20 | ||||
-rw-r--r-- | chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc (renamed from chrome/browser/chromeos/fileapi/cros_mount_point_provider_unittest.cc) | 68 |
4 files changed, 86 insertions, 87 deletions
diff --git a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.cc b/chrome/browser/chromeos/fileapi/file_system_backend.cc index 8c799d8..148e148 100644 --- a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.cc +++ b/chrome/browser/chromeos/fileapi/file_system_backend.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/fileapi/cros_mount_point_provider.h" +#include "chrome/browser/chromeos/fileapi/file_system_backend.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -11,8 +11,8 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/synchronization/lock.h" -#include "chrome/browser/chromeos/fileapi/cros_mount_point_provider_delegate.h" #include "chrome/browser/chromeos/fileapi/file_access_permissions.h" +#include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h" #include "chromeos/dbus/cros_disks_client.h" #include "webkit/browser/blob/file_stream_reader.h" #include "webkit/browser/fileapi/async_file_util_adapter.h" @@ -37,7 +37,7 @@ const char kChromeUIScheme[] = "chrome"; namespace chromeos { // static -bool CrosMountPointProvider::CanHandleURL(const fileapi::FileSystemURL& url) { +bool FileSystemBackend::CanHandleURL(const fileapi::FileSystemURL& url) { if (!url.is_valid()) return false; return url.type() == fileapi::kFileSystemTypeNativeLocal || @@ -45,8 +45,8 @@ bool CrosMountPointProvider::CanHandleURL(const fileapi::FileSystemURL& url) { url.type() == fileapi::kFileSystemTypeDrive; } -CrosMountPointProvider::CrosMountPointProvider( - CrosMountPointProviderDelegate* drive_delegate, +FileSystemBackend::FileSystemBackend( + FileSystemBackendDelegate* drive_delegate, scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, scoped_refptr<fileapi::ExternalMountPoints> mount_points, fileapi::ExternalMountPoints* system_mount_points) @@ -59,10 +59,10 @@ CrosMountPointProvider::CrosMountPointProvider( system_mount_points_(system_mount_points) { } -CrosMountPointProvider::~CrosMountPointProvider() { +FileSystemBackend::~FileSystemBackend() { } -void CrosMountPointProvider::AddSystemMountPoints() { +void FileSystemBackend::AddSystemMountPoints() { // RegisterFileSystem() is no-op if the mount point with the same name // already exists, hence it's safe to call without checking if a mount // point already exists or not. @@ -93,7 +93,7 @@ void CrosMountPointProvider::AddSystemMountPoints() { base::FilePath(FILE_PATH_LITERAL("/usr/share/oem"))); } -bool CrosMountPointProvider::CanHandleType(fileapi::FileSystemType type) const { +bool FileSystemBackend::CanHandleType(fileapi::FileSystemType type) const { switch (type) { case fileapi::kFileSystemTypeExternal: case fileapi::kFileSystemTypeDrive: @@ -106,7 +106,7 @@ bool CrosMountPointProvider::CanHandleType(fileapi::FileSystemType type) const { } } -void CrosMountPointProvider::OpenFileSystem( +void FileSystemBackend::OpenFileSystem( const GURL& origin_url, fileapi::FileSystemType type, fileapi::OpenFileSystemMode mode, @@ -116,12 +116,12 @@ void CrosMountPointProvider::OpenFileSystem( callback.Run(base::PLATFORM_FILE_OK); } -fileapi::FileSystemQuotaUtil* CrosMountPointProvider::GetQuotaUtil() { +fileapi::FileSystemQuotaUtil* FileSystemBackend::GetQuotaUtil() { // No quota support. return NULL; } -bool CrosMountPointProvider::IsAccessAllowed( +bool FileSystemBackend::IsAccessAllowed( const fileapi::FileSystemURL& url) const { if (!url.is_valid()) return false; @@ -147,7 +147,7 @@ bool CrosMountPointProvider::IsAccessAllowed( url.virtual_path()); } -void CrosMountPointProvider::GrantFullAccessToExtension( +void FileSystemBackend::GrantFullAccessToExtension( const std::string& extension_id) { DCHECK(special_storage_policy_->IsFileHandler(extension_id)); if (!special_storage_policy_->IsFileHandler(extension_id)) @@ -164,7 +164,7 @@ void CrosMountPointProvider::GrantFullAccessToExtension( } } -void CrosMountPointProvider::GrantFileAccessToExtension( +void FileSystemBackend::GrantFileAccessToExtension( const std::string& extension_id, const base::FilePath& virtual_path) { // All we care about here is access from extensions for now. DCHECK(special_storage_policy_->IsFileHandler(extension_id)); @@ -188,12 +188,12 @@ void CrosMountPointProvider::GrantFileAccessToExtension( file_access_permissions_->GrantAccessPermission(extension_id, virtual_path); } -void CrosMountPointProvider::RevokeAccessForExtension( +void FileSystemBackend::RevokeAccessForExtension( const std::string& extension_id) { file_access_permissions_->RevokePermissions(extension_id); } -std::vector<base::FilePath> CrosMountPointProvider::GetRootDirectories() const { +std::vector<base::FilePath> FileSystemBackend::GetRootDirectories() const { std::vector<fileapi::MountPoints::MountPointInfo> mount_points; mount_points_->AddMountPointInfosTo(&mount_points); system_mount_points_->AddMountPointInfosTo(&mount_points); @@ -204,14 +204,14 @@ std::vector<base::FilePath> CrosMountPointProvider::GetRootDirectories() const { return root_dirs; } -fileapi::FileSystemFileUtil* CrosMountPointProvider::GetFileUtil( +fileapi::FileSystemFileUtil* FileSystemBackend::GetFileUtil( fileapi::FileSystemType type) { DCHECK(type == fileapi::kFileSystemTypeNativeLocal || type == fileapi::kFileSystemTypeRestrictedNativeLocal); return local_file_util_->sync_file_util(); } -fileapi::AsyncFileUtil* CrosMountPointProvider::GetAsyncFileUtil( +fileapi::AsyncFileUtil* FileSystemBackend::GetAsyncFileUtil( fileapi::FileSystemType type) { if (type == fileapi::kFileSystemTypeDrive) return drive_delegate_->GetAsyncFileUtil(type); @@ -222,14 +222,14 @@ fileapi::AsyncFileUtil* CrosMountPointProvider::GetAsyncFileUtil( } fileapi::CopyOrMoveFileValidatorFactory* -CrosMountPointProvider::GetCopyOrMoveFileValidatorFactory( +FileSystemBackend::GetCopyOrMoveFileValidatorFactory( fileapi::FileSystemType type, base::PlatformFileError* error_code) { DCHECK(error_code); *error_code = base::PLATFORM_FILE_OK; return NULL; } -fileapi::FileSystemOperation* CrosMountPointProvider::CreateFileSystemOperation( +fileapi::FileSystemOperation* FileSystemBackend::CreateFileSystemOperation( const fileapi::FileSystemURL& url, fileapi::FileSystemContext* context, base::PlatformFileError* error_code) const { @@ -253,7 +253,7 @@ fileapi::FileSystemOperation* CrosMountPointProvider::CreateFileSystemOperation( } scoped_ptr<webkit_blob::FileStreamReader> -CrosMountPointProvider::CreateFileStreamReader( +FileSystemBackend::CreateFileStreamReader( const fileapi::FileSystemURL& url, int64 offset, const base::Time& expected_modification_time, @@ -274,7 +274,7 @@ CrosMountPointProvider::CreateFileStreamReader( } scoped_ptr<fileapi::FileStreamWriter> -CrosMountPointProvider::CreateFileStreamWriter( +FileSystemBackend::CreateFileStreamWriter( const fileapi::FileSystemURL& url, int64 offset, fileapi::FileSystemContext* context) const { @@ -295,14 +295,14 @@ CrosMountPointProvider::CreateFileStreamWriter( context->task_runners()->file_task_runner(), url.path(), offset)); } -bool CrosMountPointProvider::GetVirtualPath( +bool FileSystemBackend::GetVirtualPath( const base::FilePath& filesystem_path, base::FilePath* virtual_path) { return mount_points_->GetVirtualPath(filesystem_path, virtual_path) || system_mount_points_->GetVirtualPath(filesystem_path, virtual_path); } -base::FilePath CrosMountPointProvider::GetFileSystemRootPath( +base::FilePath FileSystemBackend::GetFileSystemRootPath( const fileapi::FileSystemURL& url) const { DCHECK(fileapi::IsolatedContext::IsIsolatedType(url.mount_type())); if (!url.is_valid()) diff --git a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.h b/chrome/browser/chromeos/fileapi/file_system_backend.h index 01d8891..22b1845 100644 --- a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.h +++ b/chrome/browser/chromeos/fileapi/file_system_backend.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ -#define CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ +#ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ +#define CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ #include <map> #include <string> @@ -13,7 +13,7 @@ #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/quota/special_storage_policy.h" #include "webkit/browser/webkit_storage_browser_export.h" #include "webkit/common/fileapi/file_system_types.h" @@ -29,11 +29,11 @@ class IsolatedContext; namespace chromeos { -class CrosMountPointProviderDelegate; +class FileSystemBackendDelegate; class FileAccessPermissions; -// CrosMountPointProvider is a Chrome OS specific implementation of -// ExternalFileSystemMountPointProvider. This class is responsible for a +// FileSystemBackend is a Chrome OS specific implementation of +// ExternalFileSystemBackend. This class is responsible for a // number of things, including: // // - Add system mount points @@ -64,21 +64,20 @@ class FileAccessPermissions; // // filesystem:<origin>/external/<mount_name>/... // -class CrosMountPointProvider - : public fileapi::ExternalFileSystemMountPointProvider { +class FileSystemBackend : public fileapi::ExternalFileSystemBackend { public: - using fileapi::FileSystemMountPointProvider::OpenFileSystemCallback; + using fileapi::FileSystemBackend::OpenFileSystemCallback; - // CrosMountPointProvider will take an ownership of a |mount_points| + // FileSystemBackend will take an ownership of a |mount_points| // reference. On the other hand, |system_mount_points| will be kept as a raw - // pointer and it should outlive CrosMountPointProvider instance. + // pointer and it should outlive FileSystemBackend instance. // The ownership of |drive_delegate| is also taken. - CrosMountPointProvider( - CrosMountPointProviderDelegate* drive_delegate, + FileSystemBackend( + FileSystemBackendDelegate* drive_delegate, scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, scoped_refptr<fileapi::ExternalMountPoints> mount_points, fileapi::ExternalMountPoints* system_mount_points); - virtual ~CrosMountPointProvider(); + virtual ~FileSystemBackend(); // Adds system mount points, such as "archive", and "removable". This // function is no-op if these mount points are already present. @@ -89,7 +88,7 @@ class CrosMountPointProvider // This could be called on any threads. static bool CanHandleURL(const fileapi::FileSystemURL& url); - // fileapi::FileSystemMountPointProvider overrides. + // fileapi::FileSystemBackend overrides. virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE; virtual void OpenFileSystem( const GURL& origin_url, @@ -119,7 +118,7 @@ class CrosMountPointProvider fileapi::FileSystemContext* context) const OVERRIDE; virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; - // fileapi::ExternalFileSystemMountPointProvider overrides. + // fileapi::ExternalFileSystemBackend overrides. virtual bool IsAccessAllowed(const fileapi::FileSystemURL& url) const OVERRIDE; virtual std::vector<base::FilePath> GetRootDirectories() const OVERRIDE; @@ -141,7 +140,7 @@ class CrosMountPointProvider scoped_ptr<fileapi::AsyncFileUtilAdapter> local_file_util_; // The Delegate instance for the drive file system related operation. - scoped_ptr<CrosMountPointProviderDelegate> drive_delegate_; + scoped_ptr<FileSystemBackendDelegate> drive_delegate_; // Mount points specific to the owning context (i.e. per-profile mount // points). @@ -157,12 +156,12 @@ class CrosMountPointProvider scoped_refptr<fileapi::ExternalMountPoints> mount_points_; // Globally visible mount points. System MountPonts instance should outlive - // all CrosMountPointProvider instances, so raw pointer is safe. + // all FileSystemBackend instances, so raw pointer is safe. fileapi::ExternalMountPoints* system_mount_points_; - DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); + DISALLOW_COPY_AND_ASSIGN(FileSystemBackend); }; } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ +#endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ diff --git a/chrome/browser/chromeos/fileapi/cros_mount_point_provider_delegate.h b/chrome/browser/chromeos/fileapi/file_system_backend_delegate.h index 9b99c4d..4367d2e 100644 --- a/chrome/browser/chromeos/fileapi/cros_mount_point_provider_delegate.h +++ b/chrome/browser/chromeos/fileapi/file_system_backend_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_DELEGATE_H_ -#define CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_DELEGATE_H_ +#ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_ +#define CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" @@ -29,29 +29,29 @@ class FileStreamReader; namespace chromeos { // This is delegate interface to inject the implementation of the some methods -// of CrosMountPointProvider. The main goal is to inject Drive File System. -class CrosMountPointProviderDelegate { +// of FileSystemBackend. The main goal is to inject Drive File System. +class FileSystemBackendDelegate { public: - virtual ~CrosMountPointProviderDelegate() {} + virtual ~FileSystemBackendDelegate() {} - // Called from CrosMountPointProvider::GetAsyncFileUtil(). + // Called from FileSystemBackend::GetAsyncFileUtil(). virtual fileapi::AsyncFileUtil* GetAsyncFileUtil( fileapi::FileSystemType type) = 0; - // Called from CrosMountPointProvider::CreateFileStreamReader(). + // Called from FileSystemBackend::CreateFileStreamReader(). virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( const fileapi::FileSystemURL& url, int64 offset, const base::Time& expected_modification_time, fileapi::FileSystemContext* context) = 0; - // Called from CrosMountPointProvider::CreateFileStreamWriter(). + // Called from FileSystemBackend::CreateFileStreamWriter(). virtual scoped_ptr<fileapi::FileStreamWriter> CreateFileStreamWriter( const fileapi::FileSystemURL& url, int64 offset, fileapi::FileSystemContext* context) = 0; - // Called from CrosMountPointProvider::CreateFileSystemOperation(). + // Called from FileSystemBackend::CreateFileSystemOperation(). // TODO(hidehiko): Get rid of this method when we merge the // {Remote,Local}FileSystemOperation. virtual fileapi::FileSystemOperation* CreateFileSystemOperation( @@ -62,4 +62,4 @@ class CrosMountPointProviderDelegate { } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_DELEGATE_H_ +#endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_ diff --git a/chrome/browser/chromeos/fileapi/cros_mount_point_provider_unittest.cc b/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc index 222e54c..0bef727 100644 --- a/chrome/browser/chromeos/fileapi/cros_mount_point_provider_unittest.cc +++ b/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/fileapi/cros_mount_point_provider.h" +#include "chrome/browser/chromeos/fileapi/file_system_backend.h" #include <set> @@ -33,18 +33,18 @@ FileSystemURL CreateFileSystemURL(const std::string& extension, base::FilePath::FromUTF8Unsafe(path)); } -TEST(CrosMountPointProviderTest, DefaultMountPoints) { +TEST(ChromeOSFileSystemBackendTest, DefaultMountPoints) { scoped_refptr<quota::SpecialStoragePolicy> storage_policy = new quota::MockSpecialStoragePolicy(); scoped_refptr<fileapi::ExternalMountPoints> mount_points( fileapi::ExternalMountPoints::CreateRefCounted()); - chromeos::CrosMountPointProvider provider( + chromeos::FileSystemBackend backend( NULL, // drive_delegate storage_policy, mount_points.get(), fileapi::ExternalMountPoints::GetSystemInstance()); - provider.AddSystemMountPoints(); - std::vector<base::FilePath> root_dirs = provider.GetRootDirectories(); + backend.AddSystemMountPoints(); + std::vector<base::FilePath> root_dirs = backend.GetRootDirectories(); std::set<base::FilePath> root_dirs_set(root_dirs.begin(), root_dirs.end()); // By default there should be 4 mount points (in system mount points): @@ -60,7 +60,7 @@ TEST(CrosMountPointProviderTest, DefaultMountPoints) { EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/usr/share/oem")))); } -TEST(CrosMountPointProviderTest, GetRootDirectories) { +TEST(ChromeOSFileSystemBackendTest, GetRootDirectories) { scoped_refptr<quota::SpecialStoragePolicy> storage_policy = new quota::MockSpecialStoragePolicy(); scoped_refptr<fileapi::ExternalMountPoints> mount_points( @@ -69,13 +69,13 @@ TEST(CrosMountPointProviderTest, GetRootDirectories) { scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( fileapi::ExternalMountPoints::CreateRefCounted()); - chromeos::CrosMountPointProvider provider( + chromeos::FileSystemBackend backend( NULL, // drive_delegate storage_policy, mount_points.get(), system_mount_points.get()); - const size_t initial_root_dirs_size = provider.GetRootDirectories().size(); + const size_t initial_root_dirs_size = backend.GetRootDirectories().size(); // Register 'local' test mount points. mount_points->RegisterFileSystem("c", @@ -93,7 +93,7 @@ TEST(CrosMountPointProviderTest, GetRootDirectories) { fileapi::kFileSystemTypeNativeLocal, base::FilePath(FPL("/g/d/e"))); - std::vector<base::FilePath> root_dirs = provider.GetRootDirectories(); + std::vector<base::FilePath> root_dirs = backend.GetRootDirectories(); std::set<base::FilePath> root_dirs_set(root_dirs.begin(), root_dirs.end()); EXPECT_EQ(initial_root_dirs_size + 4, root_dirs.size()); EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/a/b/c")))); @@ -102,7 +102,7 @@ TEST(CrosMountPointProviderTest, GetRootDirectories) { EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/g/d/e")))); } -TEST(CrosMountPointProviderTest, AccessPermissions) { +TEST(ChromeOSFileSystemBackendTest, AccessPermissions) { url_util::AddStandardScheme("chrome-extension"); scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy = @@ -111,7 +111,7 @@ TEST(CrosMountPointProviderTest, AccessPermissions) { fileapi::ExternalMountPoints::CreateRefCounted()); scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( fileapi::ExternalMountPoints::CreateRefCounted()); - chromeos::CrosMountPointProvider provider( + chromeos::FileSystemBackend backend( NULL, // drive_delegate storage_policy, mount_points.get(), @@ -135,47 +135,47 @@ TEST(CrosMountPointProviderTest, AccessPermissions) { fileapi::kFileSystemTypeRestrictedNativeLocal, base::FilePath(FPL("/usr/share/oem")))); - // Provider specific mount point access. - EXPECT_FALSE(provider.IsAccessAllowed( + // Backend specific mount point access. + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "removable/foo", mount_points.get()))); - provider.GrantFileAccessToExtension(extension, + backend.GrantFileAccessToExtension(extension, base::FilePath(FPL("removable/foo"))); - EXPECT_TRUE(provider.IsAccessAllowed( + EXPECT_TRUE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "removable/foo", mount_points.get()))); - EXPECT_FALSE(provider.IsAccessAllowed( + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "removable/foo1", mount_points.get()))); // System mount point access. - EXPECT_FALSE(provider.IsAccessAllowed( + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "system/foo", system_mount_points.get()))); - provider.GrantFileAccessToExtension(extension, + backend.GrantFileAccessToExtension(extension, base::FilePath(FPL("system/foo"))); - EXPECT_TRUE(provider.IsAccessAllowed( + EXPECT_TRUE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "system/foo", system_mount_points.get()))); - EXPECT_FALSE(provider.IsAccessAllowed( + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "system/foo1", system_mount_points.get()))); // oem is restricted file system. - provider.GrantFileAccessToExtension( + backend.GrantFileAccessToExtension( extension, base::FilePath(FPL("oem/foo"))); // The extension should not be able to access the file even if // GrantFileAccessToExtension was called. - EXPECT_FALSE(provider.IsAccessAllowed( + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "oem/foo", mount_points.get()))); - provider.GrantFullAccessToExtension(extension); + backend.GrantFullAccessToExtension(extension); // The extension should be able to access restricted file system after it was // granted full access. - EXPECT_TRUE(provider.IsAccessAllowed( + EXPECT_TRUE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "oem/foo", mount_points.get()))); // The extension which was granted full access should be able to access any // path on current file systems. - EXPECT_TRUE(provider.IsAccessAllowed( + EXPECT_TRUE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "removable/foo1", mount_points.get()))); - EXPECT_TRUE(provider.IsAccessAllowed( + EXPECT_TRUE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "system/foo1", system_mount_points.get()))); @@ -185,11 +185,11 @@ TEST(CrosMountPointProviderTest, AccessPermissions) { "test", fileapi::kFileSystemTypeNativeLocal, base::FilePath(FPL("/foo/test")))); - EXPECT_FALSE(provider.IsAccessAllowed( + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "test_/foo", mount_points.get()))); - provider.RevokeAccessForExtension(extension); - EXPECT_FALSE(provider.IsAccessAllowed( + backend.RevokeAccessForExtension(extension); + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "removable/foo", mount_points.get()))); fileapi::FileSystemURL internal_url = FileSystemURL::CreateForTest( @@ -197,17 +197,17 @@ TEST(CrosMountPointProviderTest, AccessPermissions) { fileapi::kFileSystemTypeExternal, base::FilePath(FPL("removable/"))); // Internal WebUI should have full access. - EXPECT_TRUE(provider.IsAccessAllowed(internal_url)); + EXPECT_TRUE(backend.IsAccessAllowed(internal_url)); } -TEST(CrosMountPointProvider, GetVirtualPathConflictWithSystemPoints) { +TEST(ChromeOSFileSystemBackendTest, GetVirtualPathConflictWithSystemPoints) { scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy = new quota::MockSpecialStoragePolicy(); scoped_refptr<fileapi::ExternalMountPoints> mount_points( fileapi::ExternalMountPoints::CreateRefCounted()); scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( fileapi::ExternalMountPoints::CreateRefCounted()); - chromeos::CrosMountPointProvider provider( + chromeos::FileSystemBackend backend( NULL, // drive_delegate storage_policy, mount_points.get(), @@ -215,7 +215,7 @@ TEST(CrosMountPointProvider, GetVirtualPathConflictWithSystemPoints) { const fileapi::FileSystemType type = fileapi::kFileSystemTypeNativeLocal; - // Provider specific mount points. + // Backend specific mount points. ASSERT_TRUE( mount_points->RegisterFileSystem("b", type, base::FilePath(FPL("/a/b")))); ASSERT_TRUE( @@ -256,7 +256,7 @@ TEST(CrosMountPointProvider, GetVirtualPathConflictWithSystemPoints) { base::FilePath virtual_path(FPL("/mount")); base::FilePath local_path(kTestCases[i].local_path); EXPECT_EQ(kTestCases[i].success, - provider.GetVirtualPath(local_path, &virtual_path)) + backend.GetVirtualPath(local_path, &virtual_path)) << "Resolving " << kTestCases[i].local_path; // There are no guarantees for |virtual_path| value if |GetVirtualPath| |