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

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

Issue 11269008: Cache backend for devices with flash storage (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: test Created 8 years, 2 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/flash_cache_test_base.h ('k') | net/disk_cache/flash/segment.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/flash/flash_cache_test_base.cc
diff --git a/net/disk_cache/flash/flash_cache_test_base.cc b/net/disk_cache/flash/flash_cache_test_base.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bbe6c6f5e794def81d5b03a989d4c9b0b5f11069
--- /dev/null
+++ b/net/disk_cache/flash/flash_cache_test_base.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/disk_cache/flash/flash_cache_test_base.h"
+
+#include "base/file_path.h"
+#include "base/scoped_temp_dir.h"
+#include "base/time.h"
+#include "net/disk_cache/flash/format.h"
+#include "net/disk_cache/flash/storage.h"
+
+namespace {
+
+const int32 kSegmentCount = 10;
+const FilePath::StringType kCachePath = FILE_PATH_LITERAL("cache");
+
+} // namespace
+
+FlashCacheTest::FlashCacheTest() : num_segments_in_storage_(kSegmentCount) {
+ int seed = static_cast<int>(base::Time::Now().ToInternalValue());
+ srand(seed);
+}
+
+FlashCacheTest::~FlashCacheTest() {
+}
+
+void FlashCacheTest::SetUp() {
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+ const FilePath path(temp_dir_.path().Append(kCachePath));
+
+ int32 storage_size = num_segments_in_storage_ * disk_cache::kFlashSegmentSize;
+ storage_.reset(new disk_cache::Storage(path, storage_size));
+ ASSERT_TRUE(storage_->Init());
+}
+
+void FlashCacheTest::TearDown() {
+ storage_.reset();
+}
« no previous file with comments | « net/disk_cache/flash/flash_cache_test_base.h ('k') | net/disk_cache/flash/segment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698