OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "net/disk_cache/cache_util.h" | 7 #include "net/disk_cache/cache_util.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "testing/platform_test.h" | 9 #include "testing/platform_test.h" |
10 | 10 |
11 namespace disk_cache { | 11 namespace disk_cache { |
12 | 12 |
13 class CacheUtilTest : public PlatformTest { | 13 class CacheUtilTest : public PlatformTest { |
14 public: | 14 public: |
15 void SetUp() { | 15 void SetUp() { |
16 PlatformTest::SetUp(); | 16 PlatformTest::SetUp(); |
(...skipping 10 matching lines...) Expand all Loading... |
27 ASSERT_TRUE(fp != NULL); | 27 ASSERT_TRUE(fp != NULL); |
28 file_util::CloseFile(fp); | 28 file_util::CloseFile(fp); |
29 ASSERT_TRUE(file_util::CreateDirectory(dir1_)); | 29 ASSERT_TRUE(file_util::CreateDirectory(dir1_)); |
30 dest_dir_ = tmp_dir_.path().Append(FILE_PATH_LITERAL("old_Cache_001")); | 30 dest_dir_ = tmp_dir_.path().Append(FILE_PATH_LITERAL("old_Cache_001")); |
31 dest_file1_ = FilePath(dest_dir_.Append(FILE_PATH_LITERAL("file01"))); | 31 dest_file1_ = FilePath(dest_dir_.Append(FILE_PATH_LITERAL("file01"))); |
32 dest_file2_ = FilePath(dest_dir_.Append(FILE_PATH_LITERAL(".file02"))); | 32 dest_file2_ = FilePath(dest_dir_.Append(FILE_PATH_LITERAL(".file02"))); |
33 dest_dir1_ = FilePath(dest_dir_.Append(FILE_PATH_LITERAL("dir01"))); | 33 dest_dir1_ = FilePath(dest_dir_.Append(FILE_PATH_LITERAL("dir01"))); |
34 } | 34 } |
35 | 35 |
36 protected: | 36 protected: |
37 ScopedTempDir tmp_dir_; | 37 base::ScopedTempDir tmp_dir_; |
38 FilePath cache_dir_; | 38 FilePath cache_dir_; |
39 FilePath file1_; | 39 FilePath file1_; |
40 FilePath file2_; | 40 FilePath file2_; |
41 FilePath dir1_; | 41 FilePath dir1_; |
42 FilePath dest_dir_; | 42 FilePath dest_dir_; |
43 FilePath dest_file1_; | 43 FilePath dest_file1_; |
44 FilePath dest_file2_; | 44 FilePath dest_file2_; |
45 FilePath dest_dir1_; | 45 FilePath dest_dir1_; |
46 }; | 46 }; |
47 | 47 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 EXPECT_FALSE(file_util::PathExists(file2_)); | 81 EXPECT_FALSE(file_util::PathExists(file2_)); |
82 } | 82 } |
83 | 83 |
84 TEST_F(CacheUtilTest, DeleteCacheFile) { | 84 TEST_F(CacheUtilTest, DeleteCacheFile) { |
85 EXPECT_TRUE(disk_cache::DeleteCacheFile(file1_)); | 85 EXPECT_TRUE(disk_cache::DeleteCacheFile(file1_)); |
86 EXPECT_FALSE(file_util::PathExists(file1_)); | 86 EXPECT_FALSE(file_util::PathExists(file1_)); |
87 EXPECT_TRUE(file_util::PathExists(cache_dir_)); // cache dir stays | 87 EXPECT_TRUE(file_util::PathExists(cache_dir_)); // cache dir stays |
88 } | 88 } |
89 | 89 |
90 } // namespace disk_cache | 90 } // namespace disk_cache |
OLD | NEW |