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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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* mount_point_provider = |
131 file_system_context_->GetFileSystemBackend(src_type_); | 131 file_system_context_->GetFileSystemBackend(src_type_); |
132 mount_point_provider->InitializeFileSystem( | 132 mount_point_provider->OpenFileSystem( |
133 origin_, src_type_, | 133 origin_, src_type_, |
134 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 134 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
135 NULL /* context */, | |
136 base::Bind(&ExpectOk)); | 135 base::Bind(&ExpectOk)); |
137 mount_point_provider = | 136 mount_point_provider = |
138 file_system_context_->GetFileSystemBackend(dest_type_); | 137 file_system_context_->GetFileSystemBackend(dest_type_); |
139 if (dest_type_ == kFileSystemTypeTest) { | 138 if (dest_type_ == kFileSystemTypeTest) { |
140 TestFileSystemBackend* test_provider = | 139 TestFileSystemBackend* test_provider = |
141 static_cast<TestFileSystemBackend*>(mount_point_provider); | 140 static_cast<TestFileSystemBackend*>(mount_point_provider); |
142 scoped_ptr<CopyOrMoveFileValidatorFactory> factory( | 141 scoped_ptr<CopyOrMoveFileValidatorFactory> factory( |
143 new TestValidatorFactory); | 142 new TestValidatorFactory); |
144 test_provider->set_require_copy_or_move_validator(true); | 143 test_provider->set_require_copy_or_move_validator(true); |
145 test_provider->InitializeCopyOrMoveFileValidatorFactory(factory.Pass()); | 144 test_provider->InitializeCopyOrMoveFileValidatorFactory(factory.Pass()); |
146 } | 145 } |
147 mount_point_provider->InitializeFileSystem( | 146 mount_point_provider->OpenFileSystem( |
148 origin_, dest_type_, | 147 origin_, dest_type_, |
149 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 148 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
150 NULL /* context */, | |
151 base::Bind(&ExpectOk)); | 149 base::Bind(&ExpectOk)); |
152 base::MessageLoop::current()->RunUntilIdle(); | 150 base::MessageLoop::current()->RunUntilIdle(); |
153 | 151 |
154 // Grant relatively big quota initially. | 152 // Grant relatively big quota initially. |
155 quota_manager_->SetQuota(origin_, | 153 quota_manager_->SetQuota(origin_, |
156 FileSystemTypeToQuotaStorageType(src_type_), | 154 FileSystemTypeToQuotaStorageType(src_type_), |
157 1024 * 1024); | 155 1024 * 1024); |
158 quota_manager_->SetQuota(origin_, | 156 quota_manager_->SetQuota(origin_, |
159 FileSystemTypeToQuotaStorageType(dest_type_), | 157 FileSystemTypeToQuotaStorageType(dest_type_), |
160 1024 * 1024); | 158 1024 * 1024); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 {false, FILE_PATH_LITERAL("file 0"), 38}, | 526 {false, FILE_PATH_LITERAL("file 0"), 38}, |
529 {false, FILE_PATH_LITERAL("file 3"), 0}, | 527 {false, FILE_PATH_LITERAL("file 3"), 0}, |
530 }; | 528 }; |
531 | 529 |
532 helper.VerifyTestCaseFiles(dest, | 530 helper.VerifyTestCaseFiles(dest, |
533 kMoveDirResultCases, | 531 kMoveDirResultCases, |
534 arraysize(kMoveDirResultCases)); | 532 arraysize(kMoveDirResultCases)); |
535 } | 533 } |
536 | 534 |
537 } // namespace fileapi | 535 } // namespace fileapi |
OLD | NEW |