summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/block_files_unittest.cc
diff options
context:
space:
mode:
authormmoss@google.com <mmoss@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-09 19:51:18 +0000
committermmoss@google.com <mmoss@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-09 19:51:18 +0000
commit2c10721c6927a7218078d9902c3238b81692ebd6 (patch)
tree04750162d068be1cf0e918ecf5d11eb9f3b92311 /net/disk_cache/block_files_unittest.cc
parentc2aaad178ab0a749ff515aca6a87af9597080edf (diff)
downloadchromium_src-2c10721c6927a7218078d9902c3238b81692ebd6.zip
chromium_src-2c10721c6927a7218078d9902c3238b81692ebd6.tar.gz
chromium_src-2c10721c6927a7218078d9902c3238b81692ebd6.tar.bz2
Fix Linux buildbot breakage on BlockFiles_Grow due to lingering cache files.
The buildbot was breaking because temporary cache files were being created under /tmp, like "/tmp/cache_test\data_*", rather than under /tmp/cache_test, like "/tmp/cache_test/data_*". This prevented the files from being cleaned up when /tmp/cache_test was deleted, and after a few runs, the max of 256 cache files was reached, and the tests failed when they couldn't create more. The following changes were made: - Replace '\' with platform-dependent path separator in various places. - Define constant (same as Windows) for invalid Linux file handle to fix error where wrong value was tested. - Force cache initialization in block_files tests, otherwise it fails to create cache files after calling DeleteCache(). BUG=1917 Review URL: http://codereview.chromium.org/1840 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1918 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/block_files_unittest.cc')
-rw-r--r--net/disk_cache/block_files_unittest.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/disk_cache/block_files_unittest.cc b/net/disk_cache/block_files_unittest.cc
index 59ca1d0..211ba96 100644
--- a/net/disk_cache/block_files_unittest.cc
+++ b/net/disk_cache/block_files_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/file_util.h"
#include "net/disk_cache/block_files.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/disk_cache_test_base.h"
@@ -11,6 +12,7 @@
TEST_F(DiskCacheTest, BlockFiles_Grow) {
std::wstring path = GetCachePath();
ASSERT_TRUE(DeleteCache(path.c_str()));
+ ASSERT_TRUE(file_util::CreateDirectory(path));
disk_cache::BlockFiles files(path);
ASSERT_TRUE(files.Init(true));
@@ -26,6 +28,7 @@ TEST_F(DiskCacheTest, BlockFiles_Grow) {
TEST_F(DiskCacheTest, BlockFiles_Recover) {
std::wstring path = GetCachePath();
ASSERT_TRUE(DeleteCache(path.c_str()));
+ ASSERT_TRUE(file_util::CreateDirectory(path));
disk_cache::BlockFiles files(path);
ASSERT_TRUE(files.Init(true));
@@ -98,5 +101,3 @@ TEST_F(DiskCacheTest, BlockFiles_Recover) {
EXPECT_EQ(empty_3, header->empty[2]);
EXPECT_EQ(empty_4, header->empty[3]);
}
-
-