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

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

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « content/common/sandbox_mac_fontloading_unittest.mm ('k') | content/test/image_decoder_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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
OLDNEW
« no previous file with comments | « content/common/sandbox_mac_fontloading_unittest.mm ('k') | content/test/image_decoder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698