#include "base/path_service.h"
#include "chromeos/dbus/cros_disks_client.h"
#include "content/public/test/mock_special_storage_policy.h"
+#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/fileapi/file_system_url.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/url_util.h"
-#include "webkit/browser/fileapi/external_mount_points.h"
-#include "webkit/browser/fileapi/file_system_url.h"
#define FPL(x) FILE_PATH_LITERAL(x)
-using fileapi::ExternalMountPoints;
-using fileapi::FileSystemURL;
+using storage::ExternalMountPoints;
+using storage::FileSystemURL;
namespace {
ExternalMountPoints* mount_points) {
return mount_points->CreateCrackedFileSystemURL(
GURL("chrome-extension://" + extension + "/"),
- fileapi::kFileSystemTypeExternal,
+ storage::kFileSystemTypeExternal,
base::FilePath::FromUTF8Unsafe(path));
}
TEST(ChromeOSFileSystemBackendTest, DefaultMountPoints) {
// Make sure no system-level mount points are registered before testing
// to avoid flakiness.
- fileapi::ExternalMountPoints::GetSystemInstance()->RevokeAllFileSystems();
+ storage::ExternalMountPoints::GetSystemInstance()->RevokeAllFileSystems();
- scoped_refptr<quota::SpecialStoragePolicy> storage_policy =
+ scoped_refptr<storage::SpecialStoragePolicy> storage_policy =
new content::MockSpecialStoragePolicy();
- scoped_refptr<fileapi::ExternalMountPoints> mount_points(
- fileapi::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<storage::ExternalMountPoints> mount_points(
+ storage::ExternalMountPoints::CreateRefCounted());
chromeos::FileSystemBackend backend(
NULL, // drive_delegate
NULL, // file_system_provider_delegate
NULL, // mtp_delegate
storage_policy,
mount_points.get(),
- fileapi::ExternalMountPoints::GetSystemInstance());
+ storage::ExternalMountPoints::GetSystemInstance());
backend.AddSystemMountPoints();
std::vector<base::FilePath> root_dirs = backend.GetRootDirectories();
std::set<base::FilePath> root_dirs_set(root_dirs.begin(), root_dirs.end());
}
TEST(ChromeOSFileSystemBackendTest, GetRootDirectories) {
- scoped_refptr<quota::SpecialStoragePolicy> storage_policy =
+ scoped_refptr<storage::SpecialStoragePolicy> storage_policy =
new content::MockSpecialStoragePolicy();
- scoped_refptr<fileapi::ExternalMountPoints> mount_points(
- fileapi::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<storage::ExternalMountPoints> mount_points(
+ storage::ExternalMountPoints::CreateRefCounted());
- scoped_refptr<fileapi::ExternalMountPoints> system_mount_points(
- fileapi::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<storage::ExternalMountPoints> system_mount_points(
+ storage::ExternalMountPoints::CreateRefCounted());
chromeos::FileSystemBackend backend(NULL, // drive_delegate
NULL, // file_system_provider_delegate
// Register 'local' test mount points.
mount_points->RegisterFileSystem("c",
- fileapi::kFileSystemTypeNativeLocal,
- fileapi::FileSystemMountOption(),
+ storage::kFileSystemTypeNativeLocal,
+ storage::FileSystemMountOption(),
base::FilePath(FPL("/a/b/c")));
mount_points->RegisterFileSystem("d",
- fileapi::kFileSystemTypeNativeLocal,
- fileapi::FileSystemMountOption(),
+ storage::kFileSystemTypeNativeLocal,
+ storage::FileSystemMountOption(),
base::FilePath(FPL("/b/c/d")));
// Register system test mount points.
system_mount_points->RegisterFileSystem("d",
- fileapi::kFileSystemTypeNativeLocal,
- fileapi::FileSystemMountOption(),
+ storage::kFileSystemTypeNativeLocal,
+ storage::FileSystemMountOption(),
base::FilePath(FPL("/g/c/d")));
system_mount_points->RegisterFileSystem("e",
- fileapi::kFileSystemTypeNativeLocal,
- fileapi::FileSystemMountOption(),
+ storage::kFileSystemTypeNativeLocal,
+ storage::FileSystemMountOption(),
base::FilePath(FPL("/g/d/e")));
std::vector<base::FilePath> root_dirs = backend.GetRootDirectories();
scoped_refptr<content::MockSpecialStoragePolicy> storage_policy =
new content::MockSpecialStoragePolicy();
- scoped_refptr<fileapi::ExternalMountPoints> mount_points(
- fileapi::ExternalMountPoints::CreateRefCounted());
- scoped_refptr<fileapi::ExternalMountPoints> system_mount_points(
- fileapi::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<storage::ExternalMountPoints> mount_points(
+ storage::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<storage::ExternalMountPoints> system_mount_points(
+ storage::ExternalMountPoints::CreateRefCounted());
chromeos::FileSystemBackend backend(NULL, // drive_delegate
NULL, // file_system_provider_delegate
NULL, // mtp_delegate
// Initialize mount points.
ASSERT_TRUE(system_mount_points->RegisterFileSystem(
"system",
- fileapi::kFileSystemTypeNativeLocal,
- fileapi::FileSystemMountOption(),
+ storage::kFileSystemTypeNativeLocal,
+ storage::FileSystemMountOption(),
base::FilePath(FPL("/g/system"))));
ASSERT_TRUE(mount_points->RegisterFileSystem(
"removable",
- fileapi::kFileSystemTypeNativeLocal,
- fileapi::FileSystemMountOption(),
+ storage::kFileSystemTypeNativeLocal,
+ storage::FileSystemMountOption(),
base::FilePath(FPL("/media/removable"))));
ASSERT_TRUE(mount_points->RegisterFileSystem(
"oem",
- fileapi::kFileSystemTypeRestrictedNativeLocal,
- fileapi::FileSystemMountOption(),
+ storage::kFileSystemTypeRestrictedNativeLocal,
+ storage::FileSystemMountOption(),
base::FilePath(FPL("/usr/share/oem"))));
// Backend specific mount point access.
// The extension cannot access new mount points.
// TODO(tbarzic): This should probably be changed.
- ASSERT_TRUE(mount_points->RegisterFileSystem(
- "test",
- fileapi::kFileSystemTypeNativeLocal,
- fileapi::FileSystemMountOption(),
- base::FilePath(FPL("/foo/test"))));
+ ASSERT_TRUE(
+ mount_points->RegisterFileSystem("test",
+ storage::kFileSystemTypeNativeLocal,
+ storage::FileSystemMountOption(),
+ base::FilePath(FPL("/foo/test"))));
EXPECT_FALSE(backend.IsAccessAllowed(
CreateFileSystemURL(extension, "test_/foo", mount_points.get())));
TEST(ChromeOSFileSystemBackendTest, GetVirtualPathConflictWithSystemPoints) {
scoped_refptr<content::MockSpecialStoragePolicy> storage_policy =
new content::MockSpecialStoragePolicy();
- scoped_refptr<fileapi::ExternalMountPoints> mount_points(
- fileapi::ExternalMountPoints::CreateRefCounted());
- scoped_refptr<fileapi::ExternalMountPoints> system_mount_points(
- fileapi::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<storage::ExternalMountPoints> mount_points(
+ storage::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<storage::ExternalMountPoints> system_mount_points(
+ storage::ExternalMountPoints::CreateRefCounted());
chromeos::FileSystemBackend backend(NULL, // drive_delegate
NULL, // file_system_provider_delegate
NULL, // mtp_delegate
mount_points.get(),
system_mount_points.get());
- const fileapi::FileSystemType type = fileapi::kFileSystemTypeNativeLocal;
- const fileapi::FileSystemMountOption option =
- fileapi::FileSystemMountOption();
+ const storage::FileSystemType type = storage::kFileSystemTypeNativeLocal;
+ const storage::FileSystemMountOption option =
+ storage::FileSystemMountOption();
// Backend specific mount points.
ASSERT_TRUE(mount_points->RegisterFileSystem(