OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "net/disk_cache/flash/flash_cache_test_base.h" |
| 6 |
| 7 #include "base/file_path.h" |
| 8 #include "base/scoped_temp_dir.h" |
| 9 #include "base/time.h" |
| 10 #include "net/disk_cache/flash/format.h" |
| 11 #include "net/disk_cache/flash/storage.h" |
| 12 |
| 13 namespace { |
| 14 |
| 15 const int32 kSegmentCount = 10; |
| 16 const FilePath::StringType kCachePath = FILE_PATH_LITERAL("cache"); |
| 17 |
| 18 } // namespace |
| 19 |
| 20 FlashCacheTest::FlashCacheTest() : num_segments_in_storage_(kSegmentCount) { |
| 21 int seed = static_cast<int>(base::Time::Now().ToInternalValue()); |
| 22 srand(seed); |
| 23 } |
| 24 |
| 25 FlashCacheTest::~FlashCacheTest() { |
| 26 } |
| 27 |
| 28 void FlashCacheTest::SetUp() { |
| 29 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 30 const FilePath path(temp_dir_.path().Append(kCachePath)); |
| 31 |
| 32 int32 storage_size = num_segments_in_storage_ * disk_cache::kFlashSegmentSize; |
| 33 storage_.reset(new disk_cache::Storage(path, storage_size)); |
| 34 ASSERT_TRUE(storage_->Init()); |
| 35 } |
| 36 |
| 37 void FlashCacheTest::TearDown() { |
| 38 storage_.reset(); |
| 39 } |
OLD | NEW |