OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 | 1626 |
1627 // Perform the enumerations. | 1627 // Perform the enumerations. |
1628 scoped_ptr<TestIterator> iter = CreateIterator(); | 1628 scoped_ptr<TestIterator> iter = CreateIterator(); |
1629 disk_cache::Entry* entry = NULL; | 1629 disk_cache::Entry* entry = NULL; |
1630 int count = 0; | 1630 int count = 0; |
1631 while (iter->OpenNextEntry(&entry) == net::OK) { | 1631 while (iter->OpenNextEntry(&entry) == net::OK) { |
1632 ASSERT_TRUE(entry != NULL); | 1632 ASSERT_TRUE(entry != NULL); |
1633 ++count; | 1633 ++count; |
1634 disk_cache::MemEntryImpl* mem_entry = | 1634 disk_cache::MemEntryImpl* mem_entry = |
1635 reinterpret_cast<disk_cache::MemEntryImpl*>(entry); | 1635 reinterpret_cast<disk_cache::MemEntryImpl*>(entry); |
1636 EXPECT_EQ(disk_cache::MemEntryImpl::kParentEntry, mem_entry->type()); | 1636 EXPECT_EQ(disk_cache::MemEntryImpl::PARENT_ENTRY, mem_entry->type()); |
1637 mem_entry->Close(); | 1637 mem_entry->Close(); |
1638 } | 1638 } |
1639 EXPECT_EQ(1, count); | 1639 EXPECT_EQ(1, count); |
1640 } | 1640 } |
1641 | 1641 |
1642 // Writes |buf_1| to offset and reads it back as |buf_2|. | 1642 // Writes |buf_1| to offset and reads it back as |buf_2|. |
1643 void VerifySparseIO(disk_cache::Entry* entry, | 1643 void VerifySparseIO(disk_cache::Entry* entry, |
1644 int64_t offset, | 1644 int64_t offset, |
1645 net::IOBuffer* buf_1, | 1645 net::IOBuffer* buf_1, |
1646 int size, | 1646 int size, |
(...skipping 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4157 ASSERT_EQ(net::OK, OpenEntry(key, &entry)); | 4157 ASSERT_EQ(net::OK, OpenEntry(key, &entry)); |
4158 | 4158 |
4159 ret = entry->ReadSparseData(0, buffer.get(), kSize, callback.callback()); | 4159 ret = entry->ReadSparseData(0, buffer.get(), kSize, callback.callback()); |
4160 EXPECT_EQ(0, callback.GetResult(ret)); | 4160 EXPECT_EQ(0, callback.GetResult(ret)); |
4161 | 4161 |
4162 ret = entry->ReadSparseData(kSize, buffer.get(), kSize, callback.callback()); | 4162 ret = entry->ReadSparseData(kSize, buffer.get(), kSize, callback.callback()); |
4163 EXPECT_EQ(kSize, callback.GetResult(ret)); | 4163 EXPECT_EQ(kSize, callback.GetResult(ret)); |
4164 | 4164 |
4165 entry->Close(); | 4165 entry->Close(); |
4166 } | 4166 } |
OLD | NEW |