OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "net/base/upload_disk_cache_entry_element_reader.h" | 5 #include "net/base/upload_disk_cache_entry_element_reader.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 base::Time GetLastUsed() const override { return entry_->GetLastUsed(); } | 63 base::Time GetLastUsed() const override { return entry_->GetLastUsed(); } |
64 | 64 |
65 base::Time GetLastModified() const override { | 65 base::Time GetLastModified() const override { |
66 return entry_->GetLastModified(); | 66 return entry_->GetLastModified(); |
67 } | 67 } |
68 | 68 |
69 int32 GetDataSize(int index) const override { | 69 int32 GetDataSize(int index) const override { |
70 return entry_->GetDataSize(index); | 70 return entry_->GetDataSize(index); |
71 } | 71 } |
72 | 72 |
| 73 int GetEntrySize() const override { |
| 74 return entry_->GetEntrySize(); |
| 75 } |
| 76 |
73 int ReadData(int index, | 77 int ReadData(int index, |
74 int offset, | 78 int offset, |
75 IOBuffer* buf, | 79 IOBuffer* buf, |
76 int buf_len, | 80 int buf_len, |
77 const CompletionCallback& original_callback) override { | 81 const CompletionCallback& original_callback) override { |
78 TestCompletionCallback callback; | 82 TestCompletionCallback callback; |
79 int rv = entry_->ReadData(index, offset, buf, buf_len, callback.callback()); | 83 int rv = entry_->ReadData(index, offset, buf, buf_len, callback.callback()); |
80 DCHECK_NE(rv, ERR_IO_PENDING) | 84 DCHECK_NE(rv, ERR_IO_PENDING) |
81 << "Test expects to use a MEMORY_CACHE instance, which is synchronous."; | 85 << "Test expects to use a MEMORY_CACHE instance, which is synchronous."; |
82 pending_read_callbacks_.push_back(base::Bind(original_callback, rv)); | 86 pending_read_callbacks_.push_back(base::Bind(original_callback, rv)); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 TestCompletionCallback callback; | 326 TestCompletionCallback callback; |
323 int rv = reader.Read(io_buffer.get(), kLength, callback.callback()); | 327 int rv = reader.Read(io_buffer.get(), kLength, callback.callback()); |
324 EXPECT_EQ(static_cast<int>(kLength), callback.GetResult(rv)); | 328 EXPECT_EQ(static_cast<int>(kLength), callback.GetResult(rv)); |
325 EXPECT_EQ(0U, reader.BytesRemaining()); | 329 EXPECT_EQ(0U, reader.BytesRemaining()); |
326 EXPECT_EQ(std::string(kData + kOffset, kLength), | 330 EXPECT_EQ(std::string(kData + kOffset, kLength), |
327 std::string(read_buffer, kLength)); | 331 std::string(read_buffer, kLength)); |
328 } | 332 } |
329 | 333 |
330 } // namespace | 334 } // namespace |
331 } // namespace net | 335 } // namespace net |
OLD | NEW |