| 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 "content/public/test/sandbox_file_system_test_helper.h" | 5 #include "content/public/test/sandbox_file_system_test_helper.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 10 #include "content/public/test/mock_special_storage_policy.h" | 11 #include "content/public/test/mock_special_storage_policy.h" |
| 11 #include "content/public/test/test_file_system_context.h" | 12 #include "content/public/test/test_file_system_context.h" |
| 12 #include "storage/browser/fileapi/file_system_context.h" | 13 #include "storage/browser/fileapi/file_system_context.h" |
| 13 #include "storage/browser/fileapi/file_system_file_util.h" | 14 #include "storage/browser/fileapi/file_system_file_util.h" |
| 14 #include "storage/browser/fileapi/file_system_operation_context.h" | 15 #include "storage/browser/fileapi/file_system_operation_context.h" |
| 15 #include "storage/browser/fileapi/file_system_operation_runner.h" | 16 #include "storage/browser/fileapi/file_system_operation_runner.h" |
| 16 #include "storage/browser/fileapi/file_system_url.h" | 17 #include "storage/browser/fileapi/file_system_url.h" |
| 17 #include "storage/browser/fileapi/file_system_usage_cache.h" | 18 #include "storage/browser/fileapi/file_system_usage_cache.h" |
| 18 #include "storage/browser/fileapi/sandbox_file_system_backend.h" | 19 #include "storage/browser/fileapi/sandbox_file_system_backend.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 70 |
| 70 base::FilePath SandboxFileSystemTestHelper::GetOriginRootPath() { | 71 base::FilePath SandboxFileSystemTestHelper::GetOriginRootPath() { |
| 71 return file_system_context_->sandbox_delegate()-> | 72 return file_system_context_->sandbox_delegate()-> |
| 72 GetBaseDirectoryForOriginAndType(origin_, type_, false); | 73 GetBaseDirectoryForOriginAndType(origin_, type_, false); |
| 73 } | 74 } |
| 74 | 75 |
| 75 base::FilePath SandboxFileSystemTestHelper::GetLocalPath( | 76 base::FilePath SandboxFileSystemTestHelper::GetLocalPath( |
| 76 const base::FilePath& path) { | 77 const base::FilePath& path) { |
| 77 DCHECK(file_util_); | 78 DCHECK(file_util_); |
| 78 base::FilePath local_path; | 79 base::FilePath local_path; |
| 79 scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); | 80 std::unique_ptr<FileSystemOperationContext> context(NewOperationContext()); |
| 80 file_util_->GetLocalFilePath(context.get(), CreateURL(path), &local_path); | 81 file_util_->GetLocalFilePath(context.get(), CreateURL(path), &local_path); |
| 81 return local_path; | 82 return local_path; |
| 82 } | 83 } |
| 83 | 84 |
| 84 base::FilePath SandboxFileSystemTestHelper::GetLocalPathFromASCII( | 85 base::FilePath SandboxFileSystemTestHelper::GetLocalPathFromASCII( |
| 85 const std::string& path) { | 86 const std::string& path) { |
| 86 return GetLocalPath(base::FilePath().AppendASCII(path)); | 87 return GetLocalPath(base::FilePath().AppendASCII(path)); |
| 87 } | 88 } |
| 88 | 89 |
| 89 base::FilePath SandboxFileSystemTestHelper::GetUsageCachePath() const { | 90 base::FilePath SandboxFileSystemTestHelper::GetUsageCachePath() const { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 file_system_context_->sandbox_delegate()-> | 157 file_system_context_->sandbox_delegate()-> |
| 157 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); | 158 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); |
| 158 | 159 |
| 159 // Initialize the usage cache file. | 160 // Initialize the usage cache file. |
| 160 base::FilePath usage_cache_path = GetUsageCachePath(); | 161 base::FilePath usage_cache_path = GetUsageCachePath(); |
| 161 if (!usage_cache_path.empty()) | 162 if (!usage_cache_path.empty()) |
| 162 usage_cache()->UpdateUsage(usage_cache_path, 0); | 163 usage_cache()->UpdateUsage(usage_cache_path, 0); |
| 163 } | 164 } |
| 164 | 165 |
| 165 } // namespace content | 166 } // namespace content |
| OLD | NEW |