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

Side by Side Diff: webkit/browser/fileapi/local_file_stream_writer_unittest.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 result = callback.WaitForResult(); 58 result = callback.WaitForResult();
59 if (result <= 0) 59 if (result <= 0)
60 return result; 60 return result;
61 drainable->DidConsume(result); 61 drainable->DidConsume(result);
62 } 62 }
63 return net::OK; 63 return net::OK;
64 } 64 }
65 65
66 std::string GetFileContent(const base::FilePath& path) { 66 std::string GetFileContent(const base::FilePath& path) {
67 std::string content; 67 std::string content;
68 file_util::ReadFileToString(path, &content); 68 base::ReadFileToString(path, &content);
69 return content; 69 return content;
70 } 70 }
71 71
72 base::FilePath CreateFileWithContent(const std::string& name, 72 base::FilePath CreateFileWithContent(const std::string& name,
73 const std::string& data) { 73 const std::string& data) {
74 base::FilePath path = Path(name); 74 base::FilePath path = Path(name);
75 file_util::WriteFile(path, data.c_str(), data.size()); 75 file_util::WriteFile(path, data.c_str(), data.size());
76 return path; 76 return path;
77 } 77 }
78 78
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 scoped_refptr<net::StringIOBuffer> buffer(new net::StringIOBuffer("xxx")); 171 scoped_refptr<net::StringIOBuffer> buffer(new net::StringIOBuffer("xxx"));
172 int result = 172 int result =
173 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled)); 173 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled));
174 ASSERT_EQ(net::ERR_IO_PENDING, result); 174 ASSERT_EQ(net::ERR_IO_PENDING, result);
175 175
176 net::TestCompletionCallback callback; 176 net::TestCompletionCallback callback;
177 writer->Cancel(callback.callback()); 177 writer->Cancel(callback.callback());
178 int cancel_result = callback.WaitForResult(); 178 int cancel_result = callback.WaitForResult();
179 EXPECT_EQ(net::OK, cancel_result); 179 EXPECT_EQ(net::OK, cancel_result);
180 } 180 }
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/isolated_file_util_unittest.cc ('k') | webkit/browser/fileapi/obfuscated_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698