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_url.h" | 5 #include "webkit/fileapi/file_system_url.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/external_mount_points.h" |
10 #include "webkit/fileapi/file_system_types.h" | 11 #include "webkit/fileapi/file_system_types.h" |
11 #include "webkit/fileapi/file_system_util.h" | 12 #include "webkit/fileapi/file_system_util.h" |
12 #include "webkit/fileapi/isolated_context.h" | 13 #include "webkit/fileapi/isolated_context.h" |
13 #include "webkit/fileapi/syncable/syncable_file_system_util.h" | 14 #include "webkit/fileapi/syncable/syncable_file_system_util.h" |
14 | 15 |
15 #define FPL FILE_PATH_LITERAL | 16 #define FPL FILE_PATH_LITERAL |
16 | 17 |
| 18 #if defined(FILE_PATH_USES_DRIVE_LETTERS) |
| 19 #define DRIVE FPL("C:") |
| 20 #else |
| 21 #define DRIVE FPL("/a/") |
| 22 #endif |
| 23 |
17 namespace fileapi { | 24 namespace fileapi { |
18 | 25 |
19 namespace { | 26 namespace { |
20 | 27 |
21 FileSystemURL CreateFileSystemURL(const std::string& url_string) { | 28 FileSystemURL CreateFileSystemURL(const std::string& url_string) { |
22 return FileSystemURL(GURL(url_string)); | 29 return FileSystemURL(GURL(url_string)); |
23 } | 30 } |
24 | 31 |
25 std::string NormalizedUTF8Path(const FilePath& path) { | 32 std::string NormalizedUTF8Path(const FilePath& path) { |
26 return path.NormalizePathSeparators().AsUTF8Unsafe(); | 33 return path.NormalizePathSeparators().AsUTF8Unsafe(); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 214 |
208 TEST(FileSystemURLTest, DebugString) { | 215 TEST(FileSystemURLTest, DebugString) { |
209 const GURL kOrigin("http://example.com"); | 216 const GURL kOrigin("http://example.com"); |
210 const FilePath kPath(FPL("dir/file")); | 217 const FilePath kPath(FPL("dir/file")); |
211 | 218 |
212 const FileSystemURL kURL1(kOrigin, kFileSystemTypeTemporary, kPath); | 219 const FileSystemURL kURL1(kOrigin, kFileSystemTypeTemporary, kPath); |
213 EXPECT_EQ("filesystem:http://example.com/temporary/" + | 220 EXPECT_EQ("filesystem:http://example.com/temporary/" + |
214 NormalizedUTF8Path(kPath), | 221 NormalizedUTF8Path(kPath), |
215 kURL1.DebugString()); | 222 kURL1.DebugString()); |
216 | 223 |
217 const FilePath kRoot(FPL("root")); | 224 const FilePath kRoot(DRIVE FPL("/root")); |
218 ScopedExternalFileSystem scoped_fs("foo", kFileSystemTypeNativeLocal, kRoot); | 225 ScopedExternalFileSystem scoped_fs("foo", |
| 226 kFileSystemTypeNativeLocal, |
| 227 kRoot.NormalizePathSeparators()); |
219 const FileSystemURL kURL2(kOrigin, kFileSystemTypeExternal, | 228 const FileSystemURL kURL2(kOrigin, kFileSystemTypeExternal, |
220 scoped_fs.GetVirtualRootPath().Append(kPath)); | 229 scoped_fs.GetVirtualRootPath().Append(kPath)); |
221 EXPECT_EQ("filesystem:http://example.com/external/" + | 230 EXPECT_EQ("filesystem:http://example.com/external/" + |
222 NormalizedUTF8Path(scoped_fs.GetVirtualRootPath().Append(kPath)) + | 231 NormalizedUTF8Path(scoped_fs.GetVirtualRootPath().Append(kPath)) + |
223 " (NativeLocal@foo:" + | 232 " (NativeLocal@foo:" + |
224 NormalizedUTF8Path(kRoot.Append(kPath)) + ")", | 233 NormalizedUTF8Path(kRoot.Append(kPath)) + ")", |
225 kURL2.DebugString()); | 234 kURL2.DebugString()); |
226 } | 235 } |
227 | 236 |
228 } // namespace fileapi | 237 } // namespace fileapi |
OLD | NEW |