| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_system_test_helper.h" | 5 #include "webkit/fileapi/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" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 void FileSystemTestOriginHelper::SetUp( | 88 void FileSystemTestOriginHelper::SetUp( |
| 89 const FilePath& base_dir, | 89 const FilePath& base_dir, |
| 90 bool incognito_mode, | 90 bool incognito_mode, |
| 91 bool unlimited_quota, | 91 bool unlimited_quota, |
| 92 quota::QuotaManagerProxy* quota_manager_proxy, | 92 quota::QuotaManagerProxy* quota_manager_proxy, |
| 93 FileSystemFileUtil* file_util) { | 93 FileSystemFileUtil* file_util) { |
| 94 file_util_ = file_util; | 94 file_util_ = file_util; |
| 95 DCHECK(file_util_); | 95 DCHECK(file_util_); |
| 96 file_system_context_ = new FileSystemContext( | 96 file_system_context_ = new FileSystemContext( |
| 97 base::MessageLoopProxy::CreateForCurrentThread(), | 97 base::MessageLoopProxy::current(), |
| 98 base::MessageLoopProxy::CreateForCurrentThread(), | 98 base::MessageLoopProxy::current(), |
| 99 new TestSpecialStoragePolicy(unlimited_quota), | 99 new TestSpecialStoragePolicy(unlimited_quota), |
| 100 quota_manager_proxy, | 100 quota_manager_proxy, |
| 101 base_dir, | 101 base_dir, |
| 102 incognito_mode, | 102 incognito_mode, |
| 103 true /* allow_file_access_from_files */, | 103 true /* allow_file_access_from_files */, |
| 104 unlimited_quota, | 104 unlimited_quota, |
| 105 NULL); | 105 NULL); |
| 106 | 106 |
| 107 DCHECK(file_system_context_->path_manager()); | 107 DCHECK(file_system_context_->path_manager()); |
| 108 DCHECK(file_system_context_->path_manager()->sandbox_provider()); | 108 DCHECK(file_system_context_->path_manager()->sandbox_provider()); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return file_util::ComputeDirectorySize(GetOriginRootPath()) - | 176 return file_util::ComputeDirectorySize(GetOriginRootPath()) - |
| 177 initial_usage_size_; | 177 initial_usage_size_; |
| 178 } | 178 } |
| 179 | 179 |
| 180 FileSystemOperation* FileSystemTestOriginHelper::NewOperation( | 180 FileSystemOperation* FileSystemTestOriginHelper::NewOperation( |
| 181 FileSystemCallbackDispatcher* callback_dispatcher) { | 181 FileSystemCallbackDispatcher* callback_dispatcher) { |
| 182 DCHECK(file_system_context_.get()); | 182 DCHECK(file_system_context_.get()); |
| 183 DCHECK(file_util_); | 183 DCHECK(file_util_); |
| 184 FileSystemOperation* operation = | 184 FileSystemOperation* operation = |
| 185 new FileSystemOperation(callback_dispatcher, | 185 new FileSystemOperation(callback_dispatcher, |
| 186 base::MessageLoopProxy::CreateForCurrentThread(), | 186 base::MessageLoopProxy::current(), |
| 187 file_system_context_.get(), | 187 file_system_context_.get(), |
| 188 file_util_); | 188 file_util_); |
| 189 InitializeOperationContext(operation->file_system_operation_context()); | 189 InitializeOperationContext(operation->file_system_operation_context()); |
| 190 return operation; | 190 return operation; |
| 191 } | 191 } |
| 192 | 192 |
| 193 FileSystemOperationContext* FileSystemTestOriginHelper::NewOperationContext() { | 193 FileSystemOperationContext* FileSystemTestOriginHelper::NewOperationContext() { |
| 194 DCHECK(file_system_context_.get()); | 194 DCHECK(file_system_context_.get()); |
| 195 DCHECK(file_util_); | 195 DCHECK(file_util_); |
| 196 FileSystemOperationContext* context = | 196 FileSystemOperationContext* context = |
| 197 new FileSystemOperationContext(file_system_context_.get(), file_util_); | 197 new FileSystemOperationContext(file_system_context_.get(), file_util_); |
| 198 InitializeOperationContext(context); | 198 InitializeOperationContext(context); |
| 199 return context; | 199 return context; |
| 200 } | 200 } |
| 201 | 201 |
| 202 void FileSystemTestOriginHelper::InitializeOperationContext( | 202 void FileSystemTestOriginHelper::InitializeOperationContext( |
| 203 FileSystemOperationContext* context) { | 203 FileSystemOperationContext* context) { |
| 204 DCHECK(context); | 204 DCHECK(context); |
| 205 context->set_src_origin_url(origin_); | 205 context->set_src_origin_url(origin_); |
| 206 context->set_src_type(type_); | 206 context->set_src_type(type_); |
| 207 context->set_dest_origin_url(origin_); | 207 context->set_dest_origin_url(origin_); |
| 208 context->set_dest_type(type_); | 208 context->set_dest_type(type_); |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace fileapi | 211 } // namespace fileapi |
| OLD | NEW |