OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 int64 offset, | 114 int64 offset, |
115 int64 allowed_growth) { | 115 int64 allowed_growth) { |
116 fileapi::SandboxFileStreamWriter* writer = | 116 fileapi::SandboxFileStreamWriter* writer = |
117 new fileapi::SandboxFileStreamWriter( | 117 new fileapi::SandboxFileStreamWriter( |
118 file_system_context_.get(), | 118 file_system_context_.get(), |
119 GetFileSystemURL(test_file_path), | 119 GetFileSystemURL(test_file_path), |
120 offset, | 120 offset, |
121 *file_system_context_->GetUpdateObservers(kFileSystemType)); | 121 *file_system_context_->GetUpdateObservers(kFileSystemType)); |
122 writer->set_default_quota(allowed_growth); | 122 writer->set_default_quota(allowed_growth); |
123 return new FileWriterDelegate( | 123 return new FileWriterDelegate( |
124 scoped_ptr<fileapi::FileStreamWriter>(writer)); | 124 scoped_ptr<fileapi::FileStreamWriter>(writer), |
| 125 FileWriterDelegate::FLUSH_ON_COMPLETION); |
125 } | 126 } |
126 | 127 |
127 FileWriterDelegate::DelegateWriteCallback GetWriteCallback(Result* result) { | 128 FileWriterDelegate::DelegateWriteCallback GetWriteCallback(Result* result) { |
128 return base::Bind(&Result::DidWrite, base::Unretained(result)); | 129 return base::Bind(&Result::DidWrite, base::Unretained(result)); |
129 } | 130 } |
130 | 131 |
131 // Creates and sets up a FileWriterDelegate for writing the given |blob_url|, | 132 // Creates and sets up a FileWriterDelegate for writing the given |blob_url|, |
132 // and creates a new FileWriterDelegate for the file. | 133 // and creates a new FileWriterDelegate for the file. |
133 void PrepareForWrite(const char* test_file_path, | 134 void PrepareForWrite(const char* test_file_path, |
134 const GURL& blob_url, | 135 const GURL& blob_url, |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 file_writer_delegate_.reset(); | 453 file_writer_delegate_.reset(); |
453 | 454 |
454 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); | 455 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); |
455 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); | 456 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); |
456 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); | 457 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); |
457 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status()); | 458 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status()); |
458 } | 459 } |
459 } | 460 } |
460 | 461 |
461 } // namespace content | 462 } // namespace content |
OLD | NEW |