diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-18 16:50:23 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-18 16:50:23 +0000 |
commit | 4d03859f35564f067123732f26fa5d4d6bdd9158 (patch) | |
tree | 57ea640e65086e8964041d450b8f050cf6911714 /webkit/fileapi/file_system_mount_point_provider_unittest.cc | |
parent | a8d379cc2009e1104f6ac1d8796fe738cf41eee8 (diff) | |
download | chromium_src-4d03859f35564f067123732f26fa5d4d6bdd9158.zip chromium_src-4d03859f35564f067123732f26fa5d4d6bdd9158.tar.gz chromium_src-4d03859f35564f067123732f26fa5d4d6bdd9158.tar.bz2 |
Deprecate MountPointProvider::IsAccessAllowed in favor of GetPermissionPolicy
This deprecates:
- FileSystemMountPointProvider::IsAccessAllowed
- FileSystemMountPointProvider::IsRestrictedFileName
and merge the access checks used to be done by them into a single method:
FileSystemMountPointProvider::GetPermissionPolicy().
BUG=174550
TEST=CrosMountPointProviderTest.AccessPermissions, SandboxMountPointProviderTest.AccessPermissions
Review URL: https://codereview.chromium.org/12193007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183130 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_mount_point_provider_unittest.cc')
-rw-r--r-- | webkit/fileapi/file_system_mount_point_provider_unittest.cc | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/webkit/fileapi/file_system_mount_point_provider_unittest.cc b/webkit/fileapi/file_system_mount_point_provider_unittest.cc index c6f1c21..15be848 100644 --- a/webkit/fileapi/file_system_mount_point_provider_unittest.cc +++ b/webkit/fileapi/file_system_mount_point_provider_unittest.cc @@ -101,97 +101,6 @@ const struct CheckValidPathTest { { FILE_PATH_LITERAL("a/b/../c/.."), false, }, }; -const struct IsRestrictedNameTest { - base::FilePath::StringType name; - bool expected_dangerous; -} kIsRestrictedNameTestCases[] = { - // Names that contain strings that used to be restricted, but are now allowed. - { FILE_PATH_LITERAL("con"), false, }, - { FILE_PATH_LITERAL("Con.txt"), false, }, - { FILE_PATH_LITERAL("Prn.png"), false, }, - { FILE_PATH_LITERAL("AUX"), false, }, - { FILE_PATH_LITERAL("nUl."), false, }, - { FILE_PATH_LITERAL("coM1"), false, }, - { FILE_PATH_LITERAL("COM3.com"), false, }, - { FILE_PATH_LITERAL("cOM7"), false, }, - { FILE_PATH_LITERAL("com9"), false, }, - { FILE_PATH_LITERAL("lpT1"), false, }, - { FILE_PATH_LITERAL("LPT4.com"), false, }, - { FILE_PATH_LITERAL("lPT8"), false, }, - { FILE_PATH_LITERAL("lPT9"), false, }, - { FILE_PATH_LITERAL("com1."), false, }, - - // Similar cases that have always been allowed. - { FILE_PATH_LITERAL("con3"), false, }, - { FILE_PATH_LITERAL("PrnImage.png"), false, }, - { FILE_PATH_LITERAL("AUXX"), false, }, - { FILE_PATH_LITERAL("NULL"), false, }, - { FILE_PATH_LITERAL("coM0"), false, }, - { FILE_PATH_LITERAL("COM.com"), false, }, - { FILE_PATH_LITERAL("lpT0"), false, }, - { FILE_PATH_LITERAL("LPT.com"), false, }, - - // Ends with period or whitespace--used to be banned, now OK. - { FILE_PATH_LITERAL("b "), false, }, - { FILE_PATH_LITERAL("b\t"), false, }, - { FILE_PATH_LITERAL("b\n"), false, }, - { FILE_PATH_LITERAL("b\r\n"), false, }, - { FILE_PATH_LITERAL("b."), false, }, - { FILE_PATH_LITERAL("b.."), false, }, - - // Similar cases that have always been allowed. - { FILE_PATH_LITERAL("b c"), false, }, - { FILE_PATH_LITERAL("b\tc"), false, }, - { FILE_PATH_LITERAL("b\nc"), false, }, - { FILE_PATH_LITERAL("b\r\nc"), false, }, - { FILE_PATH_LITERAL("b c d e f"), false, }, - { FILE_PATH_LITERAL("b.c"), false, }, - { FILE_PATH_LITERAL("b..c"), false, }, - - // Name that has restricted chars in it. - { FILE_PATH_LITERAL("\\"), true, }, - { FILE_PATH_LITERAL("/"), true, }, - { FILE_PATH_LITERAL("a\\b"), true, }, - { FILE_PATH_LITERAL("a/b"), true, }, - { FILE_PATH_LITERAL("ab\\"), true, }, - { FILE_PATH_LITERAL("ab/"), true, }, - { FILE_PATH_LITERAL("\\ab"), true, }, - { FILE_PATH_LITERAL("/ab"), true, }, - { FILE_PATH_LITERAL("ab/.txt"), true, }, - { FILE_PATH_LITERAL("ab\\.txt"), true, }, - - // Names that contain chars that were formerly restricted, now OK. - { FILE_PATH_LITERAL("a<b"), false, }, - { FILE_PATH_LITERAL("a>b"), false, }, - { FILE_PATH_LITERAL("a:b"), false, }, - { FILE_PATH_LITERAL("a?b"), false, }, - { FILE_PATH_LITERAL("a|b"), false, }, - { FILE_PATH_LITERAL("ab<.txt"), false, }, - { FILE_PATH_LITERAL("ab>.txt"), false, }, - { FILE_PATH_LITERAL("ab:.txt"), false, }, - { FILE_PATH_LITERAL("ab?.txt"), false, }, - { FILE_PATH_LITERAL("ab|.txt"), false, }, - { FILE_PATH_LITERAL("<ab"), false, }, - { FILE_PATH_LITERAL(">ab"), false, }, - { FILE_PATH_LITERAL(":ab"), false, }, - { FILE_PATH_LITERAL("?ab"), false, }, - { FILE_PATH_LITERAL("|ab"), false, }, - - // Names that are restricted still. - { FILE_PATH_LITERAL(".."), true, }, - { FILE_PATH_LITERAL("."), true, }, - - // Similar but safe cases. - { FILE_PATH_LITERAL(" ."), false, }, - { FILE_PATH_LITERAL(". "), false, }, - { FILE_PATH_LITERAL(" . "), false, }, - { FILE_PATH_LITERAL(" .."), false, }, - { FILE_PATH_LITERAL(".. "), false, }, - { FILE_PATH_LITERAL(" .. "), false, }, - { FILE_PATH_LITERAL("b."), false, }, - { FILE_PATH_LITERAL(".b"), false, }, -}; - // For External filesystem. const base::FilePath::CharType kMountPoint[] = FILE_PATH_LITERAL("/tmp/testing"); const base::FilePath::CharType kRootPath[] = FILE_PATH_LITERAL("/tmp"); @@ -394,15 +303,4 @@ TEST_F(FileSystemMountPointProviderTest, GetRootPathFileURIWithAllowFlag) { } } -TEST_F(FileSystemMountPointProviderTest, IsRestrictedName) { - SetupNewContext(CreateDisallowFileAccessOptions()); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kIsRestrictedNameTestCases); ++i) { - SCOPED_TRACE(testing::Message() << "IsRestrictedName #" << i << " " - << kIsRestrictedNameTestCases[i].name); - base::FilePath name(kIsRestrictedNameTestCases[i].name); - EXPECT_EQ(kIsRestrictedNameTestCases[i].expected_dangerous, - provider(kFileSystemTypeTemporary)->IsRestrictedFileName(name)); - } -} - } // namespace fileapi |