| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <map> | 5 #include <map> |
| 6 #include <queue> | 6 #include <queue> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 base_dir, | 120 base_dir, |
| 121 base::MessageLoopProxy::current().get(), | 121 base::MessageLoopProxy::current().get(), |
| 122 base::MessageLoopProxy::current().get(), | 122 base::MessageLoopProxy::current().get(), |
| 123 NULL /* special storage policy */); | 123 NULL /* special storage policy */); |
| 124 quota_manager_proxy_ = new quota::MockQuotaManagerProxy( | 124 quota_manager_proxy_ = new quota::MockQuotaManagerProxy( |
| 125 quota_manager_.get(), base::MessageLoopProxy::current().get()); | 125 quota_manager_.get(), base::MessageLoopProxy::current().get()); |
| 126 file_system_context_ = | 126 file_system_context_ = |
| 127 CreateFileSystemContextForTesting(quota_manager_proxy_.get(), base_dir); | 127 CreateFileSystemContextForTesting(quota_manager_proxy_.get(), base_dir); |
| 128 | 128 |
| 129 // Prepare the origin's root directory. | 129 // Prepare the origin's root directory. |
| 130 FileSystemBackend* mount_point_provider = | 130 FileSystemBackend* backend = |
| 131 file_system_context_->GetFileSystemBackend(src_type_); | 131 file_system_context_->GetFileSystemBackend(src_type_); |
| 132 mount_point_provider->OpenFileSystem( | 132 backend->OpenFileSystem(origin_, src_type_, |
| 133 origin_, src_type_, | 133 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
| 134 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 134 base::Bind(&ExpectOk)); |
| 135 base::Bind(&ExpectOk)); | 135 backend = file_system_context_->GetFileSystemBackend(dest_type_); |
| 136 mount_point_provider = | |
| 137 file_system_context_->GetFileSystemBackend(dest_type_); | |
| 138 if (dest_type_ == kFileSystemTypeTest) { | 136 if (dest_type_ == kFileSystemTypeTest) { |
| 139 TestFileSystemBackend* test_provider = | 137 TestFileSystemBackend* test_backend = |
| 140 static_cast<TestFileSystemBackend*>(mount_point_provider); | 138 static_cast<TestFileSystemBackend*>(backend); |
| 141 scoped_ptr<CopyOrMoveFileValidatorFactory> factory( | 139 scoped_ptr<CopyOrMoveFileValidatorFactory> factory( |
| 142 new TestValidatorFactory); | 140 new TestValidatorFactory); |
| 143 test_provider->set_require_copy_or_move_validator(true); | 141 test_backend->set_require_copy_or_move_validator(true); |
| 144 test_provider->InitializeCopyOrMoveFileValidatorFactory(factory.Pass()); | 142 test_backend->InitializeCopyOrMoveFileValidatorFactory(factory.Pass()); |
| 145 } | 143 } |
| 146 mount_point_provider->OpenFileSystem( | 144 backend->OpenFileSystem(origin_, dest_type_, |
| 147 origin_, dest_type_, | 145 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
| 148 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 146 base::Bind(&ExpectOk)); |
| 149 base::Bind(&ExpectOk)); | |
| 150 base::MessageLoop::current()->RunUntilIdle(); | 147 base::MessageLoop::current()->RunUntilIdle(); |
| 151 | 148 |
| 152 // Grant relatively big quota initially. | 149 // Grant relatively big quota initially. |
| 153 quota_manager_->SetQuota(origin_, | 150 quota_manager_->SetQuota(origin_, |
| 154 FileSystemTypeToQuotaStorageType(src_type_), | 151 FileSystemTypeToQuotaStorageType(src_type_), |
| 155 1024 * 1024); | 152 1024 * 1024); |
| 156 quota_manager_->SetQuota(origin_, | 153 quota_manager_->SetQuota(origin_, |
| 157 FileSystemTypeToQuotaStorageType(dest_type_), | 154 FileSystemTypeToQuotaStorageType(dest_type_), |
| 158 1024 * 1024); | 155 1024 * 1024); |
| 159 } | 156 } |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 {false, FILE_PATH_LITERAL("file 0"), 38}, | 523 {false, FILE_PATH_LITERAL("file 0"), 38}, |
| 527 {false, FILE_PATH_LITERAL("file 3"), 0}, | 524 {false, FILE_PATH_LITERAL("file 3"), 0}, |
| 528 }; | 525 }; |
| 529 | 526 |
| 530 helper.VerifyTestCaseFiles(dest, | 527 helper.VerifyTestCaseFiles(dest, |
| 531 kMoveDirResultCases, | 528 kMoveDirResultCases, |
| 532 arraysize(kMoveDirResultCases)); | 529 arraysize(kMoveDirResultCases)); |
| 533 } | 530 } |
| 534 | 531 |
| 535 } // namespace fileapi | 532 } // namespace fileapi |
| OLD | NEW |