| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "webkit/browser/fileapi/sandbox_isolated_origin_database.h" | 31 #include "webkit/browser/fileapi/sandbox_isolated_origin_database.h" |
| 32 #include "webkit/browser/fileapi/sandbox_origin_database.h" | 32 #include "webkit/browser/fileapi/sandbox_origin_database.h" |
| 33 #include "webkit/browser/quota/quota_manager.h" | 33 #include "webkit/browser/quota/quota_manager.h" |
| 34 #include "webkit/common/database/database_identifier.h" | 34 #include "webkit/common/database/database_identifier.h" |
| 35 #include "webkit/common/quota/quota_types.h" | 35 #include "webkit/common/quota/quota_types.h" |
| 36 | 36 |
| 37 using content::AsyncFileTestHelper; | 37 using content::AsyncFileTestHelper; |
| 38 using fileapi::FileSystemContext; | 38 using fileapi::FileSystemContext; |
| 39 using fileapi::FileSystemOperation; | 39 using fileapi::FileSystemOperation; |
| 40 using fileapi::FileSystemOperationContext; | 40 using fileapi::FileSystemOperationContext; |
| 41 using fileapi::FileSystemType; | |
| 42 using fileapi::FileSystemURL; | 41 using fileapi::FileSystemURL; |
| 43 using fileapi::ObfuscatedFileUtil; | 42 using fileapi::ObfuscatedFileUtil; |
| 44 using fileapi::SandboxDirectoryDatabase; | 43 using fileapi::SandboxDirectoryDatabase; |
| 45 using fileapi::SandboxIsolatedOriginDatabase; | 44 using fileapi::SandboxIsolatedOriginDatabase; |
| 46 using fileapi::kFileSystemTypeTemporary; | 45 using fileapi::kFileSystemTypeTemporary; |
| 47 using fileapi::kFileSystemTypePersistent; | 46 using fileapi::kFileSystemTypePersistent; |
| 48 | 47 |
| 49 namespace content { | 48 namespace content { |
| 50 | 49 |
| 51 namespace { | 50 namespace { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 url.mount_type(), | 118 url.mount_type(), |
| 120 url.virtual_path().Append(base::FilePath::FromUTF8Unsafe(child))); | 119 url.virtual_path().Append(base::FilePath::FromUTF8Unsafe(child))); |
| 121 } | 120 } |
| 122 | 121 |
| 123 FileSystemURL FileSystemURLDirName(const FileSystemURL& url) { | 122 FileSystemURL FileSystemURLDirName(const FileSystemURL& url) { |
| 124 return FileSystemURL::CreateForTest( | 123 return FileSystemURL::CreateForTest( |
| 125 url.origin(), url.mount_type(), | 124 url.origin(), url.mount_type(), |
| 126 fileapi::VirtualPath::DirName(url.virtual_path())); | 125 fileapi::VirtualPath::DirName(url.virtual_path())); |
| 127 } | 126 } |
| 128 | 127 |
| 129 std::string GetTypeString(FileSystemType type) { | 128 std::string GetTypeString(fileapi::FileSystemType type) { |
| 130 return fileapi::SandboxFileSystemBackendDelegate::GetTypeString(type); | 129 return fileapi::SandboxFileSystemBackendDelegate::GetTypeString(type); |
| 131 } | 130 } |
| 132 | 131 |
| 133 bool HasFileSystemType( | 132 bool HasFileSystemType(ObfuscatedFileUtil::AbstractOriginEnumerator* enumerator, |
| 134 ObfuscatedFileUtil::AbstractOriginEnumerator* enumerator, | 133 fileapi::FileSystemType type) { |
| 135 FileSystemType type) { | |
| 136 return enumerator->HasTypeDirectory(GetTypeString(type)); | 134 return enumerator->HasTypeDirectory(GetTypeString(type)); |
| 137 } | 135 } |
| 138 | 136 |
| 139 } // namespace | 137 } // namespace |
| 140 | 138 |
| 141 // TODO(ericu): The vast majority of this and the other FSFU subclass tests | 139 // TODO(ericu): The vast majority of this and the other FSFU subclass tests |
| 142 // could theoretically be shared. It would basically be a FSFU interface | 140 // could theoretically be shared. It would basically be a FSFU interface |
| 143 // compliance test, and only the subclass-specific bits that look into the | 141 // compliance test, and only the subclass-specific bits that look into the |
| 144 // implementation would need to be written per-subclass. | 142 // implementation would need to be written per-subclass. |
| 145 class ObfuscatedFileUtilTest : public testing::Test { | 143 class ObfuscatedFileUtilTest : public testing::Test { |
| (...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2449 false /* exclusive */, | 2447 false /* exclusive */, |
| 2450 true /* recursive */)); | 2448 true /* recursive */)); |
| 2451 ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY, | 2449 ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY, |
| 2452 ofu()->CreateDirectory(UnlimitedContext().get(), | 2450 ofu()->CreateDirectory(UnlimitedContext().get(), |
| 2453 path_in_file_in_file, | 2451 path_in_file_in_file, |
| 2454 false /* exclusive */, | 2452 false /* exclusive */, |
| 2455 true /* recursive */)); | 2453 true /* recursive */)); |
| 2456 } | 2454 } |
| 2457 | 2455 |
| 2458 } // namespace content | 2456 } // namespace content |
| OLD | NEW |