| 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/test_file_system_context.h" | 5 #include "content/public/test/test_file_system_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "content/public/test/mock_special_storage_policy.h" | 11 #include "content/public/test/mock_special_storage_policy.h" |
| 12 #include "content/public/test/test_file_system_backend.h" | 12 #include "content/public/test/test_file_system_backend.h" |
| 13 #include "content/public/test/test_file_system_options.h" | 13 #include "content/public/test/test_file_system_options.h" |
| 14 #include "storage/browser/fileapi/external_mount_points.h" | 14 #include "storage/browser/fileapi/external_mount_points.h" |
| 15 #include "storage/browser/fileapi/file_system_backend.h" | 15 #include "storage/browser/fileapi/file_system_backend.h" |
| 16 #include "storage/browser/fileapi/file_system_context.h" | 16 #include "storage/browser/fileapi/file_system_context.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 storage::FileSystemContext* CreateFileSystemContextForTesting( | 20 storage::FileSystemContext* CreateFileSystemContextForTesting( |
| 21 storage::QuotaManagerProxy* quota_manager_proxy, | 21 storage::QuotaManagerProxy* quota_manager_proxy, |
| 22 const base::FilePath& base_path) { | 22 const base::FilePath& base_path) { |
| 23 ScopedVector<storage::FileSystemBackend> additional_providers; | 23 std::vector<std::unique_ptr<storage::FileSystemBackend>> additional_providers; |
| 24 additional_providers.push_back(new TestFileSystemBackend( | 24 additional_providers.push_back(base::MakeUnique<TestFileSystemBackend>( |
| 25 base::ThreadTaskRunnerHandle::Get().get(), base_path)); | 25 base::ThreadTaskRunnerHandle::Get().get(), base_path)); |
| 26 return CreateFileSystemContextWithAdditionalProvidersForTesting( | 26 return CreateFileSystemContextWithAdditionalProvidersForTesting( |
| 27 quota_manager_proxy, std::move(additional_providers), base_path); | 27 quota_manager_proxy, std::move(additional_providers), base_path); |
| 28 } | 28 } |
| 29 | 29 |
| 30 storage::FileSystemContext* | 30 storage::FileSystemContext* |
| 31 CreateFileSystemContextWithAdditionalProvidersForTesting( | 31 CreateFileSystemContextWithAdditionalProvidersForTesting( |
| 32 storage::QuotaManagerProxy* quota_manager_proxy, | 32 storage::QuotaManagerProxy* quota_manager_proxy, |
| 33 ScopedVector<storage::FileSystemBackend> additional_providers, | 33 std::vector<std::unique_ptr<storage::FileSystemBackend>> |
| 34 additional_providers, |
| 34 const base::FilePath& base_path) { | 35 const base::FilePath& base_path) { |
| 35 return new storage::FileSystemContext( | 36 return new storage::FileSystemContext( |
| 36 base::ThreadTaskRunnerHandle::Get().get(), | 37 base::ThreadTaskRunnerHandle::Get().get(), |
| 37 base::ThreadTaskRunnerHandle::Get().get(), | 38 base::ThreadTaskRunnerHandle::Get().get(), |
| 38 storage::ExternalMountPoints::CreateRefCounted().get(), | 39 storage::ExternalMountPoints::CreateRefCounted().get(), |
| 39 make_scoped_refptr(new MockSpecialStoragePolicy()).get(), | 40 make_scoped_refptr(new MockSpecialStoragePolicy()).get(), |
| 40 quota_manager_proxy, std::move(additional_providers), | 41 quota_manager_proxy, std::move(additional_providers), |
| 41 std::vector<storage::URLRequestAutoMountHandler>(), base_path, | 42 std::vector<storage::URLRequestAutoMountHandler>(), base_path, |
| 42 CreateAllowFileAccessOptions()); | 43 CreateAllowFileAccessOptions()); |
| 43 } | 44 } |
| 44 | 45 |
| 45 storage::FileSystemContext* CreateFileSystemContextWithAutoMountersForTesting( | 46 storage::FileSystemContext* CreateFileSystemContextWithAutoMountersForTesting( |
| 46 storage::QuotaManagerProxy* quota_manager_proxy, | 47 storage::QuotaManagerProxy* quota_manager_proxy, |
| 47 ScopedVector<storage::FileSystemBackend> additional_providers, | 48 std::vector<std::unique_ptr<storage::FileSystemBackend>> |
| 49 additional_providers, |
| 48 const std::vector<storage::URLRequestAutoMountHandler>& auto_mounters, | 50 const std::vector<storage::URLRequestAutoMountHandler>& auto_mounters, |
| 49 const base::FilePath& base_path) { | 51 const base::FilePath& base_path) { |
| 50 return new storage::FileSystemContext( | 52 return new storage::FileSystemContext( |
| 51 base::ThreadTaskRunnerHandle::Get().get(), | 53 base::ThreadTaskRunnerHandle::Get().get(), |
| 52 base::ThreadTaskRunnerHandle::Get().get(), | 54 base::ThreadTaskRunnerHandle::Get().get(), |
| 53 storage::ExternalMountPoints::CreateRefCounted().get(), | 55 storage::ExternalMountPoints::CreateRefCounted().get(), |
| 54 make_scoped_refptr(new MockSpecialStoragePolicy()).get(), | 56 make_scoped_refptr(new MockSpecialStoragePolicy()).get(), |
| 55 quota_manager_proxy, std::move(additional_providers), auto_mounters, | 57 quota_manager_proxy, std::move(additional_providers), auto_mounters, |
| 56 base_path, CreateAllowFileAccessOptions()); | 58 base_path, CreateAllowFileAccessOptions()); |
| 57 } | 59 } |
| 58 | 60 |
| 59 storage::FileSystemContext* CreateIncognitoFileSystemContextForTesting( | 61 storage::FileSystemContext* CreateIncognitoFileSystemContextForTesting( |
| 60 storage::QuotaManagerProxy* quota_manager_proxy, | 62 storage::QuotaManagerProxy* quota_manager_proxy, |
| 61 const base::FilePath& base_path) { | 63 const base::FilePath& base_path) { |
| 62 ScopedVector<storage::FileSystemBackend> additional_providers; | |
| 63 return new storage::FileSystemContext( | 64 return new storage::FileSystemContext( |
| 64 base::ThreadTaskRunnerHandle::Get().get(), | 65 base::ThreadTaskRunnerHandle::Get().get(), |
| 65 base::ThreadTaskRunnerHandle::Get().get(), | 66 base::ThreadTaskRunnerHandle::Get().get(), |
| 66 storage::ExternalMountPoints::CreateRefCounted().get(), | 67 storage::ExternalMountPoints::CreateRefCounted().get(), |
| 67 make_scoped_refptr(new MockSpecialStoragePolicy()).get(), | 68 make_scoped_refptr(new MockSpecialStoragePolicy()).get(), |
| 68 quota_manager_proxy, std::move(additional_providers), | 69 quota_manager_proxy, |
| 70 std::vector<std::unique_ptr<storage::FileSystemBackend>>(), |
| 69 std::vector<storage::URLRequestAutoMountHandler>(), base_path, | 71 std::vector<storage::URLRequestAutoMountHandler>(), base_path, |
| 70 CreateIncognitoFileSystemOptions()); | 72 CreateIncognitoFileSystemOptions()); |
| 71 } | 73 } |
| 72 | 74 |
| 73 } // namespace content | 75 } // namespace content |
| OLD | NEW |