| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "content/public/test/async_file_test_helper.h" | 9 #include "content/public/test/async_file_test_helper.h" |
| 10 #include "storage/browser/fileapi/file_system_backend.h" | 10 #include "storage/browser/fileapi/file_system_backend.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 | 180 |
| 181 base::File::Error AsyncFileTestHelper::CreateFileWithData( | 181 base::File::Error AsyncFileTestHelper::CreateFileWithData( |
| 182 storage::FileSystemContext* context, | 182 storage::FileSystemContext* context, |
| 183 const storage::FileSystemURL& url, | 183 const storage::FileSystemURL& url, |
| 184 const char* buf, | 184 const char* buf, |
| 185 int buf_size) { | 185 int buf_size) { |
| 186 base::ScopedTempDir dir; | 186 base::ScopedTempDir dir; |
| 187 if (!dir.CreateUniqueTempDir()) | 187 if (!dir.CreateUniqueTempDir()) |
| 188 return base::File::FILE_ERROR_FAILED; | 188 return base::File::FILE_ERROR_FAILED; |
| 189 base::FilePath local_path = dir.path().AppendASCII("tmp"); | 189 base::FilePath local_path = dir.GetPath().AppendASCII("tmp"); |
| 190 if (buf_size != base::WriteFile(local_path, buf, buf_size)) | 190 if (buf_size != base::WriteFile(local_path, buf, buf_size)) |
| 191 return base::File::FILE_ERROR_FAILED; | 191 return base::File::FILE_ERROR_FAILED; |
| 192 base::File::Error result = base::File::FILE_ERROR_FAILED; | 192 base::File::Error result = base::File::FILE_ERROR_FAILED; |
| 193 base::RunLoop run_loop; | 193 base::RunLoop run_loop; |
| 194 context->operation_runner()->CopyInForeignFile( | 194 context->operation_runner()->CopyInForeignFile( |
| 195 local_path, url, AssignAndQuitCallback(&run_loop, &result)); | 195 local_path, url, AssignAndQuitCallback(&run_loop, &result)); |
| 196 run_loop.Run(); | 196 run_loop.Run(); |
| 197 return result; | 197 return result; |
| 198 } | 198 } |
| 199 | 199 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 storage::QuotaStatusCode status = storage::kQuotaStatusUnknown; | 263 storage::QuotaStatusCode status = storage::kQuotaStatusUnknown; |
| 264 quota_manager->GetUsageAndQuota( | 264 quota_manager->GetUsageAndQuota( |
| 265 origin, | 265 origin, |
| 266 FileSystemTypeToQuotaStorageType(type), | 266 FileSystemTypeToQuotaStorageType(type), |
| 267 base::Bind(&DidGetUsageAndQuota, &status, usage, quota)); | 267 base::Bind(&DidGetUsageAndQuota, &status, usage, quota)); |
| 268 base::RunLoop().RunUntilIdle(); | 268 base::RunLoop().RunUntilIdle(); |
| 269 return status; | 269 return status; |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace content | 272 } // namespace content |
| OLD | NEW |