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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 base::Time GetLastUsed() const override { return entry_->GetLastUsed(); } | 96 base::Time GetLastUsed() const override { return entry_->GetLastUsed(); } |
97 | 97 |
98 base::Time GetLastModified() const override { | 98 base::Time GetLastModified() const override { |
99 return entry_->GetLastModified(); | 99 return entry_->GetLastModified(); |
100 } | 100 } |
101 | 101 |
102 int32_t GetDataSize(int index) const override { | 102 int32_t GetDataSize(int index) const override { |
103 return entry_->GetDataSize(index); | 103 return entry_->GetDataSize(index); |
104 } | 104 } |
105 | 105 |
| 106 int64_t GetEntrySize() const override { return entry_->GetEntrySize(); } |
| 107 |
106 int ReadData(int index, | 108 int ReadData(int index, |
107 int offset, | 109 int offset, |
108 IOBuffer* buf, | 110 IOBuffer* buf, |
109 int buf_len, | 111 int buf_len, |
110 const CompletionCallback& original_callback) override { | 112 const CompletionCallback& original_callback) override { |
111 net::TestCompletionCallback callback; | 113 net::TestCompletionCallback callback; |
112 int rv = entry_->ReadData(index, offset, buf, buf_len, callback.callback()); | 114 int rv = entry_->ReadData(index, offset, buf, buf_len, callback.callback()); |
113 DCHECK_NE(rv, net::ERR_IO_PENDING) | 115 DCHECK_NE(rv, net::ERR_IO_PENDING) |
114 << "Test expects to use a MEMORY_CACHE instance, which is synchronous."; | 116 << "Test expects to use a MEMORY_CACHE instance, which is synchronous."; |
115 pending_read_callbacks_.push_back(base::Bind(original_callback, rv)); | 117 pending_read_callbacks_.push_back(base::Bind(original_callback, rv)); |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 reader_->Read(buffer.get(), kDataSize, &bytes_read, | 1242 reader_->Read(buffer.get(), kDataSize, &bytes_read, |
1241 base::Bind(&SetValue<int>, &async_bytes_read))); | 1243 base::Bind(&SetValue<int>, &async_bytes_read))); |
1242 EXPECT_EQ(net::OK, reader_->net_error()); | 1244 EXPECT_EQ(net::OK, reader_->net_error()); |
1243 EXPECT_EQ(kDataSize, static_cast<size_t>(bytes_read)); | 1245 EXPECT_EQ(kDataSize, static_cast<size_t>(bytes_read)); |
1244 EXPECT_EQ(0, async_bytes_read); | 1246 EXPECT_EQ(0, async_bytes_read); |
1245 EXPECT_EQ(kData, std::string(buffer->data(), kDataSize)); | 1247 EXPECT_EQ(kData, std::string(buffer->data(), kDataSize)); |
1246 EXPECT_EQ(net::OK, size_result); | 1248 EXPECT_EQ(net::OK, size_result); |
1247 } | 1249 } |
1248 | 1250 |
1249 } // namespace storage | 1251 } // namespace storage |
OLD | NEW |