Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: net/disk_cache/flash/log_store_entry_unittest.cc

Issue 14265009: FlashCache refactorings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More refactorings. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/flash/log_store.cc ('k') | net/disk_cache/flash/log_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/flash/log_store_entry_unittest.cc
diff --git a/net/disk_cache/flash/log_store_entry_unittest.cc b/net/disk_cache/flash/log_store_entry_unittest.cc
index 8ea318666bf57837359044c751a613d379a498b7..d15616fcc0b2a85f5debb45d61f7094989adde6e 100644
--- a/net/disk_cache/flash/log_store_entry_unittest.cc
+++ b/net/disk_cache/flash/log_store_entry_unittest.cc
@@ -7,6 +7,7 @@
#include "net/disk_cache/disk_cache_test_util.h"
#include "net/disk_cache/flash/flash_cache_test_base.h"
#include "net/disk_cache/flash/format.h"
+#include "net/disk_cache/flash/log_store.h"
#include "net/disk_cache/flash/log_store_entry.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -14,11 +15,14 @@ using disk_cache::LogStoreEntry;
// Tests the behavior of a LogStoreEntry with empty streams.
TEST_F(FlashCacheTest, LogStoreEntryEmpty) {
- scoped_ptr<LogStoreEntry> entry(new LogStoreEntry(log_store_.get()));
+ disk_cache::LogStore log_store(path_, kStorageSize);
+ ASSERT_TRUE(log_store.Init());
+
+ scoped_ptr<LogStoreEntry> entry(new LogStoreEntry(&log_store));
EXPECT_TRUE(entry->Init());
EXPECT_TRUE(entry->Close());
- entry.reset(new LogStoreEntry(log_store_.get(), entry->id()));
+ entry.reset(new LogStoreEntry(&log_store, entry->id()));
EXPECT_TRUE(entry->Init());
for (int i = 0; i < disk_cache::kFlashLogStoreEntryNumStreams; ++i) {
@@ -28,10 +32,14 @@ TEST_F(FlashCacheTest, LogStoreEntryEmpty) {
EXPECT_EQ(0, entry->ReadData(i, 0, buf, kSize));
}
EXPECT_TRUE(entry->Close());
+ ASSERT_TRUE(log_store.Close());
}
TEST_F(FlashCacheTest, LogStoreEntryWriteRead) {
- scoped_ptr<LogStoreEntry> entry(new LogStoreEntry(log_store_.get()));
+ disk_cache::LogStore log_store(path_, kStorageSize);
+ ASSERT_TRUE(log_store.Init());
+
+ scoped_ptr<LogStoreEntry> entry(new LogStoreEntry(&log_store));
EXPECT_TRUE(entry->Init());
int sizes[disk_cache::kFlashLogStoreEntryNumStreams] = {333, 444, 555, 666};
@@ -46,7 +54,7 @@ TEST_F(FlashCacheTest, LogStoreEntryWriteRead) {
EXPECT_TRUE(entry->Close());
int32 id = entry->id();
- entry.reset(new LogStoreEntry(log_store_.get(), id));
+ entry.reset(new LogStoreEntry(&log_store, id));
EXPECT_TRUE(entry->Init());
for (int i = 0; i < disk_cache::kFlashLogStoreEntryNumStreams; ++i) {
@@ -57,4 +65,5 @@ TEST_F(FlashCacheTest, LogStoreEntryWriteRead) {
}
EXPECT_TRUE(entry->Close());
EXPECT_EQ(id, entry->id());
+ ASSERT_TRUE(log_store.Close());
}
« no previous file with comments | « net/disk_cache/flash/log_store.cc ('k') | net/disk_cache/flash/log_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698