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

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

Issue 206083004: Revert of Revert of Add a parameter to FileStreamWriter::CreateForLocalFile to allow creating new (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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 base::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,
84 FileStreamWriter::OPEN_EXISTING_FILE);
84 } 85 }
85 86
86 private: 87 private:
87 base::MessageLoopForIO message_loop_; 88 base::MessageLoopForIO message_loop_;
88 base::Thread file_thread_; 89 base::Thread file_thread_;
89 base::ScopedTempDir temp_dir_; 90 base::ScopedTempDir temp_dir_;
90 }; 91 };
91 92
92 void NeverCalled(int unused) { 93 void NeverCalled(int unused) {
93 ADD_FAILURE(); 94 ADD_FAILURE();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled)); 168 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled));
168 ASSERT_EQ(net::ERR_IO_PENDING, result); 169 ASSERT_EQ(net::ERR_IO_PENDING, result);
169 170
170 net::TestCompletionCallback callback; 171 net::TestCompletionCallback callback;
171 writer->Cancel(callback.callback()); 172 writer->Cancel(callback.callback());
172 int cancel_result = callback.WaitForResult(); 173 int cancel_result = callback.WaitForResult();
173 EXPECT_EQ(net::OK, cancel_result); 174 EXPECT_EQ(net::OK, cancel_result);
174 } 175 }
175 176
176 } // namespace fileapi 177 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/local_file_stream_writer.cc ('k') | webkit/browser/fileapi/sandbox_file_stream_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698