Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc

Issue 11787028: New FileSystemURL cracking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Couple of nits I noticed Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..b5865846da29cf194c14331ba9f26eae15bcf95f 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) {
+ return mount_points->CreateCrackedFileSystemURL(
+ GURL("chrome-extension://" + extension + "/"),
+ fileapi::kFileSystemTypeExternal,
+ FilePath::FromUTF8Unsafe(path));
}
TEST(CrosMountPointProviderTest, DefaultMountPoints) {
@@ -200,56 +205,58 @@ 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,
- FilePath(FPL("removable/")));
+ fileapi::FileSystemURL internal_url = FileSystemURL::CreateForTest(
+ GURL("chrome://foo"),
+ fileapi::kFileSystemTypeExternal,
+ FilePath(FPL("removable/")));
// Internal WebUI should have full access.
EXPECT_TRUE(provider.IsAccessAllowed(internal_url));
}

Powered by Google App Engine
This is Rietveld 408576698