OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/fileapi/file_system_util.h" | 5 #include "webkit/fileapi/file_system_util.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "webkit/fileapi/file_system_types.h" | 10 #include "webkit/fileapi/file_system_types.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 }; | 49 }; |
50 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { | 50 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { |
51 base::FilePath input = base::FilePath(test_cases[i].path); | 51 base::FilePath input = base::FilePath(test_cases[i].path); |
52 base::FilePath base_name = VirtualPath::BaseName(input); | 52 base::FilePath base_name = VirtualPath::BaseName(input); |
53 EXPECT_EQ(test_cases[i].base_name, base_name.value()); | 53 EXPECT_EQ(test_cases[i].base_name, base_name.value()); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 TEST_F(FileSystemUtilTest, GetNormalizedFilePath) { | 57 TEST_F(FileSystemUtilTest, GetNormalizedFilePath) { |
58 struct test_data { | 58 struct test_data { |
59 const FilePath::StringType path; | 59 const base::FilePath::StringType path; |
60 const FilePath::StringType normalized_path; | 60 const base::FilePath::StringType normalized_path; |
61 } test_cases[] = { | 61 } test_cases[] = { |
62 { FILE_PATH_LITERAL(""), FILE_PATH_LITERAL("/") }, | 62 { FILE_PATH_LITERAL(""), FILE_PATH_LITERAL("/") }, |
63 { FILE_PATH_LITERAL("/"), FILE_PATH_LITERAL("/") }, | 63 { FILE_PATH_LITERAL("/"), FILE_PATH_LITERAL("/") }, |
64 { FILE_PATH_LITERAL("foo/bar"), FILE_PATH_LITERAL("/foo/bar") }, | 64 { FILE_PATH_LITERAL("foo/bar"), FILE_PATH_LITERAL("/foo/bar") }, |
65 { FILE_PATH_LITERAL("/foo/bar"), FILE_PATH_LITERAL("/foo/bar") } | 65 { FILE_PATH_LITERAL("/foo/bar"), FILE_PATH_LITERAL("/foo/bar") } |
66 }; | 66 }; |
67 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { | 67 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { |
68 FilePath input = FilePath(test_cases[i].path); | 68 base::FilePath input = base::FilePath(test_cases[i].path); |
69 FilePath::StringType normalized_path_string = | 69 base::FilePath::StringType normalized_path_string = |
70 VirtualPath::GetNormalizedFilePath(input); | 70 VirtualPath::GetNormalizedFilePath(input); |
71 EXPECT_EQ(test_cases[i].normalized_path, normalized_path_string); | 71 EXPECT_EQ(test_cases[i].normalized_path, normalized_path_string); |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 TEST_F(FileSystemUtilTest, IsAbsolutePath) { | 75 TEST_F(FileSystemUtilTest, IsAbsolutePath) { |
76 EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/"))); | 76 EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/"))); |
77 EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/foo/bar"))); | 77 EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/foo/bar"))); |
78 EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL(""))); | 78 EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL(""))); |
79 EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("foo/bar"))); | 79 EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("foo/bar"))); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 EXPECT_FALSE(CrackIsolatedFileSystemName("fooIsolatedbar", &fsid)); | 143 EXPECT_FALSE(CrackIsolatedFileSystemName("fooIsolatedbar", &fsid)); |
144 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Persistent", &fsid)); | 144 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Persistent", &fsid)); |
145 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Temporary", &fsid)); | 145 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Temporary", &fsid)); |
146 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:External", &fsid)); | 146 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:External", &fsid)); |
147 EXPECT_FALSE(CrackIsolatedFileSystemName(":Isolated_bar", &fsid)); | 147 EXPECT_FALSE(CrackIsolatedFileSystemName(":Isolated_bar", &fsid)); |
148 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Isolated_", &fsid)); | 148 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Isolated_", &fsid)); |
149 } | 149 } |
150 | 150 |
151 } // namespace (anonymous) | 151 } // namespace (anonymous) |
152 } // namespace fileapi | 152 } // namespace fileapi |
OLD | NEW |