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/file_util.h" | 6 #include "base/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 "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 base::File::Error AsyncFileTestHelper::CreateFileWithData( | 175 base::File::Error AsyncFileTestHelper::CreateFileWithData( |
176 fileapi::FileSystemContext* context, | 176 fileapi::FileSystemContext* context, |
177 const fileapi::FileSystemURL& url, | 177 const fileapi::FileSystemURL& url, |
178 const char* buf, | 178 const char* buf, |
179 int buf_size) { | 179 int buf_size) { |
180 base::ScopedTempDir dir; | 180 base::ScopedTempDir dir; |
181 if (!dir.CreateUniqueTempDir()) | 181 if (!dir.CreateUniqueTempDir()) |
182 return base::File::FILE_ERROR_FAILED; | 182 return base::File::FILE_ERROR_FAILED; |
183 base::FilePath local_path = dir.path().AppendASCII("tmp"); | 183 base::FilePath local_path = dir.path().AppendASCII("tmp"); |
184 if (buf_size != file_util::WriteFile(local_path, buf, buf_size)) | 184 if (buf_size != base::WriteFile(local_path, buf, buf_size)) |
185 return base::File::FILE_ERROR_FAILED; | 185 return base::File::FILE_ERROR_FAILED; |
186 base::File::Error result = base::File::FILE_ERROR_FAILED; | 186 base::File::Error result = base::File::FILE_ERROR_FAILED; |
187 base::RunLoop run_loop; | 187 base::RunLoop run_loop; |
188 context->operation_runner()->CopyInForeignFile( | 188 context->operation_runner()->CopyInForeignFile( |
189 local_path, url, AssignAndQuitCallback(&run_loop, &result)); | 189 local_path, url, AssignAndQuitCallback(&run_loop, &result)); |
190 run_loop.Run(); | 190 run_loop.Run(); |
191 return result; | 191 return result; |
192 } | 192 } |
193 | 193 |
194 base::File::Error AsyncFileTestHelper::TruncateFile( | 194 base::File::Error AsyncFileTestHelper::TruncateFile( |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 quota::QuotaStatusCode status = quota::kQuotaStatusUnknown; | 257 quota::QuotaStatusCode status = quota::kQuotaStatusUnknown; |
258 quota_manager->GetUsageAndQuota( | 258 quota_manager->GetUsageAndQuota( |
259 origin, | 259 origin, |
260 FileSystemTypeToQuotaStorageType(type), | 260 FileSystemTypeToQuotaStorageType(type), |
261 base::Bind(&DidGetUsageAndQuota, &status, usage, quota)); | 261 base::Bind(&DidGetUsageAndQuota, &status, usage, quota)); |
262 base::RunLoop().RunUntilIdle(); | 262 base::RunLoop().RunUntilIdle(); |
263 return status; | 263 return status; |
264 } | 264 } |
265 | 265 |
266 } // namespace fileapi | 266 } // namespace fileapi |
OLD | NEW |