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/files/file_path.h" | 7 #include "base/files/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_url.h" | 10 #include "webkit/fileapi/file_system_url.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 base::FilePath input = base::FilePath(test_cases[i].path); | 108 base::FilePath input = base::FilePath(test_cases[i].path); |
109 base::FilePath::StringType normalized_path_string = | 109 base::FilePath::StringType normalized_path_string = |
110 VirtualPath::GetNormalizedFilePath(input); | 110 VirtualPath::GetNormalizedFilePath(input); |
111 EXPECT_EQ(test_cases[i].normalized_path, normalized_path_string); | 111 EXPECT_EQ(test_cases[i].normalized_path, normalized_path_string); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 TEST_F(FileSystemUtilTest, IsAbsolutePath) { | 115 TEST_F(FileSystemUtilTest, IsAbsolutePath) { |
116 EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/"))); | 116 EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/"))); |
117 EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/foo/bar"))); | 117 EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/foo/bar"))); |
118 EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL(""))); | 118 EXPECT_FALSE(VirtualPath::IsAbsolute(base::FilePath::StringType())); |
119 EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("foo/bar"))); | 119 EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("foo/bar"))); |
120 } | 120 } |
121 | 121 |
122 TEST_F(FileSystemUtilTest, VirtualPathGetComponents) { | 122 TEST_F(FileSystemUtilTest, VirtualPathGetComponents) { |
123 struct test_data { | 123 struct test_data { |
124 const base::FilePath::StringType path; | 124 const base::FilePath::StringType path; |
125 size_t count; | 125 size_t count; |
126 const base::FilePath::StringType components[3]; | 126 const base::FilePath::StringType components[3]; |
127 } test_cases[] = { | 127 } test_cases[] = { |
128 { FILE_PATH_LITERAL("foo/bar"), | 128 { FILE_PATH_LITERAL("foo/bar"), |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 EXPECT_TRUE(AreSameFileSystem(url_foo_temp_a, url_foo_temp_a)); | 216 EXPECT_TRUE(AreSameFileSystem(url_foo_temp_a, url_foo_temp_a)); |
217 EXPECT_TRUE(AreSameFileSystem(url_foo_temp_a, url_foo_temp_b)); | 217 EXPECT_TRUE(AreSameFileSystem(url_foo_temp_a, url_foo_temp_b)); |
218 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_foo_perm_a)); | 218 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_foo_perm_a)); |
219 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_bar_temp_a)); | 219 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_bar_temp_a)); |
220 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_bar_perm_a)); | 220 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_bar_perm_a)); |
221 } | 221 } |
222 | 222 |
223 } // namespace (anonymous) | 223 } // namespace (anonymous) |
224 } // namespace fileapi | 224 } // namespace fileapi |
OLD | NEW |