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