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

Side by Side Diff: webkit/browser/fileapi/local_file_stream_writer_unittest.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/browser/fileapi/local_file_stream_writer.h" 5 #include "webkit/browser/fileapi/local_file_stream_writer.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 std::string GetFileContent(const base::FilePath& path) { 64 std::string GetFileContent(const base::FilePath& path) {
65 std::string content; 65 std::string content;
66 base::ReadFileToString(path, &content); 66 base::ReadFileToString(path, &content);
67 return content; 67 return content;
68 } 68 }
69 69
70 base::FilePath CreateFileWithContent(const std::string& name, 70 base::FilePath CreateFileWithContent(const std::string& name,
71 const std::string& data) { 71 const std::string& data) {
72 base::FilePath path = Path(name); 72 base::FilePath path = Path(name);
73 file_util::WriteFile(path, data.c_str(), data.size()); 73 base::WriteFile(path, data.c_str(), data.size());
74 return path; 74 return path;
75 } 75 }
76 76
77 base::MessageLoopProxy* file_task_runner() const { 77 base::MessageLoopProxy* file_task_runner() const {
78 return file_thread_.message_loop_proxy().get(); 78 return file_thread_.message_loop_proxy().get();
79 } 79 }
80 80
81 LocalFileStreamWriter* CreateWriter(const base::FilePath& path, 81 LocalFileStreamWriter* CreateWriter(const base::FilePath& path,
82 int64 offset) { 82 int64 offset) {
83 return new LocalFileStreamWriter(file_task_runner(), path, offset); 83 return new LocalFileStreamWriter(file_task_runner(), path, offset);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled)); 167 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled));
168 ASSERT_EQ(net::ERR_IO_PENDING, result); 168 ASSERT_EQ(net::ERR_IO_PENDING, result);
169 169
170 net::TestCompletionCallback callback; 170 net::TestCompletionCallback callback;
171 writer->Cancel(callback.callback()); 171 writer->Cancel(callback.callback());
172 int cancel_result = callback.WaitForResult(); 172 int cancel_result = callback.WaitForResult();
173 EXPECT_EQ(net::OK, cancel_result); 173 EXPECT_EQ(net::OK, cancel_result);
174 } 174 }
175 175
176 } // namespace fileapi 176 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698