Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: content/public/test/async_file_test_helper.cc

Issue 1194783002: Add fileManagerPrivate.onCopyError event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove const and rename enum. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return CopyWithProgress(context, src, dest, CopyProgressCallback()); 97 return CopyWithProgress(context, src, dest, CopyProgressCallback());
98 } 98 }
99 99
100 base::File::Error AsyncFileTestHelper::CopyWithProgress( 100 base::File::Error AsyncFileTestHelper::CopyWithProgress(
101 storage::FileSystemContext* context, 101 storage::FileSystemContext* context,
102 const storage::FileSystemURL& src, 102 const storage::FileSystemURL& src,
103 const storage::FileSystemURL& dest, 103 const storage::FileSystemURL& dest,
104 const CopyProgressCallback& progress_callback) { 104 const CopyProgressCallback& progress_callback) {
105 base::File::Error result = base::File::FILE_ERROR_FAILED; 105 base::File::Error result = base::File::FILE_ERROR_FAILED;
106 base::RunLoop run_loop; 106 base::RunLoop run_loop;
107 context->operation_runner()->Copy(src, 107 context->operation_runner()->Copy(
108 dest, 108 src, dest, storage::FileSystemOperation::OPTION_NONE,
109 storage::FileSystemOperation::OPTION_NONE, 109 storage::FileSystemOperation::ERROR_BEHAVIOR_ABORT, progress_callback,
110 progress_callback, 110 AssignAndQuitCallback(&run_loop, &result));
111 AssignAndQuitCallback(&run_loop, &result));
112 run_loop.Run(); 111 run_loop.Run();
113 return result; 112 return result;
114 } 113 }
115 114
116 base::File::Error AsyncFileTestHelper::Move( 115 base::File::Error AsyncFileTestHelper::Move(
117 storage::FileSystemContext* context, 116 storage::FileSystemContext* context,
118 const storage::FileSystemURL& src, 117 const storage::FileSystemURL& src,
119 const storage::FileSystemURL& dest) { 118 const storage::FileSystemURL& dest) {
120 base::File::Error result = base::File::FILE_ERROR_FAILED; 119 base::File::Error result = base::File::FILE_ERROR_FAILED;
121 base::RunLoop run_loop; 120 base::RunLoop run_loop;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 storage::QuotaStatusCode status = storage::kQuotaStatusUnknown; 261 storage::QuotaStatusCode status = storage::kQuotaStatusUnknown;
263 quota_manager->GetUsageAndQuota( 262 quota_manager->GetUsageAndQuota(
264 origin, 263 origin,
265 FileSystemTypeToQuotaStorageType(type), 264 FileSystemTypeToQuotaStorageType(type),
266 base::Bind(&DidGetUsageAndQuota, &status, usage, quota)); 265 base::Bind(&DidGetUsageAndQuota, &status, usage, quota));
267 base::RunLoop().RunUntilIdle(); 266 base::RunLoop().RunUntilIdle();
268 return status; 267 return status;
269 } 268 }
270 269
271 } // namespace storage 270 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698