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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 // Write to an external file. | 1531 // Write to an external file. |
1532 const int kSize = 20000; | 1532 const int kSize = 20000; |
1533 scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); | 1533 scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); |
1534 CacheTestFillBuffer(buffer->data(), kSize, false); | 1534 CacheTestFillBuffer(buffer->data(), kSize, false); |
1535 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer.get(), kSize, false)); | 1535 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer.get(), kSize, false)); |
1536 entry->Close(); | 1536 entry->Close(); |
1537 FlushQueueForTest(); | 1537 FlushQueueForTest(); |
1538 | 1538 |
1539 disk_cache::Addr address(0x80000001); | 1539 disk_cache::Addr address(0x80000001); |
1540 base::FilePath name = cache_impl_->GetFileName(address); | 1540 base::FilePath name = cache_impl_->GetFileName(address); |
1541 EXPECT_TRUE(base::Delete(name, false)); | 1541 EXPECT_TRUE(base::DeleteFile(name, false)); |
1542 | 1542 |
1543 // Attempt to read the data. | 1543 // Attempt to read the data. |
1544 ASSERT_EQ(net::OK, OpenEntry(key, &entry)); | 1544 ASSERT_EQ(net::OK, OpenEntry(key, &entry)); |
1545 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, | 1545 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, |
1546 ReadData(entry, 0, 0, buffer.get(), kSize)); | 1546 ReadData(entry, 0, 0, buffer.get(), kSize)); |
1547 entry->Close(); | 1547 entry->Close(); |
1548 | 1548 |
1549 // The entry should be gone. | 1549 // The entry should be gone. |
1550 ASSERT_NE(net::OK, OpenEntry(key, &entry)); | 1550 ASSERT_NE(net::OK, OpenEntry(key, &entry)); |
1551 } | 1551 } |
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3295 | 3295 |
3296 // Check that we are not leaking. | 3296 // Check that we are not leaking. |
3297 ASSERT_NE(entry, null); | 3297 ASSERT_NE(entry, null); |
3298 EXPECT_TRUE( | 3298 EXPECT_TRUE( |
3299 static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef()); | 3299 static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef()); |
3300 entry->Close(); | 3300 entry->Close(); |
3301 entry = NULL; | 3301 entry = NULL; |
3302 } | 3302 } |
3303 | 3303 |
3304 #endif // defined(OS_POSIX) | 3304 #endif // defined(OS_POSIX) |
OLD | NEW |