Index: webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc |
diff --git a/webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc b/webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc |
index 3dfda44de853bf542ee34beeaa8e194d0c4fce0d..999d0da76c5c4e90eceff549ffa82978f0e34f66 100644 |
--- a/webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc |
+++ b/webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc |
@@ -16,13 +16,18 @@ |
#define FPL(x) FILE_PATH_LITERAL(x) |
+using fileapi::ExternalMountPoints; |
+using fileapi::FileSystemURL; |
+ |
namespace { |
-fileapi::FileSystemURL CreateFileSystemURL(const std::string& extension, |
- const char* path) { |
- return fileapi::FileSystemURL(GURL("chrome-extension://" + extension + "/"), |
- fileapi::kFileSystemTypeNativeLocal, |
- FilePath::FromUTF8Unsafe(path)); |
+FileSystemURL CreateFileSystemURL(const std::string& extension, |
+ const char* path, |
+ ExternalMountPoints* mount_points) { |
+ FileSystemURL url(GURL("chrome-extension://" + extension + "/"), |
+ fileapi::kFileSystemTypeExternal, |
+ FilePath::FromUTF8Unsafe(path)); |
+ return mount_points->CrackURL(url); |
} |
TEST(CrosMountPointProviderTest, DefaultMountPoints) { |
@@ -200,52 +205,53 @@ TEST(CrosMountPointProviderTest, AccessPermissions) { |
// Provider specific mount point access. |
EXPECT_FALSE(provider.IsAccessAllowed( |
- CreateFileSystemURL(extension, "removable/foo"))); |
+ CreateFileSystemURL(extension, "removable/foo", mount_points.get()))); |
provider.GrantFileAccessToExtension(extension, |
FilePath(FPL("removable/foo"))); |
EXPECT_TRUE(provider.IsAccessAllowed( |
- CreateFileSystemURL(extension, "removable/foo"))); |
+ CreateFileSystemURL(extension, "removable/foo", mount_points.get()))); |
EXPECT_FALSE(provider.IsAccessAllowed( |
- CreateFileSystemURL(extension, "removable/foo1"))); |
+ CreateFileSystemURL(extension, "removable/foo1", mount_points.get()))); |
// System mount point access. |
EXPECT_FALSE(provider.IsAccessAllowed( |
- CreateFileSystemURL(extension, "system/foo"))); |
+ CreateFileSystemURL(extension, "system/foo", system_mount_points.get()))); |
provider.GrantFileAccessToExtension(extension, FilePath(FPL("system/foo"))); |
EXPECT_TRUE(provider.IsAccessAllowed( |
- CreateFileSystemURL(extension, "system/foo"))); |
- EXPECT_FALSE(provider.IsAccessAllowed( |
- CreateFileSystemURL(extension, "system/foo1"))); |
+ CreateFileSystemURL(extension, "system/foo", system_mount_points.get()))); |
+ EXPECT_FALSE(provider.IsAccessAllowed(CreateFileSystemURL( |
+ extension, "system/foo1", system_mount_points.get()))); |
// oem is restricted file system. |
provider.GrantFileAccessToExtension(extension, FilePath(FPL("oem/foo"))); |
// The extension should not be able to access the file even if |
// GrantFileAccessToExtension was called. |
EXPECT_FALSE(provider.IsAccessAllowed( |
- CreateFileSystemURL(extension, "oem/foo"))); |
+ CreateFileSystemURL(extension, "oem/foo", mount_points.get()))); |
provider.GrantFullAccessToExtension(extension); |
// The extension should be able to access restricted file system after it was |
// granted full access. |
EXPECT_TRUE(provider.IsAccessAllowed( |
- CreateFileSystemURL(extension, "oem/foo"))); |
+ 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( |
- CreateFileSystemURL(extension, "removable/foo1"))); |
+ // path on curent file systems. |
EXPECT_TRUE(provider.IsAccessAllowed( |
- CreateFileSystemURL(extension, "system/foo1"))); |
+ CreateFileSystemURL(extension, "removable/foo1", mount_points.get()))); |
+ EXPECT_TRUE(provider.IsAccessAllowed(CreateFileSystemURL( |
+ extension, "system/foo1", system_mount_points.get()))); |
- // The extension still cannot access new mount points. |
+ // The extension cannot access new mount points. |
+ // TODO(tbarzic): This should probably be changed. |
ASSERT_TRUE(provider.AddLocalMountPoint(FilePath(FPL("/foo/test")))); |
EXPECT_FALSE(provider.IsAccessAllowed( |
- CreateFileSystemURL(extension, "test_/foo"))); |
+ CreateFileSystemURL(extension, "test_/foo", mount_points.get()))); |
provider.RevokeAccessForExtension(extension); |
EXPECT_FALSE(provider.IsAccessAllowed( |
- CreateFileSystemURL(extension, "removable/foo"))); |
+ CreateFileSystemURL(extension, "removable/foo", mount_points.get()))); |
fileapi::FileSystemURL internal_url(GURL("chrome://foo"), |
fileapi::kFileSystemTypeExternal, |