diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-16 17:35:53 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-16 17:35:53 +0000 |
commit | 7ade66ee96e10961c139f7dca3d5d1a2533d384b (patch) | |
tree | 4e88b1ca1756274613e3d19673d5c916c8b170f3 /content/browser/fileapi/file_system_context_unittest.cc | |
parent | 9387be62811e69378718bd7c2e4c8ef837efd0dc (diff) | |
download | chromium_src-7ade66ee96e10961c139f7dca3d5d1a2533d384b.zip chromium_src-7ade66ee96e10961c139f7dca3d5d1a2533d384b.tar.gz chromium_src-7ade66ee96e10961c139f7dca3d5d1a2533d384b.tar.bz2 |
Change fileapi namespace to content for test files that are moved under content/
Note that this temporarily adds some content:: notion in webkit/ (mostly for friend'ing / forward decls)
This also includes some refactoring in some test code (namely obfuscated_file_util_unittest.cc) to work around
cross-namespace friend'ing.
BUG=265769
TEST=build
TBR=mmenke
Review URL: https://codereview.chromium.org/137923003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/fileapi/file_system_context_unittest.cc')
-rw-r--r-- | content/browser/fileapi/file_system_context_unittest.cc | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/content/browser/fileapi/file_system_context_unittest.cc b/content/browser/fileapi/file_system_context_unittest.cc index 43003ad..f989ed7 100644 --- a/content/browser/fileapi/file_system_context_unittest.cc +++ b/content/browser/fileapi/file_system_context_unittest.cc @@ -23,7 +23,15 @@ #define DRIVE #endif -namespace fileapi { +using fileapi::ExternalMountPoints; +using fileapi::FileSystemBackend; +using fileapi::FileSystemContext; +using fileapi::FileSystemMountOption; +using fileapi::FileSystemType; +using fileapi::FileSystemURL; +using fileapi::IsolatedContext; + +namespace content { namespace { @@ -57,7 +65,7 @@ class FileSystemContextTest : public testing::Test { protected: FileSystemContext* CreateFileSystemContextForTest( - ExternalMountPoints* external_mount_points) { + fileapi::ExternalMountPoints* external_mount_points) { return new FileSystemContext(base::MessageLoopProxy::current().get(), base::MessageLoopProxy::current().get(), external_mount_points, @@ -104,13 +112,13 @@ TEST_F(FileSystemContextTest, NullExternalMountPoints) { std::string isolated_name = "root"; std::string isolated_id = IsolatedContext::GetInstance()->RegisterFileSystemForPath( - kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeNativeLocal, base::FilePath(DRIVE FPL("/test/isolated/root")), &isolated_name); // Register system external mount point. ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( "system", - kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeNativeLocal, FileSystemMountOption(), base::FilePath(DRIVE FPL("/test/sys/")))); @@ -120,8 +128,8 @@ TEST_F(FileSystemContextTest, NullExternalMountPoints) { ExpectFileSystemURLMatches( cracked_isolated, GURL(kTestOrigin), - kFileSystemTypeIsolated, - kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeIsolated, + fileapi::kFileSystemTypeNativeLocal, base::FilePath( DRIVE FPL("/test/isolated/root/file")).NormalizePathSeparators(), base::FilePath::FromUTF8Unsafe(isolated_id).Append(FPL("root/file")). @@ -134,8 +142,8 @@ TEST_F(FileSystemContextTest, NullExternalMountPoints) { ExpectFileSystemURLMatches( cracked_external, GURL(kTestOrigin), - kFileSystemTypeExternal, - kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeExternal, + fileapi::kFileSystemTypeNativeLocal, base::FilePath( DRIVE FPL("/test/sys/root/file")).NormalizePathSeparators(), base::FilePath(FPL("system/root/file")).NormalizePathSeparators(), @@ -154,7 +162,7 @@ TEST_F(FileSystemContextTest, FileSystemContextKeepsMountPointsAlive) { // Register system external mount point. ASSERT_TRUE(mount_points->RegisterFileSystem( "system", - kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeNativeLocal, FileSystemMountOption(), base::FilePath(DRIVE FPL("/test/sys/")))); @@ -172,8 +180,8 @@ TEST_F(FileSystemContextTest, FileSystemContextKeepsMountPointsAlive) { ExpectFileSystemURLMatches( cracked_external, GURL(kTestOrigin), - kFileSystemTypeExternal, - kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeExternal, + fileapi::kFileSystemTypeNativeLocal, base::FilePath( DRIVE FPL("/test/sys/root/file")).NormalizePathSeparators(), base::FilePath(FPL("system/root/file")).NormalizePathSeparators(), @@ -193,32 +201,32 @@ TEST_F(FileSystemContextTest, CrackFileSystemURL) { std::string isolated_file_system_name = "root"; const std::string kIsolatedFileSystemID = IsolatedContext::GetInstance()->RegisterFileSystemForPath( - kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeNativeLocal, base::FilePath(DRIVE FPL("/test/isolated/root")), &isolated_file_system_name); // Register system external mount point. ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( "system", - kFileSystemTypeDrive, + fileapi::kFileSystemTypeDrive, FileSystemMountOption(), base::FilePath(DRIVE FPL("/test/sys/")))); ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( "ext", - kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeNativeLocal, FileSystemMountOption(), base::FilePath(DRIVE FPL("/test/ext")))); // Register a system external mount point with the same name/id as the // registered isolated mount point. ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( kIsolatedFileSystemID, - kFileSystemTypeRestrictedNativeLocal, + fileapi::kFileSystemTypeRestrictedNativeLocal, FileSystemMountOption(), base::FilePath(DRIVE FPL("/test/system/isolated")))); // Add a mount points with the same name as a system mount point to // FileSystemContext's external mount points. ASSERT_TRUE(external_mount_points->RegisterFileSystem( "ext", - kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeNativeLocal, FileSystemMountOption(), base::FilePath(DRIVE FPL("/test/local/ext/")))); @@ -242,40 +250,41 @@ TEST_F(FileSystemContextTest, CrackFileSystemURL) { // Following should not be handled by the url crackers: { "pers_mount", "persistent", true /* is_valid */, - kFileSystemTypePersistent, kFileSystemTypePersistent, + fileapi::kFileSystemTypePersistent, fileapi::kFileSystemTypePersistent, FPL("pers_mount/root/file"), std::string() /* filesystem id */ }, { "temp_mount", "temporary", true /* is_valid */, - kFileSystemTypeTemporary, kFileSystemTypeTemporary, + fileapi::kFileSystemTypeTemporary, fileapi::kFileSystemTypeTemporary, FPL("temp_mount/root/file"), std::string() /* filesystem id */ }, // Should be cracked by isolated mount points: { kIsolatedFileSystemID, "isolated", true /* is_valid */, - kFileSystemTypeIsolated, kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeIsolated, fileapi::kFileSystemTypeNativeLocal, DRIVE FPL("/test/isolated/root/file"), kIsolatedFileSystemID }, // Should be cracked by system mount points: { "system", "external", true /* is_valid */, - kFileSystemTypeExternal, kFileSystemTypeDrive, + fileapi::kFileSystemTypeExternal, fileapi::kFileSystemTypeDrive, DRIVE FPL("/test/sys/root/file"), "system" }, { kIsolatedFileSystemID, "external", true /* is_valid */, - kFileSystemTypeExternal, kFileSystemTypeRestrictedNativeLocal, + fileapi::kFileSystemTypeExternal, + fileapi::kFileSystemTypeRestrictedNativeLocal, DRIVE FPL("/test/system/isolated/root/file"), kIsolatedFileSystemID }, // Should be cracked by FileSystemContext's ExternalMountPoints. { "ext", "external", true /* is_valid */, - kFileSystemTypeExternal, kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeExternal, fileapi::kFileSystemTypeNativeLocal, DRIVE FPL("/test/local/ext/root/file"), "ext" }, @@ -284,15 +293,15 @@ TEST_F(FileSystemContextTest, CrackFileSystemURL) { { "sytem", "external", false /* is_valid */, // The rest of values will be ignored. - kFileSystemTypeUnknown, kFileSystemTypeUnknown, FPL(""), - std::string() + fileapi::kFileSystemTypeUnknown, fileapi::kFileSystemTypeUnknown, + FPL(""), std::string() }, // Test for URL with non-existing filesystem id. { "invalid", "external", false /* is_valid */, // The rest of values will be ignored. - kFileSystemTypeUnknown, kFileSystemTypeUnknown, FPL(""), - std::string() + fileapi::kFileSystemTypeUnknown, fileapi::kFileSystemTypeUnknown, + FPL(""), std::string() }, }; @@ -339,29 +348,30 @@ TEST_F(FileSystemContextTest, CanServeURLRequest) { // A request for a sandbox mount point should be served. FileSystemURL cracked_url = context->CrackURL(CreateRawFileSystemURL("persistent", "pers_mount")); - EXPECT_EQ(kFileSystemTypePersistent, cracked_url.mount_type()); + EXPECT_EQ(fileapi::kFileSystemTypePersistent, cracked_url.mount_type()); EXPECT_TRUE(context->CanServeURLRequest(cracked_url)); // A request for an isolated mount point should NOT be served. std::string isolated_fs_name = "root"; std::string isolated_fs_id = IsolatedContext::GetInstance()->RegisterFileSystemForPath( - kFileSystemTypeNativeLocal, + fileapi::kFileSystemTypeNativeLocal, base::FilePath(DRIVE FPL("/test/isolated/root")), &isolated_fs_name); cracked_url = context->CrackURL( CreateRawFileSystemURL("isolated", isolated_fs_id)); - EXPECT_EQ(kFileSystemTypeIsolated, cracked_url.mount_type()); + EXPECT_EQ(fileapi::kFileSystemTypeIsolated, cracked_url.mount_type()); EXPECT_FALSE(context->CanServeURLRequest(cracked_url)); // A request for an external mount point should be served. const std::string kExternalMountName = "ext_mount"; ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( - kExternalMountName, kFileSystemTypeDrive, FileSystemMountOption(), + kExternalMountName, fileapi::kFileSystemTypeDrive, + FileSystemMountOption(), base::FilePath())); cracked_url = context->CrackURL( CreateRawFileSystemURL("external", kExternalMountName)); - EXPECT_EQ(kFileSystemTypeExternal, cracked_url.mount_type()); + EXPECT_EQ(fileapi::kFileSystemTypeExternal, cracked_url.mount_type()); EXPECT_TRUE(context->CanServeURLRequest(cracked_url)); ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( @@ -371,4 +381,4 @@ TEST_F(FileSystemContextTest, CanServeURLRequest) { } // namespace -} // namespace fileapi +} // namespace content |