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

Side by Side Diff: webkit/chromeos/fileapi/memory_file_util_unittest.cc

Issue 9007006: Delete stream after the operation is done in MemoryFileUtil (fix for r115094) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/platform_file.h" 7 #include "base/platform_file.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "webkit/chromeos/fileapi/memory_file_util.h" 10 #include "webkit/chromeos/fileapi/memory_file_util.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 status.entries.insert(status.entries.begin(), entries.begin(), 209 status.entries.insert(status.entries.begin(), entries.begin(),
210 entries.end()); 210 entries.end());
211 } 211 }
212 } 212 }
213 213
214 void WriteToOpenedFile(int request_id, 214 void WriteToOpenedFile(int request_id,
215 const char* data, 215 const char* data,
216 int length, 216 int length,
217 PlatformFileError result, 217 PlatformFileError result,
218 AsyncFileStream* stream) { 218 AsyncFileStream* stream) {
219 DCHECK(status_map_.find(request_id) == status_map_.end());
219 CallbackStatus status; 220 CallbackStatus status;
220 status.type = CALLBACK_TYPE_OPEN; 221 status.type = CALLBACK_TYPE_OPEN;
221 status.result = result; 222 status.result = result;
223 status.file_stream = stream;
222 status_map_[request_id] = status; 224 status_map_[request_id] = status;
223 stream->Write(data, length, GetReadWriteCallback(GetNextRequestId())); 225 stream->Write(data, length, GetReadWriteCallback(GetNextRequestId()));
224 delete stream;
225 } 226 }
226 227
227 scoped_ptr<MemoryFileUtil> file_util_; 228 scoped_ptr<MemoryFileUtil> file_util_;
228 std::map<int, CallbackStatus> status_map_; 229 std::map<int, CallbackStatus> status_map_;
229 int max_request_id_; 230 int max_request_id_;
230 231
231 DISALLOW_COPY_AND_ASSIGN(MemoryFileUtilTest); 232 DISALLOW_COPY_AND_ASSIGN(MemoryFileUtilTest);
232 }; 233 };
233 234
234 TEST_F(MemoryFileUtilTest, TestCreateGetFileInfo) { 235 TEST_F(MemoryFileUtilTest, TestCreateGetFileInfo) {
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 ASSERT_FALSE(it->is_directory); 830 ASSERT_FALSE(it->is_directory);
830 ASSERT_EQ(static_cast<int64>(kTestStringLength), it->size); 831 ASSERT_EQ(static_cast<int64>(kTestStringLength), it->size);
831 } else { 832 } else {
832 LOG(ERROR) << "Unexpected file: " << it->name; 833 LOG(ERROR) << "Unexpected file: " << it->name;
833 ASSERT_TRUE(false); 834 ASSERT_TRUE(false);
834 } 835 }
835 } 836 }
836 } 837 }
837 838
838 } // namespace fileapi 839 } // namespace fileapi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698