summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi
diff options
context:
space:
mode:
authorbrianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-05 22:46:25 +0000
committerbrianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-05 22:46:25 +0000
commita81ba5872da240df6277e3238b2fc91468c834bb (patch)
tree49ecc2ec0a79172a2dd494840057f8c1c1c67bf7 /webkit/fileapi
parent4e4059260027f10633df040d26ab9116a63322e8 (diff)
downloadchromium_src-a81ba5872da240df6277e3238b2fc91468c834bb.zip
chromium_src-a81ba5872da240df6277e3238b2fc91468c834bb.tar.gz
chromium_src-a81ba5872da240df6277e3238b2fc91468c834bb.tar.bz2
Revert 180688 due to faiulres on asan bots
BUG=174476 > Add Utility functions to Normalize and check for Absolute Virtual Paths. > > BUG=173627 > TEST= > content_unittests FileSystemUtilTest.GetNormalizedFilePath > content_unittests FileSystemUtilTest.IsAbsolutePath > > > Review URL: https://chromiumcodereview.appspot.com/12088105 TBR=calvinlo@chromium.org Review URL: https://codereview.chromium.org/12236002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180804 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi')
-rw-r--r--webkit/fileapi/file_system_util.cc20
-rw-r--r--webkit/fileapi/file_system_util.h17
-rw-r--r--webkit/fileapi/file_system_util_unittest.cc25
3 files changed, 3 insertions, 59 deletions
diff --git a/webkit/fileapi/file_system_util.cc b/webkit/fileapi/file_system_util.cc
index cb12822..7e017f7 100644
--- a/webkit/fileapi/file_system_util.cc
+++ b/webkit/fileapi/file_system_util.cc
@@ -25,9 +25,6 @@ const char kIsolatedDir[] = "/isolated";
const char kExternalDir[] = "/external";
const char kTestDir[] = "/test";
-const FilePath::CharType VirtualPath::kRoot[] = FILE_PATH_LITERAL("/");
-const FilePath::CharType VirtualPath::kSeparator = FILE_PATH_LITERAL('/');
-
// TODO(ericu): Consider removing support for '\', even on Windows, if possible.
// There's a lot of test code that will need reworking, and we may have trouble
// with base::FilePath elsewhere [e.g. DirName and other methods may also need
@@ -73,23 +70,6 @@ void VirtualPath::GetComponents(
std::vector<base::FilePath::StringType>(ret_val.rbegin(), ret_val.rend());
}
-FilePath::StringType VirtualPath::GetNormalizedFilePath(const FilePath& path) {
- FilePath::StringType normalized_path = path.value();
- const size_t num_separators = ARRAYSIZE_UNSAFE(
- static_cast<const FilePath::CharType*>(FilePath::kSeparators));
- for (size_t i = 1; i < num_separators; ++i) {
- std::replace(normalized_path.begin(), normalized_path.end(),
- FilePath::kSeparators[i], kSeparator);
- }
-
- return (IsAbsolute(normalized_path)) ?
- normalized_path : FilePath::StringType(kRoot) + normalized_path;
-}
-
-bool VirtualPath::IsAbsolute(const FilePath::StringType& path) {
- return path.find(kRoot) == 0;
-}
-
GURL GetFileSystemRootURI(const GURL& origin_url, FileSystemType type) {
// origin_url is based on a security origin, so http://foo.com or file:///
// instead of the corresponding filesystem URL.
diff --git a/webkit/fileapi/file_system_util.h b/webkit/fileapi/file_system_util.h
index 6ba6dee..be863bf 100644
--- a/webkit/fileapi/file_system_util.h
+++ b/webkit/fileapi/file_system_util.h
@@ -27,13 +27,9 @@ extern const char kTestDir[];
class WEBKIT_STORAGE_EXPORT VirtualPath {
public:
- static const FilePath::CharType kRoot[];
- static const FilePath::CharType kSeparator;
-
- // Use this instead of base::FilePath::BaseName when operating on virtual
- // paths. base::FilePath::BaseName will get confused by ':' on Windows when it
- // looks like a drive letter separator; this will treat it as just another
- // character.
+ // Use this instead of base::FilePath::BaseName when operating on virtual paths.
+ // base::FilePath::BaseName will get confused by ':' on Windows when it looks like a
+ // drive letter separator; this will treat it as just another character.
static base::FilePath BaseName(const base::FilePath& virtual_path);
// Likewise, use this instead of base::FilePath::GetComponents when operating on
@@ -42,13 +38,6 @@ class WEBKIT_STORAGE_EXPORT VirtualPath {
// not evaluate '.' or '..' components.
static void GetComponents(const base::FilePath& path,
std::vector<base::FilePath::StringType>* components);
-
- // Returns a path name ensuring that it begins with kRoot and all path
- // separators are forward slashes /.
- static FilePath::StringType GetNormalizedFilePath(const FilePath& path);
-
- // Returns true if the given path begins with kRoot.
- static bool IsAbsolute(const FilePath::StringType& path);
};
// Returns the root URI of the filesystem that can be specified by a pair of
diff --git a/webkit/fileapi/file_system_util_unittest.cc b/webkit/fileapi/file_system_util_unittest.cc
index 3bf54fb..0fd4f0a 100644
--- a/webkit/fileapi/file_system_util_unittest.cc
+++ b/webkit/fileapi/file_system_util_unittest.cc
@@ -54,31 +54,6 @@ TEST_F(FileSystemUtilTest, VirtualPathBaseName) {
}
}
-TEST_F(FileSystemUtilTest, GetNormalizedFilePath) {
- struct test_data {
- const FilePath::StringType path;
- const FilePath::StringType normalized_path;
- } test_cases[] = {
- { FILE_PATH_LITERAL(""), FILE_PATH_LITERAL("/") },
- { FILE_PATH_LITERAL("/"), FILE_PATH_LITERAL("/") },
- { FILE_PATH_LITERAL("foo/bar"), FILE_PATH_LITERAL("/foo/bar") },
- { FILE_PATH_LITERAL("/foo/bar"), FILE_PATH_LITERAL("/foo/bar") }
- };
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
- FilePath input = FilePath(test_cases[i].path);
- FilePath::StringType normalized_path_string =
- VirtualPath::GetNormalizedFilePath(input);
- EXPECT_EQ(test_cases[i].normalized_path, normalized_path_string);
- }
-}
-
-TEST_F(FileSystemUtilTest, IsAbsolutePath) {
- EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/")));
- EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/foo/bar")));
- EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("")));
- EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("foo/bar")));
-}
-
TEST_F(FileSystemUtilTest, VirtualPathGetComponents) {
struct test_data {
const base::FilePath::StringType path;