OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/fileapi/file_system_util.h" | 5 #include "webkit/common/fileapi/file_system_util.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
10 | 10 |
11 using fileapi::CrackIsolatedFileSystemName; | 11 using fileapi::CrackIsolatedFileSystemName; |
12 using fileapi::FileSystemType; | |
13 using fileapi::GetExternalFileSystemRootURIString; | 12 using fileapi::GetExternalFileSystemRootURIString; |
14 using fileapi::GetIsolatedFileSystemName; | 13 using fileapi::GetIsolatedFileSystemName; |
15 using fileapi::GetIsolatedFileSystemRootURIString; | 14 using fileapi::GetIsolatedFileSystemRootURIString; |
16 using fileapi::ValidateIsolatedFileSystemId; | 15 using fileapi::ValidateIsolatedFileSystemId; |
17 using fileapi::VirtualPath; | 16 using fileapi::VirtualPath; |
18 | 17 |
19 namespace content { | 18 namespace content { |
20 namespace { | 19 namespace { |
21 | 20 |
22 class FileSystemUtilTest : public testing::Test {}; | 21 class FileSystemUtilTest : public testing::Test {}; |
23 | 22 |
24 TEST_F(FileSystemUtilTest, ParseFileSystemSchemeURL) { | 23 TEST_F(FileSystemUtilTest, ParseFileSystemSchemeURL) { |
25 GURL uri("filesystem:http://chromium.org/temporary/foo/bar"); | 24 GURL uri("filesystem:http://chromium.org/temporary/foo/bar"); |
26 GURL origin_url; | 25 GURL origin_url; |
27 FileSystemType type; | 26 fileapi::FileSystemType type; |
28 base::FilePath virtual_path; | 27 base::FilePath virtual_path; |
29 ParseFileSystemSchemeURL(uri, &origin_url, &type, &virtual_path); | 28 ParseFileSystemSchemeURL(uri, &origin_url, &type, &virtual_path); |
30 EXPECT_EQ(GURL("http://chromium.org"), origin_url); | 29 EXPECT_EQ(GURL("http://chromium.org"), origin_url); |
31 EXPECT_EQ(fileapi::kFileSystemTypeTemporary, type); | 30 EXPECT_EQ(fileapi::kFileSystemTypeTemporary, type); |
32 #if defined(FILE_PATH_USES_WIN_SEPARATORS) | 31 #if defined(FILE_PATH_USES_WIN_SEPARATORS) |
33 base::FilePath expected_path(FILE_PATH_LITERAL("foo\\bar")); | 32 base::FilePath expected_path(FILE_PATH_LITERAL("foo\\bar")); |
34 #else | 33 #else |
35 base::FilePath expected_path(FILE_PATH_LITERAL("foo/bar")); | 34 base::FilePath expected_path(FILE_PATH_LITERAL("foo/bar")); |
36 #endif | 35 #endif |
37 EXPECT_EQ(expected_path, virtual_path); | 36 EXPECT_EQ(expected_path, virtual_path); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 // Percents must be escaped, otherwise they will be unintentionally unescaped. | 298 // Percents must be escaped, otherwise they will be unintentionally unescaped. |
300 const std::string kMountName = "X%20Y"; | 299 const std::string kMountName = "X%20Y"; |
301 | 300 |
302 const std::string url_string = | 301 const std::string url_string = |
303 GetExternalFileSystemRootURIString(kOriginURL, kMountName); | 302 GetExternalFileSystemRootURIString(kOriginURL, kMountName); |
304 EXPECT_EQ("filesystem:http://foo/external/X%2520Y/", url_string); | 303 EXPECT_EQ("filesystem:http://foo/external/X%2520Y/", url_string); |
305 } | 304 } |
306 | 305 |
307 } // namespace | 306 } // namespace |
308 } // namespace content | 307 } // namespace content |
OLD | NEW |