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