OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/fileapi/local_file_system_test_helper.h" | 5 #include "webkit/fileapi/local_file_system_test_helper.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "webkit/fileapi/file_system_context.h" | 11 #include "webkit/fileapi/file_system_context.h" |
12 #include "webkit/fileapi/file_system_operation_context.h" | 12 #include "webkit/fileapi/file_system_operation_context.h" |
| 13 #include "webkit/fileapi/file_system_task_runners.h" |
13 #include "webkit/fileapi/file_system_usage_cache.h" | 14 #include "webkit/fileapi/file_system_usage_cache.h" |
14 #include "webkit/fileapi/file_system_util.h" | 15 #include "webkit/fileapi/file_system_util.h" |
15 #include "webkit/fileapi/file_util_helper.h" | 16 #include "webkit/fileapi/file_util_helper.h" |
16 #include "webkit/fileapi/local_file_system_operation.h" | 17 #include "webkit/fileapi/local_file_system_operation.h" |
17 #include "webkit/fileapi/mock_file_system_options.h" | 18 #include "webkit/fileapi/mock_file_system_options.h" |
18 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 19 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
19 #include "webkit/fileapi/test_mount_point_provider.h" | 20 #include "webkit/fileapi/test_mount_point_provider.h" |
20 #include "webkit/quota/mock_special_storage_policy.h" | 21 #include "webkit/quota/mock_special_storage_policy.h" |
21 | 22 |
22 namespace fileapi { | 23 namespace fileapi { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 62 |
62 void LocalFileSystemTestOriginHelper::SetUp( | 63 void LocalFileSystemTestOriginHelper::SetUp( |
63 const FilePath& base_dir, | 64 const FilePath& base_dir, |
64 bool unlimited_quota, | 65 bool unlimited_quota, |
65 quota::QuotaManagerProxy* quota_manager_proxy, | 66 quota::QuotaManagerProxy* quota_manager_proxy, |
66 FileSystemFileUtil* file_util) { | 67 FileSystemFileUtil* file_util) { |
67 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = | 68 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = |
68 new quota::MockSpecialStoragePolicy; | 69 new quota::MockSpecialStoragePolicy; |
69 special_storage_policy->SetAllUnlimited(unlimited_quota); | 70 special_storage_policy->SetAllUnlimited(unlimited_quota); |
70 file_system_context_ = new FileSystemContext( | 71 file_system_context_ = new FileSystemContext( |
71 base::MessageLoopProxy::current(), | 72 make_scoped_ptr(new FileSystemTaskRunners()), |
72 base::MessageLoopProxy::current(), | |
73 special_storage_policy, | 73 special_storage_policy, |
74 quota_manager_proxy, | 74 quota_manager_proxy, |
75 base_dir, | 75 base_dir, |
76 CreateAllowFileAccessOptions()); | 76 CreateAllowFileAccessOptions()); |
77 | 77 |
78 if (type_ == kFileSystemTypeTest) { | 78 if (type_ == kFileSystemTypeTest) { |
79 file_system_context_->RegisterMountPointProvider( | 79 file_system_context_->RegisterMountPointProvider( |
80 type_, | 80 type_, |
81 new TestMountPointProvider(file_system_context_->file_task_runner(), | 81 new TestMountPointProvider( |
82 base_dir)); | 82 file_system_context_->task_runners()->file_task_runner(), |
| 83 base_dir)); |
83 } | 84 } |
84 | 85 |
85 // Prepare the origin's root directory. | 86 // Prepare the origin's root directory. |
86 FileSystemMountPointProvider* mount_point_provider = | 87 FileSystemMountPointProvider* mount_point_provider = |
87 file_system_context_->GetMountPointProvider(type_); | 88 file_system_context_->GetMountPointProvider(type_); |
88 mount_point_provider->GetFileSystemRootPathOnFileThread( | 89 mount_point_provider->GetFileSystemRootPathOnFileThread( |
89 origin_, type_, FilePath(), true /* create */); | 90 origin_, type_, FilePath(), true /* create */); |
90 | 91 |
91 if (file_util) | 92 if (file_util) |
92 file_util_ = file_util; | 93 file_util_ = file_util; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 185 |
185 FileSystemOperationContext* | 186 FileSystemOperationContext* |
186 LocalFileSystemTestOriginHelper::NewOperationContext() { | 187 LocalFileSystemTestOriginHelper::NewOperationContext() { |
187 DCHECK(file_system_context_.get()); | 188 DCHECK(file_system_context_.get()); |
188 FileSystemOperationContext* context = | 189 FileSystemOperationContext* context = |
189 new FileSystemOperationContext(file_system_context_.get()); | 190 new FileSystemOperationContext(file_system_context_.get()); |
190 return context; | 191 return context; |
191 } | 192 } |
192 | 193 |
193 } // namespace fileapi | 194 } // namespace fileapi |
OLD | NEW |