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 <stdint.h> | 5 #include <stdint.h> |
6 #include <limits> | 6 #include <limits> |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 if (remaining_bytes_ < buf_size) | 194 if (remaining_bytes_ < buf_size) |
195 buf_size = remaining_bytes_; | 195 buf_size = remaining_bytes_; |
196 | 196 |
197 for (int i = 0; i < buf_size; ++i) | 197 for (int i = 0; i < buf_size; ++i) |
198 buf->data()[i] = content_[cursor_++]; | 198 buf->data()[i] = content_[cursor_++]; |
199 remaining_bytes_ -= buf_size; | 199 remaining_bytes_ -= buf_size; |
200 | 200 |
201 return buf_size; | 201 return buf_size; |
202 } | 202 } |
203 | 203 |
204 int GetResponseCode() const override { return 200; } | |
205 | |
206 void GetResponseInfo(net::HttpResponseInfo* info) override { | 204 void GetResponseInfo(net::HttpResponseInfo* info) override { |
207 const char kStatus[] = "HTTP/1.1 200 OK\0"; | 205 const char kStatus[] = "HTTP/1.1 200 OK\0"; |
208 const size_t kStatusLen = arraysize(kStatus); | 206 const size_t kStatusLen = arraysize(kStatus); |
209 | 207 |
210 info->headers = | 208 info->headers = |
211 new net::HttpResponseHeaders(std::string(kStatus, kStatusLen)); | 209 new net::HttpResponseHeaders(std::string(kStatus, kStatusLen)); |
212 } | 210 } |
213 | 211 |
214 protected: | 212 protected: |
215 ~FileWriterDelegateTestJob() override {} | 213 ~FileWriterDelegateTestJob() override {} |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 file_writer_delegate_.reset(); | 503 file_writer_delegate_.reset(); |
506 | 504 |
507 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); | 505 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); |
508 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); | 506 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); |
509 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); | 507 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); |
510 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status()); | 508 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status()); |
511 } | 509 } |
512 } | 510 } |
513 | 511 |
514 } // namespace content | 512 } // namespace content |
OLD | NEW |